Post/Create Resource Samples
The POST samples each demonstrate how to create an integration to accept and process such as an order into an ERP (Sage200, Sage300 or SageX3).
Making the Request
Url
- Sage200
- Method - POST
- http://localhost/IManWebAPI/sage200order
- Sage300
- Method - POST
- http://localhost/IManWebAPI/sage300order
- SageX3
- Method - POST
- http://localhost/IManWebAPI/sagex3order
Authorisation
Each endpoint has authorisation enabled.
Set the request authorisation to Basic Auth and set the Username and Password to the values per the user setup.
Web User Setup
Headers
To make a successful request you need to set two request headers.
X-User-Token
Set this to User Token value from the User setup.
Each user has its own user token, so the value set in the header needs to correspond.
Debug
Set to True - This denotes the request will be routed to the Designer.
Set to False - To run the request in full.
Body
The body will contain the order we are sending the API.
Sage200
{ "orderNumber": "PO16262773", "lineItems": [ { "lineId": 23894, "sku": "ACS/BLENDER", "qty": 2, "description" : "Two Blenders for the Kitchen" }, { "lineId": 4759, "sku": "ACS/ESPRESSO", "qty": 1, "description" : "Woohoo! Coffee!" }] }
Sage300
{ "orderNumber": "PO16262773", "lineItems": [ { "lineId": 23894, "sku": "A1-103/0", "qty": 2, "description" : "A desk lamp" }, { "lineId": 4759, "sku": "A1-401/0", "qty": 1, "description" : "Some Bulbs" }, { "lineId": 82929, "sku": "A1-105/0", "qty": 1, "description" : "A Notepad" }] }
SageX3
{ "orderNumber": "PO16262773", "lineItems": [ { "lineId": 23894, "sku": "DIS007", "qty": 2, "description" : "A desk lamp" }, { "lineId": 4759, "sku": "DIS008", "qty": 1, "description" : "Some Bulbs" }] }
Integration Design
WebAPI Reader
The WebAPI reader accepts the request and parses the request into individual fields which can be used in subsequent transforms (used in both the JSON Reader and the corresponding Sage connector).
User Property
The web user associated with the request will have the user properties merged with the other request data.
Specifically the User property in the sample maps the web user to the Sage customer. In turn this will be used in the Connector mapping to create the order.
Map Transform
The Map transform is empty in the examples. However, prior to reading the data you have the ability validate, transform the data from the incoming request.
JSON Reader
The JSON Reader is used to parse the request's body into the various fields.
The JSON Reader's Source is set to Transaction and the field is set to Http.Content.
The JSON Reader is confgured normally by adding the fields and transactions manually.
Reads the data posted by the request.
Map Transform
The second Map transform adds any field level transformations.
Sage Connector
The Sage connector is setup exactly the same as any other connector.
JSON Writer
A JSON Writer is used to write the response back to the client. The response will contain part of the original order.
The target is sent to WebAPI which allows the output to be routed from the writer back to the client.
Output
The request will respond with the orders.
To generate/regenerate the output, use the steps described in Sending the Response in the integration setup.