AMS DocumentationAMS

HTTP Endpoint

An HTTP Endpoint allows data to be pushed as XML to an external web application.

This “push” is performed as an HTTP POST request to the specified URL. The content can only be XML, so one of the transformations must be an XML transformation, but a subsequent XSL transformation can also be applied before the HTTP request is made.

It is also typical to include a Common Data Transformation prior to the XML transformation.

When the HTTP request is made the Content-Type will be ‘application/xml’ and the XML will be UTF-8 encoded. The URL value can only be HTTP or HTTPS and must be accessible from the AMS gateway, typically this means over the Internet but if running a private or hosted gateway then only accessible from the server running AMS.

Attachments

If the route contains any attachments, apart from XML, then the HTTP request will become a multipart/form-data request. The xml will be under the ‘message_xml’ parameter and there will be an ‘attachment_count’ parameter that will indicate the number of attachments present in the request. Each attachment will then be under an ‘attachment_[index]’ value e.g. if there is 1 attachment it can be accessed via the ‘attachment_1’ parameter.

Authorisation Key

If an Authorisation Key has been provided then the hashed value of the key will be specified in the ‘x-ams-auth-key’ custom http header and the root XML element will have an ‘authKey’ attribute with the same value.

For more detail on the hashing processed used see Verifying Hashed Auth Keys

XML Element Ordering (.Net WCF REST)

In AMS there is no guaranteed order to the XML elements. Some XML de-serialization libraries, such as those used in .Net in the new REST services, expect XML elements in a specified order and sometimes that all elements be present, even if they contain no value. The best way to handle these situations in AMS is to add a XSL transformation after the XML one, to ensure the XML used in the request meets your systems requirements.

XML Sample

The easiest way to get a sample of the XML that will be posted in the request, is to use an email endpoint and have the XML set as the body of the email, or attached to it as a file. However as only one endpoint can be set at a time, it is necessary to remove the HTTP endpoint, if it is present, and add a new email endpoint. Then, send some messages through the system to generate sample emails. Once sufficient sample messages have been sent, remove the email endpoint and add the HTTP endpoint back.