RE: Create Invoice with REST API
Answered
Hi all,
Has anyone successfully created an invoice using the REST API? The documentation is pretty sparse on payload examples and the closest approximation in the postman collection is Create Sales Order. Using the schema of the postman Create Sales Order as a starting point for invoices isn’t working, I’m just getting a 400 “Invalid content in the request body.” error.
My current test payload (with id’s redacted) is:
{
“account”: [
{ “id”: <accountID> }
],
“currency”: [
{ “id”: <currencyID> }
],
“entity”: [
{ “id”: <entityID> }
],
“item”: {
“items”: [
{
“item”: { “id”: <itemID> },
“rate”: 10,
“quantity”: 1
}
]
},
“salesRep”: [
{ “id”: <salesRepID> }
],
“subsidiary”: [
{ “id”: <subsidiaryID> }
],
“terms”: [
{ “id”: <termID> }
],
“billaddressee”: “John Doe”,
“billAddr1”: “123 Test Street”,
“billCity”: “London”,
“billZip”: “ab1 3cd”,
“billCountry”: “GB”,
“amountpaid “: 10,
“subtotal”: 8,
“taxRate”: 2,
“total”: 10
}
REST API browser docs for invoice: https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2020.2/index.html#tag-invoice
Thanks!
{
“type”: “https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1”,
“title”: “Internal Server Error”,
“status”: 500,
“o:errorDetails”: [
{
“detail”: “An unexpected error occurred. Error ID: l7gfaanu1h3cqhvp1whb5”,
“o:errorCode”: “UNEXPECTED_ERROR”
}
]
}