Just to a new company, the company's project is mainly to do the app, the data on the app is mainly through the call of the Web backend data interface, but has never been exposed to the interface, the previous thing is to write in the Web spooler code, and then displayed on the page, Now suddenly I touch the interface really do not know how to do.
I want to ask is, write interface is not first in the web background to the corresponding module function, in for him to write an interface and then responsible for the development of the app, directly call this interface, from the database fetch data? "Is that the way it works?"
than on: I want to write an update bulletin, security dynamic interface, is not first in the web background to the two module function to make, and then to their respective write an interface ah? If this is the case, write the interface according to what you need to use the data or parameters. What is the format?
Reply content:
Just to a new company, the company's project is mainly to do the app, the data on the app is mainly through the call of the Web backend data interface, but has never been exposed to the interface, the previous thing is to write in the Web spooler code, and then displayed on the page, Now suddenly I touch the interface really do not know how to do.
I want to ask is, write interface is not first in the web background to the corresponding module function, in for him to write an interface and then responsible for the development of the app, directly call this interface, from the database fetch data? "Is that the way it works?"
than on: I want to write an update bulletin, security dynamic interface, is not first in the web background to the two module function to make, and then to their respective write an interface ah? If this is the case, write the interface according to what you need to use the data or parameters. What is the format?
Thank you for inviting me. Very simple, you can use the pretext as a normal page request, or the usual page of the form request, the difference is that the data on the usual page needs you to query out after rendering to the view file through the browser display to the user. And the interface is based on different criteria query, insert, UPDATE, delete. The final result is then returned to the client in the Json
xml
form of data or format.
The calling interface should have an interface document, which is roughly the following:
Address of the Account interface
Parameters of the interface
The status code returned by the interface and the data format
Or go straight to the code!
First call the interface:
Then the code for the interface:
This is a project in our project called the data in another project, which I wrote originally (should also have unreasonable place, such as authentication request IP, etc.) probably should be like this. Fetch interface data successfully or unsuccessfully returns a recognized status code, such as what I'm using here status
. And my return is generally JSON-formatted, front-end and back-end invocation of parsing.
(As for why you should pass the name instead of the ID, because the two project data table usernames are the same but the IDs are different.) ~ Don't care too much about details)