-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 Response Trait #86
Comments
Are you referring to a simplified version of Laravel's Resource Controllers? https://laravel.com/docs/5.3/controllers#resource-controllers |
Nope. CI already has Resourceful Routes. In this, I'm talking about common response methods for a number of the most frequently used responses in API's. This would set the correct HTTP status code, default message, etc and send the response, thus helping a user keep a consistent, and accurate response when doing RESTful API's. I've got one of these partially finished that I've used in a few other projects that I need to revisit, expand, and re-research to ensure they're still meeting best practices. |
You mean something like this?
|
No, what I had used previously were a series of methods that made it easier to remember, like There's enough discussion about certain status' that it would be wise to make those customizable. Another wrinkle is that we need to determine exactly how we're going to handle response formatting, if we do it at all. And there has been discussion internally about the possibility of formatting responses as XML, JSON, JSONP, etc, from model results, but no firm decision made just yet. |
I see. Wouldn't it be best to use constants or static variables for the codes? But in any case, I'm excited for the final decision. |
This trait would provide a standardized way to respond from controllers when creating an API. The primary benefits are 2-fold:
[NEEDS MORE INFO]
Development Checklist:
The text was updated successfully, but these errors were encountered: