Unable to create an invoice - "Required parameter missing: invoice"


#1

Hi all,

I have set things up so that I can call the endpoints to get access to invoice data, contacts, etc but the invoice endpoint response is producing an error.

I am getting the following error in the response when trying to create an invoice:

{
“errors”: {
“error”: {
“message”: “Required parameter missing: invoice”
}
}
}

I am using the following in the request body:

{ “invoice”:
{
“contact”: “https://api.freeagent.com/v2/contacts/7797529”,
“dated_on”: “2019-03-01”,
“payment_terms_in_days”: “0”,
“invoice_items”:[
{
“description”:“Some kind-- of --refere–nce”,
“item_type”:“Services”,
“price”:“9999.0”
}
]
}
}

The linter says that the format is correct and obviously the access token is correct otherwise I wouldn’t be able to connect with the other endpoints.

Reading the API documentation is seems that I am providing all the necessary requirements elements.

As a side note, although I am connecting with the main account removing the word ‘sandbox’ the call back used is still the OAuth google playground.


#2

Hi Dean,

Could you check what headers you are sending to the API? Since the API can work with either XML or JSON, it needs to know the content type of the request body.

There should be a Content-Type: application/json header passed along with the request. Let me know if you are still getting the error after adding it.

Kind regards,
Ioan


#3

:roll_eyes: yep, stupidly, that’s what it was. Thank you!