Can't create invoice. Getting 500 Internal Server Error

I’m trying to create an invoice but I get the following response from my
cURL request.

500 Internal Server Error

If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.

API endpoint: /invoices.

I’m using PHP & cURL. I’m POSTing a JSON string with the following headers:

'Authorization: Bearer '.$this->accessToken,
‘Accept: application/json’,
‘Content-Type: application/json’,

Sending the JSON using CURLOPT_POSTFIELDS.

This is my JSON:

{
“invoice”: {
“contact”: “https://api.freeagent.com/v2/contacts/2437146”, // also
tried just the ID
“dated_on”: “2014-02-26 10:14:22”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“item_type”: “Services”,
“price”: 35,
“description”: “Manicure”,
“category”: “Nails”
}
]
}
}

I got the JSON format from this
post: https://groups.google.com/forum/#!topic/freeagent_api/4pQ4Nlfod3A

Hi Billy,

The “category” field is likely the problem here: this should be a sales
category already defined in your FreeAgent account, and should be
referenced here by its nominal code. You can read more about categories
here:

https://dev.freeagent.com/docs/categories

Hope this helps,

-JOn Wednesday, 26 February 2014 10:32:44 UTC, Billy Jones wrote:

I’m trying to create an invoice but I get the following response from my
cURL request.

500 Internal Server Error

If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.

API endpoint: /invoices.

I’m using PHP & cURL. I’m POSTing a JSON string with the following headers:

'Authorization: Bearer '.$this->accessToken,
‘Accept: application/json’,
‘Content-Type: application/json’,

Sending the JSON using CURLOPT_POSTFIELDS.

This is my JSON:

{
“invoice”: {
“contact”: “https://api.freeagent.com/v2/contacts/2437146”, //
also tried just the ID
“dated_on”: “2014-02-26 10:14:22”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“item_type”: “Services”,
“price”: 35,
“description”: “Manicure”,
“category”: “Nails”
}
]
}
}

I got the JSON format from this post:
https://groups.google.com/forum/#!topic/freeagent_api/4pQ4Nlfod3A

That’s the problem. Thanks Jonathan!On Wednesday, 26 February 2014 10:32:44 UTC, Billy Jones wrote:

I’m trying to create an invoice but I get the following response from my
cURL request.

500 Internal Server Error

If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.

API endpoint: /invoices.

I’m using PHP & cURL. I’m POSTing a JSON string with the following headers:

'Authorization: Bearer '.$this->accessToken,
‘Accept: application/json’,
‘Content-Type: application/json’,

Sending the JSON using CURLOPT_POSTFIELDS.

This is my JSON:

{
“invoice”: {
“contact”: “https://api.freeagent.com/v2/contacts/2437146”, //
also tried just the ID
“dated_on”: “2014-02-26 10:14:22”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“item_type”: “Services”,
“price”: 35,
“description”: “Manicure”,
“category”: “Nails”
}
]
}
}

I got the JSON format from this post:
https://groups.google.com/forum/#!topic/freeagent_api/4pQ4Nlfod3A