API Help various software products work together . meanwhile API It's also software , Provide communication or interaction between other software components or systems , Every API There's a life cycle .
API Often plays an important role in iterative software development , The process is developing rapidly . Developers have to keep API The stability of , At the same time, the associated application needs to be updated and changed frequently . For depending on the API Software and services , Keep publishing API The new version of can be cumbersome .
API Life cycle
Although for API The actual part of the life cycle has different views , But this article uses five classic stages ： planning , Development , test , Deploy and phase out .
1. planning stage
whatever API Development projects have to start with planning and Design . Let business team members identify API What services and functions should be exposed . Document specific business requirements , And output to functional and non functional comprehensive requirements document .
establish API After demand , The development team can follow the naming rules , Architecture and specific protocols to be used , Make wise design decisions . Planning and design should produce a API standard , The specification describes the methods and operations supported by the interface and any technical constraints .
2. The development phase
API It can be written in a variety of programming languages , Include PHP,Python,Ruby,.NET,C＃,Java and Perl. Coding and testing may require multiple iterations , But the development team should not be in API Release it to production before stabilization . Final ,API Development requires good planning 、 Coding and testing functions , And minimize customer facing API Change the required principles .
API Development can be done by a single developer , But usually by an independent 、 A dedicated API The development team develops . Because it's a team effort , So multiple developers will need to collaborate to access and maintain their API. Whole API Teams should be able to see API Code 、 Documents and test files and interact with them . This is also important for full search and version control , It helps authorized developers to （ Such as project and version ） To locate API.
Besides , Multiple developers can create documents more easily , The test case , You can even create a business that uses public API Some marketing materials needed .
API The development plan should always focus on the following three considerations ：
How to track API Use , performance , Errors and other important indicators .
Security components , especially OAuth 2.0 Authorization and API Key verification .
Performance and accessibility issues , For example, throttling and rate limiting , To make sure there's enough API visit .
3. Testing phase
Developers must thoroughly test API The function of each iteration of 、 Performance and user acceptance . Testers can feed back unsatisfactory results to developers , Further build and improve API Code .
A functional test You can verify that each functional feature works as expected . Use models and test versions to evaluate against their specifications API The function of . Functional testing also emphasizes security and error handling capabilities , Make sure API Free from collapse or attack .
Performance testing assessment API Execution under load . many api Both are affected by unstable traffic and unpredictable load conditions . Performance measures API Performance under heavy load , For example, the time it takes to respond to an application request .
The acceptance test Can track API Usage situation , And judge whether it has achieved the expected business purpose . Acceptance testing can reveal business processes or API Any new requirements that may arise from a change in itself . It helps identify possible changes to existing functions , So that API More useful . for example , Data may be passed to API Or from API When it comes out , Acceptance testing can reveal the need to pass more or different data as parameters .
4. Deployment phase
When one API Stable and safe , You can put it into production . However , Like many software products ,API The initial version of may serve as the second phase of performance testing and validation .
for example , Developers may try to bring the latest version of API Apply to those that don't have the latest version API Environment , In this environment , Developers can try to use the latest version of the software without affecting the real-time version API edition . Ideally , When developers are ready for the latest version , The API It can be used in a complete production environment . A key part of this process is the collection trace API Performance indicators , For example, the number of errors it encountered .
Developers have to put new API The disruption caused by the version is minimized . Well written API It should include a version call function , This function can retrieve known good versions , In order to put into production when the new version is not suitable .
Fixing errors or improving performance API Changes usually do not affect API Call and respond . however , New parameters and parameters for authentication , Or other basic design changes , May force users to access new API Perform software update before release .
5. Retirement stage
Developers can expand and update over time API To increase business value , But over time , Every API Will increase infrastructure and support costs . Final , The software team eliminated the old API And the old version of API.
therefore , Enterprises need to plan carefully from a API Version to another API Version migration path , And learn to maintain more than one at a time while optimizing the new version API edition . Software teams need a plan to end their life cycle , In order to stop using without seriously affecting daily operation API.
Monitoring is an important part of the exit process , Especially tracking API The age and history of . for example , A company may find some API already 90 to 120 It's almost never been used . however , They are still hosted in the infrastructure , Consume resources and generate costs . That's why you're following these API Is an effective API An important part of a retirement plan .
This article is used for internal training of the company , With the help of EOLINKER API Management tools to display , At present, the company uses EOLINKER Conduct API Manage and automate testing , Welcome interested friends to communicate with me ！