-
Notifications
You must be signed in to change notification settings - Fork 4
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
Define a new API for getting the quote list #84
Comments
I'm on it. |
For all parties involved: please note I've added the technical specification to the first post. Feel free to discuss. |
@ForNeVeR Why in {
"quotes": 123,
"goats": 52,
"mixers": 63
} If it is true then those field should be directly related to quotes, because the name of the route implies so. What other quote related counts can we have? Total amount of votes for this specific filter? I mean, I don't mind the current name, it just raises too many questions in my perverted brain. If the answer is "I couldn't come up with a better name", I'm ok with that. |
Overall I'm approved by this shit 👍 |
@rexim that was a leftover from my previous idea when I was considering to count quotes, pages and even return the page size limit from the server. I've fixed the spec; the new name of that parameter is just |
Don't forget about filters and sorters for this one!
Specification (written by F.)
Prior experience
Note that we already have routes
/api/quote/{id}
and/api/quote/random
. These remains the same.Also there's a voting API:
quote/{id}/upvote
,quote/{id}/downvote
; I'll discuss these below.Proposals
1. URL parameters
I propose to adapt for API the same URL scheme we use for our main frontend pages with the addition of the
limit
parameter:?limit=a&page=x&order=y&filter=z
with all four parts being optional with sensible defaults (defaultlimit
matching the corresponding frontend parameter,pageSize = 50
).For reference:
filter
arenone
(the default; never exposed in a public URL but still valid),year
,month
,week
, andday
order
aretime
(the default; never exposed yet) andrating
2. Count API
Add a new route
/api/quote/count[filter]
to get quote count information in the following format:3. List API
Add a new route
/api/quote/list[filter]
to get a list of quotes in the same format our current API use.4. CORS support
As we have plans to develop an isolated frontend for LogList, we'll need all the API routes to properly support CORS. So, there should be a configuration option to enable CORS with the admin-selected domain.
If that'll be easier to implement, enable CORS for the whole site, not just the new API.
5. Voting API
I suggest to finally implement #94 in relation to the voting API: move them to
/api/quote/{id}/(up|down)vote
, and thus make them a part of the public, supported external API.Implementation
The text was updated successfully, but these errors were encountered: