how should I format the body of a REST request to ...
# ask-stanley-ai
l
how should I format the body of a REST request to create a sales orders with line items that are ServiceResale items? I have the following: "entity": {"externalId": "143"}, "item": {"items": [{"item": {"id": 131}, "rate": 2.0, "quantity": 166.0, "itemSubtype": "Resale"}, {"item": {"id": 132}, "rate": 8.0, "quantity": 191.0, "itemSubtype": "Resale"}]}, "tranDate": "2024-1-01"} but I get a 400 error with this detail: 'Error while accessing a resource. Ha ingresado un valor de campo no válido 131 para el siguiente campo: item.', 'o:errorPath': 'item.items[0]'
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you're encountering an error due to an invalid value for the 'item' field in your request body. The error message suggests that the value '131' is not valid for the 'item' field. The format of your request body seems correct, but the values you're using might not be valid in your NetSuite account. The 'item' field usually expects an internal ID of an item record in NetSuite. Here's a sample format of a request body to create a sales order with line items:
Copy code
json
{
    "entity": {
        "id": "143"
    },
    "item": {
        "items": [
            {
                "item": {
                    "id": "131"
                },
                "quantity": 166.0,
                "rate": 2.0
            },
            {
                "item": {
                    "id": "132"
                },
                "quantity": 191.0,
                "rate": 8.0
            }
        ]
    },
    "tranDate": "2024-01-01"
}
In this example, '131' and '132' should be the internal IDs of the items you want to add to the sales order. You need to make sure these IDs are valid in your NetSuite account. If you're still encountering issues, you might want to check the metadata of the 'salesOrder' record in the REST API Browser or the SuiteTalk Schema Browser to make sure you're using the correct field names and data types. Also, please note that there are some limitations when using REST Web Services in NetSuite. For example, if SuiteTax is not enabled, you might not be able to use REST web services to add items. ****** 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.866517305
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851604164
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84988
Please provide your feedback on this answer.
l
The id does exist (I double checked) Could there be an issue with permissions?