Get/Query Request Samples
The GET request samples follow the same structure in they accept the request, query a target sage database, transform the data, and then write the JSON response back to the client.
Making the Request
Url
To allow the request to be parameterised, the url accepts two parameters: location and startDate. These parameters will be used to query the the corresponding ERP resource.
- Sage200
- http://localhost/IManWebAPI/sage200orders/{location}?startDate={startDate}
- Location - This should be replaced with the Sage200 warehouse name.
- startDate - The starting DocumentDate to query the orders in the form of yyyy-MM-dd
- Sample - http://localhost/IManWebAPI/sage200orders/NEWCASTLE?startDate=2022-01-01
- Sage300
- http://localhost/IManWebAPI/sage300orders/{location}?startDate={startDate}
- Location - This should be replaced with the Sage300 Location Id.
- startDate - The starting Order Date to query the orders in the form of yyyy-MM-dd
- Sample - http://localhost/IManWebAPI/sage300orders/1?startDate=2022-01-01
- SageX3
- http://localhost/IManWebAPI/sagex3orders/{location}?startDate={startDate}
- Location - This should be replaced with the SageX3 Shipping Site Id.
- startDate - The starting Order Date to query the orders in the form of yyyy-MM-dd
- Sample - http://localhost/IManWebAPI/sagex3orders/FR003?startDate=2022-01-01
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.
Integration Design
WebAPI Reader
The WebAPI reader accepts the request and parses the request into individual fields which can be used in subsequent transforms (in this case the Database Reader).
To limit/restrict the orders being queried the request URL has both a path and query string parameter.
Parameters
The location and startDate parameters from the request are captured as fields.
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.
Map Transform
It is important to validate the data from the client to ensure it conforms to expectations.
The best way to validate data is through the Check function as it allows you to return an error code which can be converted to a valid http status code.
The samples each perform a simple check against the startDate parameter to ensure it is valid. Another validation could also be performed on the location parameter.
Database Reader
The database reader gets the orders from the database.
The key is the parameterisation is the where clause using both the query parameters and the User Property.
Hierarchy & Map
The hierarchy transform takes the flat dataset into a header/detail relationship.
The map transform applies some light transformation to the values.
JSON Writer
The target is set to WebAPI to route the output 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.