Create a sales order
Creating sales orders through the Spire API is one of the most common and most powerful use cases for the Spire API. Leveraging the Sales Order API interface, Spire users can share data between Spire and their own applications as well as integrate Spire with a myriad of front end order processing systems or eCommerce website in order streamline, integrate and/or automate business processes.
To create a sales order all that is required is to send a POST request to the sales order collection endpoint, with a JSON Sales Order object with values appropriate for the sales order that is going to be created.
The below image shows an example of this done in Postman. Don’t forget to also pass a set of credentials (Postman – Located in the Authorization tab)
{ "customer": { "customerNo": "ACTTEC" }, "orderDate": "2021-12-02", "items": [ { "whse": "VA", "partNo": "SP4CHIN", "orderQty": "3", "retailPrice": "1095.10" }, { "whse": "VA", "partNo": "ACMFITSB", "orderQty": "2" } ] }
The server response is 201 Created which means that Spire has accepted our Sales order and that a new order was created.
Examining the Headers tab in the lower section reveals the response headers that Spire has responded with. Included in the response header is a value provided for Location which contains the endpoint for the newly created Sales Order.
Note that the last section if the URL in the Location field has a number which is the id of the newly created sales order, in this case its 1455. This id value can be used to map the newly created sales order by its id between Spire and the unique identifier in any external system.
If the Sales Order is going to be updated further via the API, then its id will need to be provided in any subsequent API calls.