-
Notifications
You must be signed in to change notification settings - Fork 33
REST API #27
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
REST API #27
Conversation
5894aaa to
65b0a3c
Compare
|
Great RFC! That's exactly what I am expecting to see in v4 |
|
Hi! First of all the new version of the REST API looks promising ! Here my first impression about it:
Finally I love the example with PS: You are a beast, I can't wait to see the V4 😍 |
Co-authored-by: Rémi de Juvigny <remi.dejuvigny@strapi.io>
|
What about prefixes for APIs, the same logic as Plugins have right now in routes.json (config.prefix) |
Everything @Stun3R said! :) The as per naming I personally thing This is very exciting! Can't wait to see the RFC for GraphQL. 🚀🔥 [rocket-fire!] As per the request for feedback
IMHO and experience, the count data is important 98% of the time when dealing with pagination, therefore I would like to say option[2] - always return by default and provide option to disable for the 2% of the time, haha. Unless the performance overhead is significant, which hopefully it wouldn't be 😅 |
|
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/new-version-questions-thoughts-v4/4824/1 |
|
Regarding the total count data for pagination, I personally think it is better to keep the API performant by default, and elect to receive the total count only when explicitly required. Perhaps an alternative is to allow the database connector to elect the default depending whether counting is expensive or not. However this would result in inconsistency so it's probably better to stick with a performant default. No choice you make will suit everybody, so sticking with Strapi's configurable nature, it's probably good to allow the default to be configured, both globally and perhaps also per content type. |
I totally agree with you, for me it should be disable by default to keep the performance but it could be configurable in order to choose if it's enable or disable by default. |
|
@brettwillis / @Stun3R I'm with both of you, keep it disabled by default but allow the user to configure this either globally |
@sunnysonx I'm so much with you! Because at the moment when you have articles, tags and categories contentType you have to go though |
|
The RFC seems promising in many ways. |
|
Here are a few of my conventions, maybe some would be useful. I use the terms:
HTTP response format:
Collection {
offset: 20, // the number of records skipped
limit: 20, // the number of records returned
total: 100, // the total number of records in the collection
orderBy: {…}, // the order by field
groupBy: {…}, // how the request was grouped
query: {…}, // how the request was filtered (the URL query object)
fields: […], // the fields which are included in the record
lang: 'en', // the selected language
}All the above fields from the I started with a similar approach to HTTP response JSON error format:
|
|
|
||
| ### Pagination | ||
|
|
||
| **Parameter** `pagination` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add param to configure default behavior for counters
I believe (@alexandrebodin correct me if I'm wrong) but don't we plan to add query lifecycles that are executed around the controllers or services much like policies function now? |
This is something we are considering. It might not be released directly for v4.0.0 but there are good chances this will be added. For the lifecycles this is also another approach we are exploring. These could come and extend the REST and GraphQL API a bit later :) |
|
@alexandrebodin Thanks |
|
For the fields, could we pass in relation field name we could return an array of IDs instead of an array of objects with the ID key. Something like |
|
As mentioned above by @sunnysonx namespace would be so great. It can besom a mess right now not to be able to (easily) regroup endpoints and to have all the content type listed as on unique lost in the admin. One thing I'd like to see also would be lifecycle hooks for components. If you start using components for recurrent data pattern (such as addresses, coordinates, whatever) but have to apply some operation on it, the only thing you can do right now is to alter the lifecycle on each content-type that is able to use the said component which is not a great design at all. |
|
Hi!
Thanks! |
We currently have no method to populate everything (simply) past 1 level. Last time I discussed (internally) with @alexandrebodin was the potential to add a "multi-wildcard" like |
|
The changes you have made already are awesome! Although I have a feeling we lost some functionality. I would've assumed that all info about localizations would be found in the 'meta' object. But it's never returning that for me. Is this blocked for the outside API (sanitized)? Or did you remove this on purpose? I am asking this question because it's something I used pretty often. The way the api's are structured and named now are very nice changes tho, and I cant wait to update to strapi v4.0 Kind regards |
The localization stuff should show up? I was just testing it on the latest beta we put out today (beta.12) |
Thanks for the info @derrickmehaffy, in light of currently not being able to get a 'deeply' populated response from the REST API, I have looked at retrieving this data using the graphql API (currently using Error when uncommenting 'sections': I hope this is still the right place to ask this question, but if someone could point out how to query a dynamic zone with graphql that'd much appreciated! |
|
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/strapi-v4-populate-media-and-dynamiczones-from-components/12670/2 |
Rest API v4
This PR introduces a draft version of the REST API in v4.
We want to get the conversation started around this topic to get feedbacks quickly so feel free to ask questions and give ideas :)
You can read it here