api icon

Send (Enqueue) AS2 Message

Request

POST /:v/message/:as2_station_id/:as2_partner_id
Authorization​: <token_string>
Content-Type​: multipart/form-data; boundary=<multipart_boundary>

--<multipart_boundary>
Content-Disposition: form-data; name="file"; filename="file1.txt"
Content-Type: text/plain

one
--<multipart_boundary>
Content-Disposition: form-data; name="file"; filename="file2.txt"
Content-Type: text/plain

two
--<multipart_boundary>--

Path Parameters

  • :as2_station_id: AS2 identifier of the AS2 Station from which you want to send the AS2 message out

  • :as2_partner_id: AS2 identifier of the AS2 Partner to which you want to send the AS2 message out

Query Parameters (Optional)

  • partnerType: Possible values: ​production​ and ​test​. If unspecified, defaults to ​production.

  • subject: Any subject string can be used

Request Payload (multipart/form-data)

A multipart payload containing one or more "file" parts (attachment payloads to be sent). Each attachment must have a unique filename.

Response

202 Accepted
Content-Type: application/json
Link: https://api.as2gateway.com/v1/message/sent/​<90766548.41.1573209810390@as2gateway.com>

{
    "message": "Successfully added a new outbound entry"
}

Response Headers

Link​: An absolute URL to the AS2 message which will be created after the outgoing message entry is processed. Therefore the resource in this URL may not be available immediately after the response for this API call is returned. It would be better to wait around 5 to 10 seconds before querying for the resource represented in the ​Link​ header value.

Note that the header includes the AS2 message ID for this outgoing message entry.

A sample request would be as follows:

curl -XPOST https://api.as2gateway.com/v1/message/RJ_Station/RJ_Partner \
    -H "Authorization: <token_string>" \
    -H "Content-Type: multipart/form-data; boundary=----foobarbaz" \
    --data-binary \
'------foobarbaz
Content-Disposition: form-data; name="file"; filename="file1.txt"
Content-Type: text/plain

one
------foobarbaz
Content-Disposition: form-data; name="file"; filename="file2.txt"
Content-Type: text/plain

two
------foobarbaz--'

Queueing (asynchronous) nature

Please note that, similar to the ​AS2 Gateway web dashboard​, this simply places the newly submitted message into a queue, in a to-be-sent state; it may take several seconds before the message actually gets sent out.

Additionally, if the actual send action fails, the message will not appear under the sent messages category; and the URL previously returned in the ​Link​ header would no longer be valid. In such cases it is advised to check failed and queued categories to find out the current status of the message.

In this topic
In this topic