Skip to content
Advertisement

creating an invoice using OAuth2 in xero

I am following along with the code samples provided here – https://github.com/XeroAPI/xero-php-oauth2/blob/master/docs/Api/AccountingApi.md#createInvoice

However, i am always receiving the following error message:

“ErrorNumber”: 17,

“Type”: “NoDataProcessedException”,

“Message”: “No data has been processed for this endpoint. This endpoint is expecting Invoice data to be specifed in the request body.”

Any ideas why this is the case.

I have added quotes around the $invoice data

Code below:

JavaScript

Advertisement

Answer

If you take a look at the example again you’ll find that you’re building up your $invoice variable incorrectly and so when the SDK sends through the $invoice variable to the API it’s doing its serialization incorrectly leaving the request body unusable by the API.

In your code you’re building the $invoice variable as a string whereas the example is building the variable as an object. If you try build your variable in the same way, it should work.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement