POST requests started failing recently

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

Could something have changed in the API which would explain this?

Thanks Graeme,

That seems to have fixed it for us - appreciate the fast responses and good
work on tightening up the JSON validation.On Tuesday, February 5, 2013 11:44:33 AM UTC+1, Graeme Boyd wrote:

Hi Chris,

The example you give is not valid JSON and doesn’t use a valid categories
URL. If you change it to the following it will work:

{
“estimate”: {
“contact”: “https://api.freeagent.com/v2/contacts/1188344”,
“dated_on”: “2013-2-04T00:00:00+00:00”,
“currency”: “USD”,
“exchange_rate”: “1.0”,
“estimate_type”: “Quote”,
“status”: “Draft”,
“notes”: “Here are some notes”,
“estimate_items”: [
{
“item_type”: “Products”,
“description”: “My App”,
“price”: “100”,
“quantity”: “1”,
“category”: “https://api.freeagent.com/v2/categories/009
}
]
}
}

The API should be returning a 400 and an “Invalid JSON” error message here
and we’ll fix that up soon. Thanks for drawing it to our attention.

In light of the recent Rails security issues our API now will only accept
valid JSON whereas it was a bit more forgiving about what it accepted in
the past. If your code was sending valid JSON you would not have noticed
any difference. If you want to check the validity of your JSON you can use
http://jsonlint.com.

Kind regards,

Graeme

On 5 February 2013 10:27, Jonathan Barrett <jona...@freeagent.com<javascript:> wrote:

Hi guys,

Thanks for reporting this. We’re looking into it right now for you. I’ll
report back here with our findings once we have them.

-J

On Tuesday, February 5, 2013 10:21:25 AM UTC, Curt Maybury (Design365) wrote:

I second this, we’re also experiencing the very same issue - initially
we revised our JSON data to match exactly the format in the development
docs, however this only worked for a few invoices before failing once more.

We desperately need to get these invoices out, has there been any update
on this?

Regards

Curt

On Monday, 4 February 2013 18:46:39 UTC, chrisb wrote:

Sure - here is an example I just tried:

REQUEST
POST https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimatesHTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: QVSource (gzip)
QVSource: true
Authorization: Bearer XXXXXXXXXXX
Accept: application/xml
Content-Type: application/json
Host: api.freeagent.com
Content-Length: 318
Expect: 100-continue

{ estimate:{contact: "https://api.freeagent.com/v2/**contacts/1188344https://api.freeagent.com/v2/contacts/1188344
“,dated_on:“2013-2-04T00:00:00+00:00",
currency:“USD”,exchange_rate:”**1.0”,estimate_type:
“Quote”,status:“Draft”,notes: “Here are some notes”,estimate_items:[{item_
**type: “Products”,description:“My App”,price:“100”,quantity:“1”,**category:“009”
}] }}

