* Existing Problems
* Unified management implementation solution
* Example
# Existing problems ##
* Trend requirements
> As the company gradually approaches the SOA architecture, various systems collaborate with each other, and interface services emerge one after another, interface security, protocols, documents, maintenance, upgrade, monitoring, and other issues arise.
* Interface writing is not standard.
> Now, each project has its own external interface. The interface write locations are different, and annotations and documents are not available. Therefore, except for the contact person, no one knows where the interface is and how it is implemented, the call and return protocol, and the parameter specifications, so a single point is formed.
* The interface document is virtually empty.
> Interface Document management: This is a headache for all programmers. They do not want to write documents as human nature. Therefore, documents cannot keep up with interface changes, and documents become a decoration.
* Interface monitoring
> Fat, UAT, beta, and PRO are our current four environments, but there is no interface availability monitoring in each environment. After a problem occurs, we cannot identify the interface, debugging can only be performed in the program. Over time, the unimportant environment is ignored. This is also the reason why the fat and UAT environments of most companies are not easy to use.
# Unified management implementation solution ##
* Define unified interface specifications and security policies
1. http protocol
2. HTTP header Cache Policy (useful for wireless networks)
3. HTTP header defines the interface version.
4. Http heaer Cache Policy.
5. Encoding specifications for requests and responses.
6. unified response formats.
7. define security policies for different interfaces. (Whitelist, business policy, and unified signature)
* Interface writing specifications
1. start an api_center project. All services and verifiable interfaces are written in this project. For existing interfaces, you can access this project by forwarding requests, in this way, the unified location is visible and the unified location can be verified.
2. you do not need to contact the contact person. You only need to find the corresponding interface in the project, and the contact person does not need to directly access the interface service, you only need to ensure that the interface is available in different environments in this project, which greatly reduces the communication cost and Verification Cost.
* Configuration-based interface documentation
1. If you have an API in the api_center project or an API for forwarding this project, you must add your own configuration in the unified configuration file of this project. The configuration content is roughly as follows:
1. The protocol used by the interface.
2. Interface request address.
3. required parameters, parameter types, parameter encoding, optional parameters, and available instances by default.
4. Whether HTTP cache is required.
5. The interface return format (JSON, XML, string) should be JSON as much as possible
6. Interface Name
7. Interface Description
The advantage of this is that it saves the hassle of writing interface documents, and documents will always be up-to-date as long as the program is available.
# Example ##
1. This example is an interface management program that I made in my previous company. The client programmers no longer come to our server to ask for interface documentation, and they can see whether the interfaces are healthy.
650) This. width = 650; "src =" http://home.51cto.com/thumb.php? W = 600 & H = 600 & t = F & url = http://s3.51cto.com/wyfs02/M00/47/1E/wKioL1P27NCh8KC2AAKZoTby66Q525.jpg "width =" 600 "Height =" 250 "alt =" wkiol1p27nch8kc2aakzotby66q525.jpg "/>
650) This. width = 650; "src =" http://home.51cto.com/thumb.php? W = 600 & H = 600 & t = F & url = http://s3.51cto.com/wyfs02/M02/47/1E/wKioL1P27NCTOmqvAAHWrhcDkYE049.jpg "width =" 600 "Height =" 438 "alt =" wkiol1p27nctomqvaahwrhcdkye049.jpg "/>
This article is from the "architecture technology Digest" blog, please be sure to keep this source http://wufaliang.blog.51cto.com/3160882/1543586
Unified interface management ideas