POSTing to timeslip API always returning 400
Hi,
I'm working on a little helper to post timeslips to my account, but I can't for the life of me get it to work. Even when posting your example XML (changing the date, and IDs, of course), i get a 400. I also get a 400 when using the Timepost application, which is what suggests to me that it's something on your end.
I can GET data fine - it's just POSTing that's bust.
I'm working on a little helper to post timeslips to my account, but I can't for the life of me get it to work. Even when posting your example XML (changing the date, and IDs, of course), i get a 400. I also get a 400 when using the Timepost application, which is what suggests to me that it's something on your end.
I can GET data fine - it's just POSTing that's bust.
2
people have this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
The company marked this problem solved.
-
Inappropriate?Hi James
Sorry you're having issues. It looks like you're not setting the project ID in the POST request -- can you confirm?
Regarding Timepost, there shouldn't be an issue there so we'll take a closer look into that.
Olly
-
Inappropriate?Hi Olly, thanks for the response. In the API docs, it states we should post to /timeslips (rather than under a project), so that might need a little attention.
Anyway - I've amended the URL, and now I'm getting 401s (despite the same auth working for GET requests, and API access turned on in my settings). Any ideas?
Here's the curl statements I'm using:
curl -X GET -u james@mydomain.com:mylongpassword -H 'Accept: application/xml' -H 'Content-type: appliation/xml' -v https://mydomain.freeagentcentral.com...
(works)
curl -X POST -u james@mydomain.com:mylongpassword -H 'Accept: application/xml' -H 'Content-type: appliation/xml' -v https://mydomain.freeagentcentral.com...
(401, regardless of whether I do send data along with the POST)
Cheers! -
Inappropriate?Hi James
/timeslips is the correct resource to POST to but you'll need to add a project-id parameter to the request. It looks like the documentation needs a bit of work here so I'll address this ASAP.
Let me know how you get on. -
Inappropriate?I've just started getting the same issue with timepost, which has been working fine for over a month. Is this an itermittent problem?
I’m mildly annoyed
-
Inappropriate?diapente
Could you email support at freeagentcentral.com with your account name and we'll take a closer look. Nothing has changed with regards to the FreeAgent API though, so I'm not sure why it would have stopped working. -
Inappropriate?I'm seeing this again (although I can still post via my Dashboard widget). Here's my raw request (made at 29/01/10 15:42:23):
POST /timeslips HTTP/1.1
Accept: */*; q=0.5, application/xml
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Authorization: Basic ivealterestthisbutitreallyisthereandotherrequestswork==
Content-Length: 319
Host: lazyatom.freeagentcentral.com
<?xml version="1.0" encoding="UTF-8"?>
2010-01-29T15:42:23+00:00
1.0
22532
Hello
27407
2602
And here's the response:
HTTP/1.1 400 Bad Request
Date: Fri, 29 Jan 2010 15:42:23 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.9
X-Runtime: 9
Cache-Control: no-cache
Set-Cookie: _session_id=fc90e7354838f7d9748bf764b674d7bd; domain=.freeagentcentral.com; path=/; HttpOnly
Status: 400
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 21
Connection: close
Content-Type: application/xml; charset=utf-8
I’m confused
-
Urgh, the 'code' formatting has message up my XML. I'll try again with the request:
POST /timeslips HTTP/1.1
Accept: */*; q=0.5, application/xml
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Authorization: Basic amFtZXNAbGF6eWF0b20uY29tOndhbTN3eW9yZDlpYg==
Content-Length: 319
Host: lazyatom.freeagentcentral.com
<?xml version="1.0" encoding="UTF-8"?>
<timeslip>
<dated-on type="datetime">2010-01-29T15:42:23+00:00</dated-on>
<hours type="float">1.0</hours>
<task-id type="integer">22532</task-id>
<comment>Hello</comment>
<project-id type="integer">27407</project-id>
<user-id type="integer">2602</user-id>
</timeslip> -
Inappropriate?Hi James
Sorry you're having problems. Please can you try again but set the Content-Type header to 'application/xml'?
Olly
1 person says
this solves the problem
Loading Profile...




