Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netsuite Rest API returns "No Content" status (204) when completed successfully

i use the requests library. how can this be the default behavior? any way to return the ID of the item created?

def create_sales_order():
    url = f"https://{url_account}.suitetalk.api.netsuite.com/services/rest/record/v1/salesOrder"

    data = {
        "entity": {
            "id": "000"
        },
        "item": {
            "items": [
                {
                    "item": {
                        "id": 25
                    },
                    "quantity": 3,
                    "amount": 120
                }
            ]
        },
        "memo": "give me money",
        "Department": "109"
    }

    body = json.dumps(data)

    response = client.post(url=url, headers=headers, data=body)
    print(response.text)
like image 356
Benny Avatar asked Jan 30 '26 17:01

Benny


1 Answers

Ok so it turns out that the header returned in the 204 empty response contains a link to the created item (Location is the key name in the json returned) , which is sufficient to do another get request and have all the info returned.

like image 163
Benny Avatar answered Feb 01 '26 07:02

Benny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!