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!
Rookie Asked on November 10, 2020 in SuiteTalk.
Add Comment
1 Answer(s)
Best answer

A solid strategy is to do a get on an existing invoice, then strip away all the fields you dont want to set and use that as a template to create your invoice.

A more metadata based approach is to use something like https://editor.swagger.io/ to see what an example request could look like by inputting the invoice metadata.

Intermediate Answered on November 10, 2020.

Thanks battk! using the swagger editor with the metadata from the table was definitely the way to go. It gives sample payloads for each endpoint.

on November 11, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor