Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters not functioning as documented #253

Open
pavelvazquez opened this issue Aug 28, 2024 · 4 comments
Open

Parameters not functioning as documented #253

pavelvazquez opened this issue Aug 28, 2024 · 4 comments

Comments

@pavelvazquez
Copy link

Description

The per_page parameter in the API documentation https://github.com/unioslo/tsd-api-docs is supposed to control the number of files returned per request, with a maximum value of 50,000. However, when using this parameter, the API only returns 100 results regardless of the per_page value provided. Additionally, attempts to paginate through the results using the page parameter have also failed, with the API repeatedly returning the first page.

Steps to Reproduce

1. Using per_page in API Requests

According to the documentation, I should be able to retrieve up to 50,000 results by setting the per_page parameter. However, this does not work as expected.

Example cURL Command:

curl -X GET "https://api.example.com/files?per_page=1000&inbox=true" \
-H "Proxy-Authorization: Bearer TOKEN" \
-u email:password

Expected Behavior:

The API should return up to 1000 files as specified by the per_page parameter.

Actual Behavior:

The API consistently returns only 100 files, irrespective of the per_page value.

Attempting pagination with page parameter

To work around the issue, I tried paginating through the results by incrementing the page parameter manually. However, this also did not work.

curl -X GET "https://api.example.com/files?inbox=true&page=2" \
-H "Proxy-Authorization: Bearer TOKEN" \
-u email:password

Expected Behavior:

This command should return the next set of files.

Actual Behavior:

It returns the same set of 100 files, indicating that pagination is not working as expected.

Additional Information

The issue was consistently reproducible both in the command line using curl in macOS and unix, also programmatically via Go code.

Request

Please investigate and fix the issue with the per_page and page parameters. If there's a specific requirement or limitation we're missing, updating the documentation to clarify the correct usage would also be greatly appreciated.

@leondutoit
Copy link
Collaborator

I see the docs omitted the fact that you always need to specify the page number with page, when providing the per_page parameter. You should be able to get it to work by doing ?page=0&per_page=1000.

I do think that the per_page should work without specifying page, and will get around to fixing that.

@pavelvazquez
Copy link
Author

Thank you for your suggestion. I ran the following command to test the per_page and page parameters:

curl -X GET "https://api.example.com/files?page=0&per_page=1000" \
-H "Proxy-Authorization: Bearer" \
-u email:password

Unfortunately, I’m still only receiving 100 files. Is there any additional configuration or context required for this parameter to function correctly?

@leondutoit
Copy link
Collaborator

Is this running behind a proxy?

@pavelvazquez
Copy link
Author

It seems like it could be the reason. I'm investigating to confirm if that's the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants