Question 1:
Dingo/api How to set the contents of the global return, such as the return field of success or not Status_code
DINGO/API, the default success is only the data field, no other fields;
Question 2:
Excuse me, dingo/api how to return XML or JSON based on the suffix name of the URL
Like what:
Http://api.server.dev/users.xml
Http://api.server.dev/users.json
========== 's Own solution ===========
About Question 2
Reply content:
Question 1:
Dingo/api How to set the contents of the global return, such as the return field of success or not Status_code
DINGO/API, the default success is only the data field, no other fields;
Question 2:
Excuse me, dingo/api how to return XML or JSON based on the suffix name of the URL
Like what:
Http://api.server.dev/users.xml
Http://api.server.dev/users.json
========== 's Own solution ===========
About Question 2
The first problem document says that you need to manually throw an exception class, http://laravelacademy.org/post/3842.html
or here: Https://github.com/dingo/api/wiki/Responses#responding-with-an-error
You should have asked the first question in the Laravel group, right? I didn't, but I didn't find you.
First of all, I didn't use DINGO/API, I'm sorry, but in my usual experience,
Problem one: At the same exit, all the returned data is in the same logic, so you can design your data structure in a global way.
Question two: At the same entrance, all requests go through the same portal to the interface data return structure (like your example, I can tell what kind of data return structure according to the URL suffix name), authentication, etc.
In essence, program design is to do the same entrance, the same exit
Problem one, no use, no understanding; question two, understanding the restful design pattern, TP's restful is to judge the return data type according to the URL suffix, XML, JSON, etc.