POST Request for Create an Invoice - Required parameter missing: invoice

Hi,

I’m trying to create an Invoice, but I’m currently getting a response of “Required parameter missing: invoice”.

I have checked back to the required content to be posted and I cannot see what the error response is referring to? The below is the JSON that is being sent through (including the required fields per the API doc):

[{“invoice”:{“due_on”:“2020-11-05T00:00:00.000Z”,“contact”:“https://api.freeagent.com/v2/contacts/10357723",“currency”:“GBP”,“dated_on”:“2020-10-21T23:00:00.000Z”,“reference”:null,“invoice_items”:[{“price”:50,“quantity”:5,“description”:"testing this one out”}],“payment_terms_in_days”:0}}]

Any advice would be greatly appreciated.

Thanks,

Hi Tom,

Thanks for your message. Looking at your request body, the first thing that strikes me is that your payload is wrapped in an array (using square brackets), rather than being a single object. I believe removing the square brackets from the start and end of the payload should resolve the problem – though do feel free to let me know if it doesn’t and you’re still stuck.

Best wishes,

Ewa

Hi Ewa,

Thanks for the rapid response, it is much appreciated!

After restructuring the payload following your advice above, I’ve now managed to post an invoice.

Many Thanks!

1 Like

No problem at all, glad to hear I was able to help! :smiley: