Creation of a Purchase Receipt with Allocations

If you are using the contract-based REST API to integrate MYOB Acumatica with external systems, these external systems can create a purchase receipt with allocations in MYOB Acumatica in a single API call. For details about the creation of purchase receipts, see Purchases for Sale: General Information.

Testing of the Requests

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:
  1. Deploy a new MYOB Acumatica instance with the U100 dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance.
  2. To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the HEADOFFICE branch.
  3. 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.
  4. On the Enable/Disable Features (CS100000) form, make sure that the Inventory and Order Management, Lot and Serial Tracking, and Advanced SO Invoices features are enabled.
Tip: In the request examples below, <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.

Step 1: Create a Purchase Order

You use the following code to create a purchase order and open it.

PUT / HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/PurchaseOrder
Accept: application/json
Content-Type: application/json

{
    "VendorID": { "value": "GLORYFRUIT" },
    "Type": { "value": "Normal" },
    "Date": { "value": "2018-01-30" },
    "Description": { "value": "Purchase of apples, 20 lb" },
    "Details": [
        {
            "Branch": { "value": "HEADOFFICE" },
            "InventoryID": { "value": "APPLES" },
            "WarehouseID": { "value": "WHOLESALE" },
            "OrderQty": { "value": 20 },
            "UnitCost": { "value": 9.95 }
        }
    ],
    "Hold": { "value": false }
}

Step 2: Create a Purchase Receipt with Allocations

Next, you create a purchase receipt with allocations for the order as follows.

PUT ?$expand=Details,Details/Allocations HTTP/1.1
Host: [<Acumatica ERP instance URL>]/entity/Default/23.200.001/PurchaseReceipt
Accept: application/json
Content-Type: application/json

{
    "Type": { "value": "Receipt" },
    "VendorID": { "value": "GLORYFRUIT" },
    "Details": [
        {
            "InventoryID": { "value": "APPLES" },
            "LotSerialNbr": { "value": "" },
            "Warehouse": { "value": "WHOLESALE" },
            "Allocations": [
                {
                    "ExpirationDate": { "value": "2021-05-29T00:00:00+03:00" },
                    "Qty": { "value": 10 },
                    "LotSerialNbr": { "value": "FRT000862" }
                },
                {
                    "ExpirationDate": { "value": "2021-05-29T00:00:00+03:00" },
                    "Qty": { "value": 10 },
                    "LotSerialNbr": { "value": "FRT000877" }
                }
            ]
        }
    ]
}