RESPONSE
HTTP/1.1 500 Internal Server Error
Server: nginx/1.0.14
Date: Mon, 04 Feb 2013 18:44:55 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 500 Internal Server Error
X-Runtime: 0.548472
X-Rev: 22bf745
X-Host: web3
Content-Length: 216

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.

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/**invoiceshttps://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to
have stopped working even though we haven’t changed anything in our code.
We have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_ap...@googlegroups.com <javascript:>.
To post to this group, send email to freeag...@googlegroups.com<javascript:>
.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774

Hi Curt,

We’re not aware of any issue with the Invoices resource other than if
invalid JSON is supplied a 500 error is thrown rather than a 400 error.
Can you check your requests with http://jsonlint.com and send us a failing
example?

Kind regards,

GraemeOn 5 February 2013 10:21, Curt Maybury (Design365) doofah@gmail.com wrote:

I second this, we’re also experiencing the very same issue - initially we
revised our JSON data to match exactly the format in the development docs,
however this only worked for a few invoices before failing once more.

We desperately need to get these invoices out, has there been any update
on this?

Regards

Curt

On Monday, 4 February 2013 18:46:39 UTC, chrisb wrote:

Sure - here is an example I just tried:

REQUEST
POST https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimatesHTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: QVSource (gzip)
QVSource: true
Authorization: Bearer XXXXXXXXXXX
Accept: application/xml
Content-Type: application/json
Host: api.freeagent.com
Content-Length: 318
Expect: 100-continue

{ estimate:{contact: “https://api.freeagent.com/v2/**contacts/1188344https://api.freeagent.com/v2/contacts/1188344
“,dated_on:”**2013-2-04T00:00:00+00:00”,*currency:“USD”,exchange_rate:"
*1.0",estimate_type: “Quote”,status:“Draft”,notes: “Here are some
notes”,estimate_items:[{item_**type: “Products”,description:“My
App”,price:“100”,quantity:“1”,**category:“009” }] }}

RESPONSE
HTTP/1.1 500 Internal Server Error
Server: nginx/1.0.14
Date: Mon, 04 Feb 2013 18:44:55 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 500 Internal Server Error
X-Runtime: 0.548472
X-Rev: 22bf745
X-Host: web3
Content-Length: 216

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.

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/**invoiceshttps://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774

OK, that’s what it was.

Thanks JonathanOn Friday, 28 June 2013 22:04:13 UTC+12, Jonathan Barrett wrote:

Hi Kevin,

Looking at the category you’re posting to here, the nominal code is for an
Admin Expenses category, but it needs to be for a sales category where
you’re creating an invoice.

Can you switch it for a sales nominal code, try again, and let me know if
you’re still seeing an error?

Cheers,

-J

On Friday, 28 June 2013 03:37:36 UTC+1, Kevin Williams wrote:

Graeme and Jonathan,

I’m getting the same error message when I post the following to try to
create an invoice…

{“invoice”: {“payment_terms_in_days”: 0, “contact”: "
https://api.freeagent.com/v2/contacts/1798739", “exchange_rate”: 1,
“reference”: “10395”, “dated_on”: “2007-06-13”, “due_on”: “2007-06-13”,
“invoice_items”: [{“quantity”: 1, “description”: “1/00001316 - ttt”,
“price”: 120, “category”: “https://api.freeagent.com/v2/categories/268”,
“sales_tax_rate”: 0}]}}

This passes http://jsonlint.com.

It didn’t start happening until I tried adding the category attribute and
removing again it seems to “fix” it.

Any update on this?

Thanks
-Kevin Williams

On Saturday, 9 February 2013 00:28:32 UTC+13, Jonathan Barrett wrote:

Hi Curt,

Can you try your request now and see if it’s still an issue for you?

Cheers,

-J

On Tuesday, 5 February 2013 11:12:11 UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to
have stopped working even though we haven’t changed anything in our code.
We have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Hi guys,

Thanks for reporting this. We’re looking into it right now for you. I’ll
report back here with our findings once we have them.

-JOn Tuesday, February 5, 2013 10:21:25 AM UTC, Curt Maybury (Design365) wrote:

I second this, we’re also experiencing the very same issue - initially we
revised our JSON data to match exactly the format in the development docs,
however this only worked for a few invoices before failing once more.

We desperately need to get these invoices out, has there been any update
on this?

Regards

Curt

On Monday, 4 February 2013 18:46:39 UTC, chrisb wrote:

Sure - here is an example I just tried:

REQUEST
POST https://api.freeagent.com/v2/estimates HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: QVSource (gzip)
QVSource: true
Authorization: Bearer XXXXXXXXXXX
Accept: application/xml
Content-Type: application/json
Host: api.freeagent.com
Content-Length: 318
Expect: 100-continue

{ estimate:{contact: “https://api.freeagent.com/v2/contacts/1188344",dated_on:“2013-2-04T00:00:00+00:00”,currency:“USD”,exchange_rate:"1.0”,estimate_type:
“Quote”,status:“Draft”,notes: “Here are some
notes”,estimate_items:[{item_type: “Products”,description:“My
App”,price:“100”,quantity:“1”,category:“009” }] }}

RESPONSE
HTTP/1.1 500 Internal Server Error
Server: nginx/1.0.14
Date: Mon, 04 Feb 2013 18:44:55 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 500 Internal Server Error
X-Runtime: 0.548472
X-Rev: 22bf745
X-Host: web3
Content-Length: 216

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.

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Curt: we’ve identified the issue and are fixing it up. Should have that
pushed very soon for you, as soon as the fix has passed QA.

Thanks for your patience, and sorry for the problems.

Cheers,

-JOn Tuesday, February 5, 2013 12:40:56 PM UTC, Jonathan Barrett wrote:

Thanks for that Curt,

I can see the issue here, and we’re looking into it.

-J

On Tuesday, February 5, 2013 11:12:11 AM UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Graeme and Jonathan,

I’m getting the same error message when I post the following to try to
create an invoice…

{“invoice”: {“payment_terms_in_days”: 0, “contact”:
https://api.freeagent.com/v2/contacts/1798739”, “exchange_rate”: 1,
“reference”: “10395”, “dated_on”: “2007-06-13”, “due_on”: “2007-06-13”,
“invoice_items”: [{“quantity”: 1, “description”: “1/00001316 - ttt”,
“price”: 120, “category”: “https://api.freeagent.com/v2/categories/268”,
“sales_tax_rate”: 0}]}}

This passes http://jsonlint.com.

It didn’t start happening until I tried adding the category attribute and
removing again it seems to “fix” it.

Any update on this?

Thanks
-Kevin WilliamsOn Saturday, 9 February 2013 00:28:32 UTC+13, Jonathan Barrett wrote:

Hi Curt,

Can you try your request now and see if it’s still an issue for you?

Cheers,

-J

On Tuesday, 5 February 2013 11:12:11 UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Hi Chris,

Estimate and Invoice creation are working fine via the API (I’ve just
double checked myself). I’ll dig into the logs tomorrow and see if I can
find your requests but can you give me an example failing request?

Kind regards,

GraemeOn 4 February 2013 17:42, chrisb brain2006@gmail.com wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774

Hi Chris,

The example you give is not valid JSON and doesn’t use a valid categories
URL. If you change it to the following it will work:

{
“estimate”: {
“contact”: “https://api.freeagent.com/v2/contacts/1188344”,
“dated_on”: “2013-2-04T00:00:00+00:00”,
“currency”: “USD”,
“exchange_rate”: “1.0”,
“estimate_type”: “Quote”,
“status”: “Draft”,
“notes”: “Here are some notes”,
“estimate_items”: [
{
“item_type”: “Products”,
“description”: “My App”,
“price”: “100”,
“quantity”: “1”,
“category”: “https://api.freeagent.com/v2/categories/009
}
]
}
}

The API should be returning a 400 and an “Invalid JSON” error message here
and we’ll fix that up soon. Thanks for drawing it to our attention.

In light of the recent Rails security issues our API now will only accept
valid JSON whereas it was a bit more forgiving about what it accepted in
the past. If your code was sending valid JSON you would not have noticed
any difference. If you want to check the validity of your JSON you can use
http://jsonlint.com.

Kind regards,

GraemeOn 5 February 2013 10:27, Jonathan Barrett jonathan@freeagent.com wrote:

Hi guys,

Thanks for reporting this. We’re looking into it right now for you. I’ll
report back here with our findings once we have them.

-J

On Tuesday, February 5, 2013 10:21:25 AM UTC, Curt Maybury (Design365) wrote:

I second this, we’re also experiencing the very same issue - initially we
revised our JSON data to match exactly the format in the development docs,
however this only worked for a few invoices before failing once more.

We desperately need to get these invoices out, has there been any update
on this?

Regards

Curt

On Monday, 4 February 2013 18:46:39 UTC, chrisb wrote:

Sure - here is an example I just tried:

REQUEST
POST https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimatesHTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: QVSource (gzip)
QVSource: true
Authorization: Bearer XXXXXXXXXXX
Accept: application/xml
Content-Type: application/json
Host: api.freeagent.com
Content-Length: 318
Expect: 100-continue

{ estimate:{contact: “https://api.freeagent.com/v2/**contacts/1188344https://api.freeagent.com/v2/contacts/1188344
“,dated_on:”**2013-2-04T00:00:00+00:00”,**currency:“USD”,exchange_rate:"
**1.0",estimate_type: “Quote”,status:“Draft”,notes: “Here are some
notes”,estimate_items:[{item_**type: “Products”,description:“My
App”,price:“100”,quantity:“1”,**category:“009” }] }}

RESPONSE
HTTP/1.1 500 Internal Server Error
Server: nginx/1.0.14
Date: Mon, 04 Feb 2013 18:44:55 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 500 Internal Server Error
X-Runtime: 0.548472
X-Rev: 22bf745
X-Host: web3
Content-Length: 216

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.

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/**estimateshttps://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/**invoiceshttps://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.com.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774

Thanks for that Curt,

I can see the issue here, and we’re looking into it.

-JOn Tuesday, February 5, 2013 11:12:11 AM UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Hi Curt,

Can you try your request now and see if it’s still an issue for you?

Cheers,

-JOn Tuesday, 5 February 2013 11:12:11 UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Sure - here is an example I just tried:

REQUEST
POST https://api.freeagent.com/v2/estimates HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: QVSource (gzip)
QVSource: true
Authorization: Bearer XXXXXXXXXXX
Accept: application/xml
Content-Type: application/json
Host: api.freeagent.com
Content-Length: 318
Expect: 100-continue

{ estimate:{contact:
https://api.freeagent.com/v2/contacts/1188344",dated_on:“2013-2-04T00:00:00+00:00”,currency:“USD”,exchange_rate:"1.0”,estimate_type:
“Quote”,status:“Draft”,notes: “Here are some
notes”,estimate_items:[{item_type: “Products”,description:“My
App”,price:“100”,quantity:“1”,category:“009” }] }}

RESPONSE
HTTP/1.1 500 Internal Server Error
Server: nginx/1.0.14
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 500 Internal Server Error
X-Runtime: 0.548472
X-Rev: 22bf745
X-Host: web3
Content-Length: 216

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.On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote: > > We have been making successful POST requests to: > https://api.freeagent.com/v2/estimates > https://api.freeagent.com/v2/invoices > > For a while now but last Tuesday (Jan 29th) evening they appear to have > stopped working even though we haven't changed anything in our code. We > have started getting the following: > > *WebException Response:

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.* > * > * > Could something have changed in the API which would explain this? >

No worries Kevin,

Glad I could help,

-JOn Monday, 1 July 2013 10:37:50 UTC+1, Kevin Williams wrote:

OK, that’s what it was.

Thanks Jonathan

On Friday, 28 June 2013 22:04:13 UTC+12, Jonathan Barrett wrote:

Hi Kevin,

Looking at the category you’re posting to here, the nominal code is for
an Admin Expenses category, but it needs to be for a sales category where
you’re creating an invoice.

Can you switch it for a sales nominal code, try again, and let me know if
you’re still seeing an error?

Cheers,

-J

On Friday, 28 June 2013 03:37:36 UTC+1, Kevin Williams wrote:

Graeme and Jonathan,

I’m getting the same error message when I post the following to try to
create an invoice…

{“invoice”: {“payment_terms_in_days”: 0, “contact”: "
https://api.freeagent.com/v2/contacts/1798739", “exchange_rate”: 1,
“reference”: “10395”, “dated_on”: “2007-06-13”, “due_on”: “2007-06-13”,
“invoice_items”: [{“quantity”: 1, “description”: “1/00001316 - ttt”,
“price”: 120, “category”: “https://api.freeagent.com/v2/categories/268”,
“sales_tax_rate”: 0}]}}

This passes http://jsonlint.com.

It didn’t start happening until I tried adding the category attribute
and removing again it seems to “fix” it.

Any update on this?

Thanks
-Kevin Williams

On Saturday, 9 February 2013 00:28:32 UTC+13, Jonathan Barrett wrote:

Hi Curt,

Can you try your request now and see if it’s still an issue for you?

Cheers,

-J

On Tuesday, 5 February 2013 11:12:11 UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to
have stopped working even though we haven’t changed anything in our code.
We have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?

Hi Kevin,

Looking at the category you’re posting to here, the nominal code is for an
Admin Expenses category, but it needs to be for a sales category where
you’re creating an invoice.

Can you switch it for a sales nominal code, try again, and let me know if
you’re still seeing an error?

Cheers,

-JOn Friday, 28 June 2013 03:37:36 UTC+1, Kevin Williams wrote:

Graeme and Jonathan,

I’m getting the same error message when I post the following to try to
create an invoice…

{“invoice”: {“payment_terms_in_days”: 0, “contact”: "
https://api.freeagent.com/v2/contacts/1798739", “exchange_rate”: 1,
“reference”: “10395”, “dated_on”: “2007-06-13”, “due_on”: “2007-06-13”,
“invoice_items”: [{“quantity”: 1, “description”: “1/00001316 - ttt”,
“price”: 120, “category”: “https://api.freeagent.com/v2/categories/268”,
“sales_tax_rate”: 0}]}}

This passes http://jsonlint.com.

It didn’t start happening until I tried adding the category attribute and
removing again it seems to “fix” it.

Any update on this?

Thanks
-Kevin Williams

On Saturday, 9 February 2013 00:28:32 UTC+13, Jonathan Barrett wrote:

Hi Curt,

Can you try your request now and see if it’s still an issue for you?

Cheers,

-J

On Tuesday, 5 February 2013 11:12:11 UTC, Curt Maybury (Design365) wrote:

Hi,

This passed jslint.com yet still fails - however I’ve removed
non-alphanumeric characters from the descriptions and it parses fine now.

{“invoice”: { “contact”: “https://api.freeagent.com/v2/contacts/663946”,
“status”: “Draft”, “dated_on”: “2013-02-05T00:00:00+00:00”, “currency”:
“GBP”, “exchange_rate”: “1.0”, “comments”: “”, “omit_header”: false,
“payment_terms_in_days”: 30, “invoice_items”: [{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Additional Product or Policy”,
“item_type”: “Services”, “price”: “50”, “quantity”: “1.0”, “sales_tax_rate”
: “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan Batra - Adhoc
Research (£50 per hour)”, “item_type”: “Services”, “price”: “50”,
“quantity”: “1.0”, “sales_tax_rate” : “20.0” },{ “description”: “Dr
Surinder and Mrs Kanchan Batra - Fund Review / Switch Report”, “item_type”:
“Services”, “price”: “100”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
},{ “description”: “Dr Surinder and Mrs Kanchan Batra - Investment Review”,
“item_type”: “Services”, “price”: “200”, “quantity”: “1.0”,
“sales_tax_rate” : “20.0” },{ “description”: “Dr Surinder and Mrs Kanchan
Batra - Personal Pension Review (up to 2 schemes)”, “item_type”:
“Services”, “price”: “225”, “quantity”: “1.0”, “sales_tax_rate” : “20.0”
}]} }

Regards

Curt

On Monday, 4 February 2013 17:42:34 UTC, chrisb wrote:

We have been making successful POST requests to:
https://api.freeagent.com/v2/estimates
https://api.freeagent.com/v2/invoices

For a while now but last Tuesday (Jan 29th) evening they appear to have
stopped working even though we haven’t changed anything in our code. We
have started getting the following:

WebException Response:

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.

*
*
Could something have changed in the API which would explain this?