-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
API option handling #2758
Labels
affects:api
Affects the Ghost API
Comments
This was referenced Jun 17, 2015
ErisDS
added a commit
to ErisDS/Ghost
that referenced
this issue
Jun 28, 2015
refs TryGhost#2758 - Post, Tag & User API methods are refactored to use pipeline - Each functional code block is a named task function - Each function takes options, manipulates it, and returns options back - Tasks like permissions can reject if they don't pass, causing the pipeline to fail - Tasks like validating and converting options might be abstracted out into utils - the same for each endpoint - Tasks like the data call can be extremely complex if needs be (like for some user endpoints) - Option validation is mostly factored out to utils - Option conversion is factored out to utils - API utils have 100% test coverage - Minor updates to inline docs, more to do here
Merged
ErisDS
added a commit
to ErisDS/Ghost
that referenced
this issue
Jul 14, 2015
refs TryGhost#2758 - add a set of default options to utils - update validation function to only pass through permitted options - pass permitted options into validate where necessary - setup basic validation for each known option, and generic validation for the remainder - change slug to treat 'name' as data, rather than an option
ErisDS
added
the
later
[triage] Things we intend to work but are not immediate priority
label
Sep 20, 2016
I'm closing most API issues temporarily with the JSON API Overhaul & OAuth access are currently scheduled next on the roadmap |
ErisDS
removed
later
[triage] Things we intend to work but are not immediate priority
labels
Jan 23, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refs #2187
In our current implementation wrong or misused options are removed and the request is carried out without the options. This behavior makes our lives a bit easier in regards to error handling but invalid values for valid options should not be accepted and return
400 Bad Request
.Request parameters that are not supported at all could be ignored as most other web applications do.
Example:
Request:
GET /ghost/api/v0.1/posts/?status=green
Result:
400, 'green is an invalid status'
Request:
GET /ghost/api/v0.1/posts/?test=true
Result: same result as
GET /ghost/api/v0.1/posts/
For internal API requests a new error class (
InvalidOptionError
) could be introduced.The text was updated successfully, but these errors were encountered: