When attempting to update an itemreceipt via REST ...
# ask-stanley-ai
g
When attempting to update an itemreceipt via REST i keep getting the following response:
Copy code
{
  "type": "<https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1>",
  "title": "Bad Request",
  "status": 400,
  "o:errorDetails": [
    {
      "detail": "Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
      "o:errorPath": "item",
      "o:errorCode": "USER_ERROR"
    }
  ]
}
My Payload is:
Copy code
{
  "item": {
    "items": [
      {
        "orderLine": 1,
        "location": 3
      },
      {
        "orderLine": 2,
        "location": 3
      }
    ]
  }
}
doing PATCH /itemReceipt/{receiptID}
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like the issue you're encountering is related to the way you're referencing the line items in your payload. In the context of transforming a purchase order to an item receipt via the REST API, you should use the
orderLine
field to reference the line items, not the
line
field. The
orderLine
field corresponds to the line number on the original purchase order. It's important to note that the line numbers start from 1, not 0. Here's an example of how your payload should look like:
Copy code
json
{
    "item":{
       "items":[
          {
            "orderLine": 1,
            "itemreceive": true,
            "location": 6
          },
          {
            "orderLine": 2,
            "itemreceive": true,
            "location": 6
          }
       ]
    },
    "shipStatus": {
        "id": "C"
    }
}
In this example,
orderLine
is used to reference the line items on the purchase order,
itemreceive
is set to
true
to indicate that the items are being received, and
location
is set to the internal ID of the location where the items are being received. Please ensure that the
orderLine
values match the line numbers on the original purchase order. If you're still encountering issues, it might be worth checking if the line items on the purchase order are marked as receivable and if the purchase order exists. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.897579551
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.888308585
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.884887874
Please provide your feedback on this answer.