Creating a timeslip (v2)

Hi there,

I’m trying out the v2/timeslip request but am failing with “{“task”:
[“must be specified”]}”

The request I’m sending is in this form

curl -d “user=https://api.sandbox.freeagent.com/v2/users/
117&project=https://api.sandbox.freeagent.com/v2/projects/
3&task=https://api.sandbox.freeagent.com/v2/tasks/
1&dated_on=2012-01-02&hours=4.0” https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”

Do I need to encode my post data at all (i.e. escape slashes etc)?

Thanks in advance,
Todd

Ah right… brilliant thanks… will give this a whirl

Ta,
ToddOn Feb 8, 10:19 am, Graeme Boyd graeme.b...@freeagent.com wrote:

Hi Todd,

If you format the data as JSON it will work:

curl -d '{“timeslip”:“user”:“https://api.sandbox.freeagent.com/v2/users/
117”,“project”:“https://api.sandbox.freeagent.com/v2/projects/
3”,“task”:“https://api.sandbox.freeagent.com/v2/tasks/https://api.sandbox.freeagent.com/v2/projects/3&task=https://api.sand...
1”,“dated_on”:“2012-01-02”,“hours”:“4.0”}}'https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”
-H “Content-Type: application/json”

(Assuming I’ve typed the above correctly!)

You also need the Content-Type header.

Hope this helps,

Graeme

On 8 February 2012 08:44, Todd Halfpenny mrshar...@gmail.com wrote:

Hi there,

I’m trying out the v2/timeslip request but am failing with “{“task”:
[“must be specified”]}”

The request I’m sending is in this form

curl -d “user=https://api.sandbox.freeagent.com/v2/users/
117&project=https://api.sandbox.freeagent.com/v2/projects/
3&task=https://api.sandbox.freeagent.com/v2/tasks/
1&dated_on=2012-01-02&hours=4.0”
https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”

Do I need to encode my post data at all (i.e. escape slashes etc)?

Thanks in advance,
Todd


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


Graeme Boyd
Senior Software Engineer
FreeAgent Central Ltd
40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Ah right… brilliant thanks… will give this a whirl

Ta,
ToddOn Feb 8, 10:19 am, Graeme Boyd graeme.b...@freeagent.com wrote:

Hi Todd,

If you format the data as JSON it will work:

curl -d '{“timeslip”:“user”:“https://api.sandbox.freeagent.com/v2/users/
117”,“project”:“https://api.sandbox.freeagent.com/v2/projects/
3”,“task”:“https://api.sandbox.freeagent.com/v2/tasks/https://api.sandbox.freeagent.com/v2/projects/3&task=https://api.sand...
1”,“dated_on”:“2012-01-02”,“hours”:“4.0”}}'https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”
-H “Content-Type: application/json”

(Assuming I’ve typed the above correctly!)

You also need the Content-Type header.

Hope this helps,

Graeme

On 8 February 2012 08:44, Todd Halfpenny mrshar...@gmail.com wrote:

Hi there,

I’m trying out the v2/timeslip request but am failing with “{“task”:
[“must be specified”]}”

The request I’m sending is in this form

curl -d “user=https://api.sandbox.freeagent.com/v2/users/
117&project=https://api.sandbox.freeagent.com/v2/projects/
3&task=https://api.sandbox.freeagent.com/v2/tasks/
1&dated_on=2012-01-02&hours=4.0”
https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”

Do I need to encode my post data at all (i.e. escape slashes etc)?

Thanks in advance,
Todd


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


Graeme Boyd
Senior Software Engineer
FreeAgent Central Ltd
40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Hey Graeme (and all),

So there was a slight mistake in the earlier post… this works for me

curl https://api.sandbox.freeagent.com/v2/timeslips -X POST -H
“Authorization: Bearer dlsfnvsdf098vdfbdf90b8d9fb8sndfbd90f8b” -H
“Accept: application/json” -H “Content-Type: application/json” -d
‘{“timeslip”:{“user”:“https://api.sandbox.freeagent.com/v2/users/
117”,“project”:“https://api.sandbox.freeagent.com/v2/projects/
3”,“task”:“https://api.sandbox.freeagent.com/v2/tasks/<https://
api.sandbox.freeagent.com/v2/projects/3&task=https://
api.sandbox.freeagent.com/v2/tasks/
1”,“dated_on”:“2012-01-02”,“hours”:“4.0”}}’

Thanks again for putting me on the right track.

ToddOn Feb 8, 6:13 pm, Todd Halfpenny mrshar...@gmail.com wrote:

Ah right… brilliant thanks… will give this a whirl

Ta,
Todd

On Feb 8, 10:19 am, Graeme Boyd graeme.b...@freeagent.com wrote:

Hi Todd,

If you format the data as JSON it will work:

curl -d '{“timeslip”:“user”:“https://api.sandbox.freeagent.com/v2/users/
117”,“project”:“https://api.sandbox.freeagent.com/v2/projects/
3”,“task”:“https://api.sandbox.freeagent.com/v2/tasks/https://api.sandbox.freeagent.com/v2/projects/3&task=https://api.sand...
1”,“dated_on”:“2012-01-02”,“hours”:“4.0”}}'https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”
-H “Content-Type: application/json”

(Assuming I’ve typed the above correctly!)

You also need the Content-Type header.

Hope this helps,

Graeme

On 8 February 2012 08:44, Todd Halfpenny mrshar...@gmail.com wrote:

Hi there,

I’m trying out the v2/timeslip request but am failing with “{“task”:
[“must be specified”]}”

The request I’m sending is in this form

curl -d “user=https://api.sandbox.freeagent.com/v2/users/
117&project=https://api.sandbox.freeagent.com/v2/projects/
3&task=https://api.sandbox.freeagent.com/v2/tasks/
1&dated_on=2012-01-02&hours=4.0”
https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”

Do I need to encode my post data at all (i.e. escape slashes etc)?

Thanks in advance,
Todd


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


Graeme Boyd
Senior Software Engineer
FreeAgent Central Ltd
40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774

Hi Todd,

If you format the data as JSON it will work:

curl -d ‘{“timeslip”:“user”:“https://api.sandbox.freeagent.com/v2/users/
117”,“project”:“https://api.sandbox.freeagent.com/v2/projects/
3”,“task”:“https://api.sandbox.freeagent.com/v2/tasks/https://api.sandbox.freeagent.com/v2/projects/3&task=https://api.sandbox.freeagent.com/v2/tasks/
1”,“dated_on”:“2012-01-02”,“hours”:“4.0”}}’
https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”
-H “Content-Type: application/json”

(Assuming I’ve typed the above correctly!)

You also need the Content-Type header.

Hope this helps,

GraemeOn 8 February 2012 08:44, Todd Halfpenny mrsharris@gmail.com wrote:

Hi there,

I’m trying out the v2/timeslip request but am failing with “{“task”:
[“must be specified”]}”

The request I’m sending is in this form

curl -d “user=https://api.sandbox.freeagent.com/v2/users/
117&project=https://api.sandbox.freeagent.com/v2/projects/
3&task=https://api.sandbox.freeagent.com/v2/tasks/
1&dated_on=2012-01-02&hours=4.0”
https://api.sandbox.freeagent.com/v2/timeslips

-X POST
-H “Authorization: Bearer <ACCESS_TOKEN>”
-H “Accept: application/json”

Do I need to encode my post data at all (i.e. escape slashes etc)?

Thanks in advance,
Todd


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

Graeme Boyd
Senior Software Engineer
FreeAgent Central Ltd
40 Torphichen Street, Edinburgh EH3 8JB
Registered in Scotland SC316774