HTTP/1.1 400 Bad Request For any GET/POST

Hello,

I am new to the API and have been playing about using the Google Sandbox
tool as you run through in the Getting started section. I am able to get a
valid response by running the following:

https://api.sandbox.freeagent.com/v2/company/

However, whenever I do any other request, I get the following:

GET /v2/invoices?page=5&per_page=50 HTTP/1.1
Host: api.freeagent.com
Content-length: 0
Authorization: Bearer 1ViwK_7_OF0_LUDfq_N3dnYXcB7ZywFxS1N6fFpE-

HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain

WWW-Authenticate

What am i missing?

Thanks

Paul

Hi Paul,

The sandbox and freeagent.com use different tokens. Are you trying to use
the same token for both endpoints?

Kind regards,

GraemeOn 4 January 2014 11:45, Paul Sanders paul.sanders87@gmail.com wrote:

Hello,

I am new to the API and have been playing about using the Google Sandbox
tool as you run through in the Getting started section. I am able to get a
valid response by running the following:

https://api.sandbox.freeagent.com/v2/company/

However, whenever I do any other request, I get the following:

GET /v2/invoices?page=5&per_page=50 HTTP/1.1
Host: api.freeagent.com
Content-length: 0
Authorization: Bearer 1ViwK_7_OF0_LUDfq_N3dnYXcB7ZywFxS1N6fFpE-

HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain

WWW-Authenticate

What am i missing?

Thanks

Paul


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.
For more options, visit https://groups.google.com/groups/opt_out.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. The FreeAgent Blog - FreeAgent
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
FreeAgent | Edinburgh

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

Hi Nathan,

Glad you sorted it out. As to tutorials, I don’t have a list to hand, but
maybe the group could provide suggestions if you open a new thread?

Cheers,

-J

I’m having the same issue, no errors, just ‘Bad request’. Not sure where to
start really. I’m just testing requests in the Google Sandbox (with the
endpoint being my freeagent sandbox).

Are there any actual tutorials anywhere beyond the getting started guide?
It took me 20 minutes just to find out what format the’ dated_on’ attribute
should be in…

Docs are a bit sparse!

NathanOn Saturday, 4 January 2014 11:45:24 UTC, Paul Sanders wrote:

Hello,

I am new to the API and have been playing about using the Google Sandbox
tool as you run through in the Getting started section. I am able to get a
valid response by running the following:

https://api.sandbox.freeagent.com/v2/company/

However, whenever I do any other request, I get the following:

GET /v2/invoices?page=5&per_page=50 HTTP/1.1
Host: api.freeagent.com
Content-length: 0
Authorization: Bearer 1ViwK_7_OF0_LUDfq_N3dnYXcB7ZywFxS1N6fFpE-

HTTP/1.1 400 Bad Request
Content-length: 16
Content-type: text/plain

WWW-Authenticate

What am i missing?

Thanks

Paul

Hi Jonathan,

Actually I just worked out what was being referred to when the question of
endpoints came up. I was indeed using the normal api address for the
request, and not including ‘sandbox’ in the URL. Doh.

Are there any tutorials out there for the API though? I worry that because
there are no defaults, formats etc stated for the many attributes I’m going
to be running into a lot of issues…

Nathan Hornby
Partner

3Degrees Agency http://www.3degreesagency.com
nathan@3degreesagency.com
Office: +44 (0) 2393 078637
Mobile: +44 (0) 7955 535359
3Degrees Agency, 23 High Street, Old Portsmouth, Hampshire, England, PO1 2LS

This message may contain sensitive or confidential information and is
intended for the recipient only. If you received this in error, please
contact the sender and delete the e-mail and its attachments from all
computers.

3Degrees Agency is a trading name of 3DDA LLP. Company Number OC364828. VAT
Number 152711238.

Please avoid printing this email if possible. If you do print it, please
recycle it.On 4 March 2014 11:20, Jonathan Barrett jonathan@freeagent.com wrote:

Hi Nathan,

Sorry you’re having trouble here. Can you give me a specific request
example that you’re seeing an error on, including the request body?

Thanks,

-J


You received this message because you are subscribed to a topic in the
Google Groups “FreeAgent API” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/freeagent_api/huoHvCQA-MM/unsubscribe.
To unsubscribe from this group and all its topics, 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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Nathan,

Sorry you’re having trouble here. Can you give me a specific request
example that you’re seeing an error on, including the request body?

Thanks,

-J