Retrieve a Sales Order with Detail Lines
If you are using the REST API to integrate MYOB Acumatica with an external system, this external system can retrieve a sales order by the values of specific fields of the sales order. For example, before submitting a sales order for processing, a customer of the online store can select the needed order by using this customer number.
The customer order number of a sales order is entered in the Summary area of the Sales Orders (SO301000) form.
Testing of the Request
Before you test the code below, you need to do the following to configure your client application and the MYOB Acumatica instance to be used:
- Deploy a new MYOB Acumatica instance with the T100 dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance in the Installation Guide.
- If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection (which is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub), make sure the collection variables have the proper values.
- To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the MYSTORE branch.
Request
<MYOB Acumatica instance URL>
is the URL of the MYOB Acumatica
instance (such as https://my.acumatica.com/MyInstance
). You can omit
the instance name in the URL (such as https://my.acumatica.com
) if the
instance is installed in the root of the website.You can use the following example of HTTP request to retrieve the sales order whose customer order code is SO248-563-06 along with its detail lines through the contract-based REST API.
GET ?$expand=Details&$select=OrderNbr,OrderType,Details/InventoryID,Details/WarehouseID
&$filter=OrderType eq 'SO' and CustomerOrder eq 'SO248-563-06' HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json
The following code shows an example of the response.
[
{
"id": "7313e950-7381-e511-80c0-00155d012302",
"rowNumber": 1,
"note": { "value": "" },
"CustomerOrder": { "value": "SO248-563-06" },
"Details": [
{
"id": "08731a64-7381-e511-80c0-00155d012302",
"rowNumber": 1,
"note": { "value": "" },
"InventoryID": { "value": "CONGRILL" },
"WarehouseID": { "value": "MAIN" },
"custom": {},
"_links": {
"files:put": "/<MYOB Acumatica instance name>/entity/..."
}
},
{
"id": "f4a7e172-7381-e511-80c0-00155d012302",
"rowNumber": 2,
"note": { "value": "" },
"InventoryID": { "value": "AALEGO500" },
"WarehouseID": { "value": "MAIN" },
"custom": {},
"_links": {
"files:put": "/<MYOB Acumatica instance name>/entity/..."
}
},
{
"id": "091b0d7f-7381-e511-80c0-00155d012302",
"rowNumber": 3,
"note": { "value": "" },
"InventoryID": { "value": "CONTABLE1" },
"WarehouseID": { "value": "MAIN" },
"custom": {},
"_links": {
"files:put": "/<MYOB Acumatica instance name>/entity/..."
}
}
],
"OrderNbr": { "value": "000003" },
"OrderType": { "value": "SO" },
"custom": {},
"_links": {
"self": "/<MYOB Acumatica instance name>/entity/...",
"files:put": "/<MYOB Acumatica instance name>/entity/..."
}
}
]