Hi All, I've been trying to get my head around an ...
# ask-stanley-ai
g
Hi All, I've been trying to get my head around an issue with the netsuite REST api for a few days now, i'm trying to create a return authorization that links to a sales order, it creates fine via the UI, i can create one no problem but it simply will not link back to the sales order. My payload is:
Copy code
{
  "entity": {
    "id": "116"
  },
  "trandate": "02/17/2025",
  "memo": "Shopify Refund for Order #2395",
  "item": {
    "items": [
      {
        "item": {
          "id": "14607",
          "rate": 1
        },
        "quantity": 1
      }
    ]
  }
}
but this always returns the error:
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. Please choose an item to add.",
      "o:errorPath": "item.items[0]",
      "o:errorCode": "USER_ERROR"
    }
  ]
}
I am attempting to do a POST to
<https://6370999-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/11885144/!transform/returnAuthorization>
Can anyone shed any light on this? Googl'ing doesn't really seem to give any insight, i've tried adding a line number but it returns the same error.
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you are facing an issue with the NetSuite REST API while trying to create a return authorization that links back to a sales order. The error message you are receiving indicates that there is an issue with the item you are trying to add. One of the users in the conversation mentioned that they faced a similar issue and resolved it by adding
&replace=item
to overwrite the item sublist. This might be something you could try. Another user suggested using the
initialize
operation for setting up the record and then performing an
add
operation. This is a common approach when trying to link a return authorization with a sales order. Lastly, another user mentioned the use of
Keyed Sublists
to match your items when setting the
createdFrom
element. This could be another approach you could consider. Here is a sample payload based on the conversations:
Copy code
json
{
  "externalId": "RMA-US_NO.7000948208",
  "location": 24,
  "item": {
    "items": [
      {
        "orderLine": 2,
        "item": {
          "externalId": "KSD-239558"
        },
        "quantity": 1,
        "amount": 3.99,
        "rate": 3.99
      }
    ]
  }
}
Please replace the
externalId
,
location
,
orderLine
,
item.externalId
,
quantity
,
amount
, and
rate
with your actual values. ****** 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.894639909
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.893825114
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854869366
Please provide your feedback on this answer.
g
Tell me more about the 'add' operation, how does this work?
c
Thank you for your feedback
Thank you for your feedback
Thank you for your feedback