Open sidwarkd opened 7 years ago
The created and published sort parameters are indeed broken right now. Thanks for the report.
You're doing it right. It's a bug.
Always sort first, then limit.
It's not a great answer but we have not added the pagination metadata to the response yet. The pagination links would appear in the links
response key. See http://jsonapi.org/format/#fetching-pagination
The sorted database fields used the wrong name.
Published means most recently published.
Publishing is done in 2 steps: uploading a private version and publishing it to the public. Updated is the date when the library version was uploaded as a private version. Published is when the version was made available to the public. I'm thinking right now it doesn't add much value to have both.
It's not working, sorry.
Other than fixing the sorting bug, do you have other feedback for the library API?
Thanks for the super quick response @monkbroc. I think that's all the feedback I have for now. I love the idea of being able to query this data to keep abreast of the library ecosystem. Thanks for answering all the questions and I'll keep an eye on this issue to know when to try my queries again.
Bug
Expected behavior
Documented query string parameters should affect returned results.
Observed behavior
Passing different sort param values returns the exact same JSON.
Steps to reproduce
I'm trying to use the Cloud API to stay on top of new community libraries as they become available and have found some confusing behavior. For example, I'd like to run a query that returns the 5 most recently created libraries so I run the following:
curl https://api.particle.io/v1/libraries?scope=all&sort=-created&limit=5&access_token=[MY TOKEN]
That returns libraries like HttpClient which obviously isn't a newly created library. But the other interesting part is that that command returns exactly the same result set as the following 3 commands:
sort=created
curl https://api.particle.io/v1/libraries?scope=all&sort=created&limit=5&access_token=[MY TOKEN]
sort=-published
curl https://api.particle.io/v1/libraries?scope=all&sort=-published&limit=5&access_token=[MY TOKEN]
sort=published
curl https://api.particle.io/v1/libraries?scope=all&sort=published&limit=5&access_token=[MY TOKEN]
After playing with it for about an hour I came up with a list of questions that I didn't find answers to in the documentation and was hoping somebody from the team could answer.
This is the output I get for all of the above API calls.