Paging projects and tasks - incorrect 'Link' attribute

Hi,

I seem to having a problem with the Links that are generated for paginated
results for tasks for a project. The link does not include the project url
query string parameter, so subsequent calls fails.

The example below uses the sandbox API, but I assume this is completely
in-step with production?

Request URL: 

https://api.sandbox.freeagent.com/v2/tasks?project=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fprojects%2F1786&per_page=2
Response Link
Header: https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2;
rel=‘next’, https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2;
rel=‘last’

As you can see no project query string parameter, so getting
https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2’ results in
an error, ‘Resource not found’ with 404 error code.

There seems to be a similar problem with projects:

Request URL: 

https://api.sandbox.freeagent.com/v2/projects?contact=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fcontacts%2F23337&per_page=2
Response Link
Header: https://api.sandbox.freeagent.com/v2/projects?page=2&per_page=2;
rel=‘next’,
https://api.sandbox.freeagent.com/v2/projects?page=3&per_page=2;
rel=‘last’

This is actually a bit more of a problem, because the constructed URLs are
correct in that they will return projects, they will just not be the
correct ones.

After further investigation while writing this post I believe the actual
problem is that these API’s do not actually support paging, in which case
the Link header should not be present at all as there is no such thing as a
‘next’ page.

Thanks,
Adam

Hi Adam,

Thanks for bringing this to our attention. We have now addressed this
issue, and any parameters such as “project=” or “view=” should be correctly
persisted.

Thanks,

DavidOn Wednesday, 14 May 2014 14:48:23 UTC+1, Adam Barclay wrote:

Hi,

I seem to having a problem with the Links that are generated for paginated
results for tasks for a project. The link does not include the project url
query string parameter, so subsequent calls fails.

The example below uses the sandbox API, but I assume this is completely
in-step with production?

Request URL: 

https://api.sandbox.freeagent.com/v2/tasks?project=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fprojects%2F1786&per_page=2
Response Link Header: <
https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2>;
rel=‘next’, https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2;
rel=‘last’

As you can see no project query string parameter, so getting ’
https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2’ results in
an error, ‘Resource not found’ with 404 error code.

There seems to be a similar problem with projects:

Request URL: 

https://api.sandbox.freeagent.com/v2/projects?contact=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fcontacts%2F23337&per_page=2
Response Link Header: <
https://api.sandbox.freeagent.com/v2/projects?page=2&per_page=2>;
rel=‘next’, <
https://api.sandbox.freeagent.com/v2/projects?page=3&per_page=2>;
rel=‘last’

This is actually a bit more of a problem, because the constructed URLs are
correct in that they will return projects, they will just not be the
correct ones.

After further investigation while writing this post I believe the actual
problem is that these API’s do not actually support paging, in which case
the Link header should not be present at all as there is no such thing as a
‘next’ page.

Thanks,
Adam

Hi Adam,

I’m afraid you’ve found a bug! The filter parameter (project for tasks and
contact for projects) isn’t being passed through to the pagination links.
Pagination does work for these resources though so if you append the
filter parameter to the pagination links being returned you should be able
to page through your results.

Kind regards,

GraemeOn 14 May 2014 14:48, Adam Barclay barclay.adam@gmail.com wrote:

Hi,

I seem to having a problem with the Links that are generated for paginated
results for tasks for a project. The link does not include the project url
query string parameter, so subsequent calls fails.

The example below uses the sandbox API, but I assume this is completely
in-step with production?

Request URL:

https://api.sandbox.freeagent.com/v2/tasks?project=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fprojects%2F1786&per_page=2
Response Link Header: <
https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2>;
rel=‘next’, https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2;
rel=‘last’

As you can see no project query string parameter, so getting ’
https://api.sandbox.freeagent.com/v2/tasks?page=2&per_page=2’ results in
an error, ‘Resource not found’ with 404 error code.

There seems to be a similar problem with projects:

Request URL:

https://api.sandbox.freeagent.com/v2/projects?contact=https:%2F%2Fapi.sandbox.freeagent.com%2Fv2%2Fcontacts%2F23337&per_page=2
Response Link Header: <
https://api.sandbox.freeagent.com/v2/projects?page=2&per_page=2>;
rel=‘next’, <
https://api.sandbox.freeagent.com/v2/projects?page=3&per_page=2>;
rel=‘last’

This is actually a bit more of a problem, because the constructed URLs are
correct in that they will return projects, they will just not be the
correct ones.

After further investigation while writing this post I believe the actual
problem is that these API’s do not actually support paging, in which case
the Link header should not be present at all as there is no such thing as a
‘next’ page.

Thanks,
Adam


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/d/optout.

Graeme Boyd
Engineering Manager

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