Here is my json if anybody wants to take a look:
# integrations
a
Here is my json if anybody wants to take a look:
b
i have limited rest experience, but im guessing the item should be more like the entity
Copy code
{
  "id": "22799"
}
id also expect the createdDate to be ignored
or maybe cause an error, so dont include it
a
I started with {"id":"22799"} no dice there either, and teh createdDate isn't causing an error, I was just trying to get the datetime format figured out for future needs.
b
what error are you getting?
a
When I do it this way I get this:
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",     "title": "Invalid reference item in request body.",     "status": 400,     "o:errorCode": "INVALID_ID"
Copy code
{
  "item": {
    "id": "22799",
    "refName": "10-ML5"
  },
  "quantity": 1,
  "rate": 50
}
b
have you done the standard try creating the sales order in the ui?
a
When formatted like that I get Error while accessing resource: You have entered an Invalid Field Value 22799 for the following field: item
b
to make sure that the item with internal id "22799" is a valid choice for the customer with internal id "71200"
a
I haven't, I was just looking at an item in the UI and pulling in the values from there.
I'll give that a shot in the morning.
Thanks again!
m
Another thing to try is retrieve an existing record via rest API and see how the item sublist is formatted there.
b
should work great after you make it in the ui first
a
I tried that, but it's hard to follow the path with the links.
Is there a way to pull an existing record with out referencing the links?
b
Copy code
The REST web services beta version does not automatically expand sublists and subrecords. You can use the expandSubResources query parameter to expand sublists and subrecords. If the query parameter is not used, the response contains only the body fields of the record, and the sublists and subrecords are represented by links. See the example in Getting a Record Instance.
a
I thought I tried the expandSubResources, but will attempt again tomorrow.
Thanks for the link!
and the advice!!
b
taking a look at your item structure
you have one item to many
Copy code
{
  "entity": {
    "id": "71200"
  },
  "otherRefNum": "CS214607974",
  "shippingaddress": {
    "addr1": "CustomerA",
    "addr2": "Somewhere Ave",
    "city": "Pittsburgh",
    "state": "PA",
    "addrPhone": "1234561111"
  },
  "item": {
    "items": [
      {
        "quantity": 1,
        "rate": 50,
        "item": {
          "id": "22799"
        }
      }
    ]
  }
}
a
@battk Tried your json body and it still is giving me the invalid value. I created an order in the UI, selected an appropriate Item GET'd it (haha) from the API and am using those same values, still no luck.