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