using the rest API how do I remove a line item on ...
# ask-stanley-ai
m
using the rest API how do I remove a line item on a sales order.
c
AI generated answer (using internal Slack threads):
To remove a line item from a Sales Order using the REST API, you would need to perform a PATCH request on the Sales Order record. The line item to be removed should be included in the request body with the
_operation
property set to
remove
. Here is a sample JSON body for the PATCH request:
Copy code
json
{
  "line": [
    {
      "_operation": "remove",
      "line": 1
    }
  ]
}
In this example, the line item at index 1 will be removed from the Sales Order. Please note that the line index starts from 0. However, please be aware that you cannot remove a line item from a Sales Order if there are any related records, such as Item Fulfillments or Invoices. Those related records would need to be modified or removed first. ****** 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.839267492
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830726564
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830202341
Please provide your feedback on this answer.