RE: Create Invoice with REST API

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
}
Thanks!
devmatt Rookie Asked on November 10, 2020 in SuiteTalk.
Add Comment
2 Answers

Hello, you can use this structure. It’s work well!

{
“account”: {
“id”: “xxx”,
“refName”: “xxx Accounts Receivables : Accounts Receivable”
},
“item”: {
“items”: [
{
“item”: {
“id”: “xxxx”,
“type”: “noninventorysaleitem”
},
“amount”: 2.0,
“quantity”: 2.0
}
]
},
“currency”: {
“id”: “1”,
“refName”: “Australian Dollar”
},
“customForm”: {
“id”: “xxx”,
“refName”: “KxxxxV ANZ xxx STD – Invoice”
},
“email”: “xxx@xxx.com”,
“entity”: {
“id”: “xxx”,
“refName”: “xxxx Test x xxname”
},
“exchangeRate”: 1.0,
“excludeFromGLNumbering”: false,
“location”: {
“id”: “41”,
“refName”: “AUS : ACT : xxxxx ACT”
},
“postingPeriod”: {
“id”: “121”,
“refName”: “Aug 2021”
},
“subsidiary”: {
“id”: “19”,
“refName”: “x xxx Pty Limited”
},
“subtotal”: 2.0,
“terms”: {
“id”: “13”,
“refName”: “14 Days EOM”
},
“toBeEmailed”: true,
“tranDate”: “2021-08-11”
}

Rookie Answered on August 11, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.