Acumatica Rest API to get sales order with line it

2019-08-02 19:44发布

问题:

I was doing a demo and could easily create and retrieve orders but was not able to get the expand parameter to work

For example

I created order SO003615 with:

URI http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder

{
  "OrderType": { value: "SO" },
  "CustomerID" : { value : "ACTIVESTAF" } ,
  "LocationID" : { value : "MAIN" },
  "Description" : { value : "Sample Order"},
   "Details" : 
   [
      {
        "InventoryID" : {value: "AACOMPUT01"},
        "Quantity" : {value: 2},
        "UOM" : {value: "EA"},
        "UnitPrice" : {value: 1000.99}
      },
      {
        "InventoryID" : {value: "AALEGO500"},
        "Quantity" : {value: 1}
      }
   ]
}

Then I tried to get order with

URI http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder/SO/SO003615?expand=Details

But the line items are not in the result. What am I missing?

{
  "id": "37c15980-f71d-4496-882d-6e05e4a50061",
  "rowNumber": 1,
  "note": "",
  "BillingAddressOverride": {
    "value": false
  },
  "BillingContactOverride": {
    "value": false
  },
  "CreditHold": {
    "value": false
  },
  "Currency": {
    "value": "USD"
  },
  "CustomerID": {
    "value": "ACTIVESTAF"
  },
  "CustomerOrder": {},
  "Date": {
    "value": "2017-03-16T00:00:00-04:00"
  },
  "Description": {
    "value": "Sample Order 6"
  },
  "DestinationWarehouseID": {},
  "ExternalReference": {},
  "Hold": {
    "value": false
  },
  "IsTaxValid": {
    "value": false
  },
  "LastModified": {
    "value": "2017-03-17T01:05:56.74-04:00"
  },
  "LocationID": {
    "value": "MAIN"
  },
  "NewCard": {
    "value": false
  },
  "OrderedQty": {
    "value": 3
  },
  "OrderNbr": {
    "value": "SO003615"
  },
  "OrderTotal": {
    "value": 2101.98
  },
  "OrderType": {
    "value": "SO"
  },
  "PaymentCardIdentifier": {},
  "PaymentMethod": {
    "value": "CHECK"
  },
  "PaymentRef": {},
  "PreferredWarehouseID": {},
  "Project": {
    "value": "X"
  },
  "RequestedOn": {
    "value": "2017-03-16T00:00:00-04:00"
  },
  "ShippingAddressOverride": {
    "value": false
  },
  "ShippingContactOverride": {
    "value": false
  },
  "ShipVia": {},
  "Status": {
    "value": "Open"
  },
  "TaxTotal": {
    "value": 0
  },
  "custom": {},
  "files": []
}

回答1:

It is $expand, not expand. Try using the following http://localhost/Acumatica6/entity/Default/6.00.001/SalesOrder/SO/003615?$expand=Details