-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Posts API Response #2347
Comments
issue TryGhost#2270 - from https://github.com/manuelmitasch/ghost-admin-ember-demo - Not working properly: added ic-ajax mock in app.js but promise not resolving => loading route always active
Don't think we need a type property. Not sure what you mean about published state - the response has |
@ErisDS yes I meant something like
|
I'm happy to have a published boolean in the response if it makes managing permissions easier :) |
I withdraw from wanting a |
👍 |
I updated the user responses to follow the JSON API format. See #2362. |
Overall this looks good, JSON API taking care of many decisions obviously. Few questions though.
It looks like that's somewhat covered by the extending doc on JSON API. |
Also are we looking to support URLs of the type |
The assumption was that
Navigation: Next: https://api.example.com/whatever?after=42&limit=15
It depends on what database you are using. mySql will return
At the moment there is no URL like that. Do you have a specific use case in mind? |
I prefer offset, was just curious about that other implementation.
So that's mostly my question: what's the canonical value that the API and models should return? It seems like 0/1. This is off topic from this thread so probably best continued elsewhere.
Nope, just curious if we were looking to support it. Unclear if it'd be necessary. Always easy to extend at a later point. |
@hswolff JSON has a boolean type - so to make client side logic a bit clearer we should have the API return booleans when there's boolean data. The API layer should handle converting those values to whatever the database expects.
|
Agreed w/ @halfdan. I'd prefer explicit true/false both from API and from Models. |
@halfdan good point, there is a datatype and therefore we should use it! I'll update the API responses accordingly. |
Just wanna wade in here with some thoughts about the pagination. There is an age old issue about pagination here: #110, there are also two open issues about prev/next page/post: #529 and #685 as well as a PR #1545 awaiting performance testing / suggestions for improvement. The whole thing is a minefield, we want to make it performant but also usable. So I guess my question is, would the 'after' style pagination make it easier to do any of this? Is there a way to return URLs to the next/previous resource in a collection. Are there other implications for how we can implement these features considering that the proposal in #1545 was to always include the previous and next post in any single post 'GET', which I really didn't like but seemed like the only way to really implement the feature at the time. |
I think we have successfully determined what the response should look like, in line with JSON API 😄 |
I believe the finalised formats are going to be: Single Post:
Post collection:
|
Co-authored-by: Renovate Bot <bot@renovateapp.com>
The structure of our JSON/REST APIs are up for spring cleaning #2124. The most complex JSON object is a post. I have compiled what I think could be changed to improve consistency and readability?
Single Post
GET /ghost/api/v0.1/posts/1
JSON Object (v0.1)
New JSON Object:
author_id
is renamed toauthor
tags
,created_by
,updated_by
andpublished_by
could become expandable properties (see Expanding JSON API Objects #2346).Post Collection
GET /ghost/api/v0.1/posts/
JSON Object (v0.1)
New JSON Object:
meta
property (jsonapi.org/format - Top Level)limit
: number of posts per pageoffset
: offset in number of posts instead of pagetotal
: number of all postsThe text was updated successfully, but these errors were encountered: