It's possible to register a webhook or callback so that you can be notified when an ASN has been booked (Webhook will only send when ASN has been fully booked in and not partially booked).
This saves the need to poll the API for updates.
To do this after creating an ASN you will need to add a Connect action. This can be done using the ASN/ConnectionActions PUT method
https://api.mintsoft.co.uk/swagger/ui/index#!/ASN/ASN_UploadConnectAction
e.g use the ASN ID returned from CreateASN
/api/ASN/20285/ConnectActions - PUT
{ "Type": "API", "SourceASNId": "PO-12453", "Complete": false, "ExtraCode1": "https://api.yoursystem.com/callback/ASNBookedIn",
"ExtraCode2": "", // Future Use
"ExtraCode3": "", // Future Use
"ExtraCode4": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" // Auth Header Option - See Below }
SourceASNId- The ASN ID in the system that the ASNcame from
ExtraCode1 - The URL to call when the ASN has been booked in
ExtraCode2 - Future Use
ExtraCode3 - Future Use
ExtraCode4 - Auth Header Option - See below
You will then get a POST request back to the specified address upon despatch with the same ASN Json found on this call:
https://api.mintsoft.co.uk/swagger/ui/index#!/ASN/ASN_GetASN
Additional Security Options:
When making the webhook calls you could provide an API key in the url to verify where its come from.
e.g
https://api.yoursystem.com/callback/ASNBookIN?APIKEY=fe14830f-0980-46c6-a540-04c20a26b01c
Alternatively we can provide a dedicated value in the Authorization header.
This will be taken from ExtraCode4
So if the Webhook handler was secured by Basic Auth you could supply that value in the ExtraCode4 to be used in the Authorization header.
username password
becomes then username:password
Base64 encoded = dXNlcm5hbWU6cGFzc3dvcmQ=
e.g.
{
"ExtraCode4": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
}
Comments
0 comments
Article is closed for comments.