Management method, system and equipment for API (Application Program Interface)
By automatically registering APIs in the API management system, the problem of inefficient addition of APIs on the existing API platform is solved, and automated registration is realized, improving efficiency and saving labor costs.
Patent Information
- Application Number
- CN202311134883.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
AI Technical Summary
The existing API platform is inefficient when adding APIs, requires manual input, and wastes human resources.
By implementing the API management method, the API document of the target API is obtained based on the preset document address, the routing-related information is obtained, and the target API is registered in the API management system.
The automated registration of the target API has been achieved, improving efficiency and saving labor costs.
Smart Images

Figure CN119561985A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a management technology for API. Background Art
[0002] As the company's business develops, more and more APIs need to be opened to third-party calls, and at the same time, the interface data of third parties needs to be called. For this purpose, it is necessary to develop a highly reusable and standard API platform. The current API platform generally adds APIs through manual input, which is inefficient and wastes human resources. Summary of the invention
[0003] The purpose of this application is to provide a management method, system and device for API.
[0004] According to one aspect of the present application, a method for managing an API is provided, wherein the management method is implemented by:
[0005] Obtain API documents corresponding to one or more target APIs based on a preset document address;
[0006] Acquire routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs;
[0007] One or more target APIs are registered in the API management system based on the routing related information corresponding to each target API.
[0008] Optionally, the method further comprises:
[0009] Obtaining system data of each target API, wherein the system data includes at least one of domain management, region management, and parameter model management;
[0010] The registering of one or more target APIs in the API management system based on the routing related information corresponding to each target API includes: registering one or more target APIs in the API management system based on the routing related information corresponding to each target API and the system data.
[0011] Optionally, the acquiring routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs includes:
[0012] Based on the preset registration requirement information, matching is performed in the API documents corresponding to the one or more target APIs to obtain the routing related information corresponding to each target API.
[0013] Optionally, the method further comprises:
[0014] Determine cloud addresses corresponding to one or more cloud environments;
[0015] The registered target API is published to gateways corresponding to the one or more cloud environments based on the cloud address.
[0016] Optionally, the method further comprises:
[0017] Acquire attribute identification information about a registered target API based on the API management system;
[0018] Querying gateway call record information of the target API based on the attribute identification information of the target API;
[0019] The gateway call record information is presented to the API management system.
[0020] Optionally, the method further comprises:
[0021] The registered one or more target APIs are classified into an internal API list or an external API list based on preset rules.
[0022] Optionally, the method further comprises:
[0023] When the API management system receives an external request for a target API through an external gateway, the route of the target API is synchronized to the external gateway based on the external API list to implement a call to the target API.
[0024] According to another aspect of the present application, an API management system is also provided, wherein the system includes:
[0025] A document module is used to obtain API documents corresponding to one or more target APIs based on a preset document address;
[0026] A routing module, used to obtain routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs;
[0027] The registration module is used to register one or more target APIs in the API management system based on the routing related information corresponding to each target API.
[0028] According to another aspect of the present application, a computer-readable medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the operations of the aforementioned method.
[0029] Compared with the prior art, this application obtains the API documents corresponding to one or more target APIs based on the preset document address, obtains the route-related information corresponding to each target API based on the API documents corresponding to the one or more target APIs, and then registers the one or more target APIs in the API management system based on the route-related information corresponding to each target API. In this way, the automatic registration of the target API is realized, the efficiency is improved, and the labor cost is saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0031] Figure 1 A flow chart of a method for managing an API according to one aspect of the present application is shown;
[0032] Figure 2 A schematic diagram of a management system for API according to another aspect of the present application is shown.
[0033] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0034] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0035] In a typical configuration of the present application, the terminal, the device of the service network and the trusted party all include one or more processors (CPU), input / output interfaces, network interfaces and memories.
[0036] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0037] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory media such as modulated data signals and carrier waves.
[0038] In order to further illustrate the technical means adopted by the present application and the effects achieved, the technical solution of the present application is clearly and completely described below in combination with the accompanying drawings and preferred embodiments.
[0039] Figure 1 A flow chart of a management method for an API according to one aspect of the present application is shown, wherein the management method is implemented by an API management system 1, and the method includes:
[0040] S11 obtains API documents corresponding to one or more target APIs based on a preset document address;
[0041] S12 obtains routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs;
[0042] S13 implements registration of one or more target APIs in the API management system based on the routing related information corresponding to each target API.
[0043] In this embodiment, in step S11, one or more API documents corresponding to the target API are obtained based on the preset document address. Here, the preset document address can be one or more addresses, and each address has one or more API documents corresponding to the target API. Specifically, when the API management system receives a trigger instruction, one or more API documents of the preset document address can be automatically obtained.
[0044] Continuing in this embodiment, in step S12, the route related information corresponding to each target API is obtained based on the API documents corresponding to the one or more target APIs. Here, the route related information includes but is not limited to the request parameters, response parameters, basic route information, exception information, etc. of the API.
[0045] Preferably, the step S12 comprises:
[0046] Based on the preset registration requirement information, matching is performed in the API documents corresponding to the one or more target APIs to obtain the routing related information corresponding to each target API. Here, the registration requirement information includes the information required to register the target API, and the registration requirement information is recorded in the API document, including the routing related information corresponding to the target API. Specifically, the routing related information can be determined by keyword matching, or the routing related information can be recorded based on a preset format when the API document is generated, and the API management system can determine the routing related information according to the preset format.
[0047] Continuing in this embodiment, in step S13, one or more target APIs are registered in the API management system based on the routing related information corresponding to each target API. Here, the API management system has pre-set the routing related information required to register the target API, so the acquired routing related information of the target API can be automatically filled into the corresponding position of the API management system.
[0048] Preferably, the method further comprises:
[0049] Obtaining system data of each target API, wherein the system data includes at least one of domain management, region management, and parameter model management;
[0050] The step S13 includes: registering one or more target APIs in the API management system based on the routing related information corresponding to each target API and the system data.
[0051] In this embodiment, in step S13, when completing the registration of a target API, not only routing related information but also system data is required, and the system data includes but is not limited to domain management, regional management, parameter model management, etc. Here, the domain management includes but is not limited to the setting of data permissions, regional management includes but is not limited to the management of multi-cloud environments, and parameter model management includes the management of model objects, for example, including but not limited to object parameters such as user names and mobile phone numbers. Here, the above system data is only for example and is not specifically limited.
[0052] Preferably, the method further includes: S14 determining a cloud address corresponding to one or more cloud environments; S15 publishing the registered target API to a gateway corresponding to the one or more cloud environments based on the cloud address.
[0053] In this embodiment, the method can realize the release or deployment of one or more target APIs in multiple cloud environments. Specifically, in step S14, the cloud addresses corresponding to one or more cloud environments are obtained, and then based on the cloud addresses, the one or more target APIs are released to the gateways corresponding to the one or more cloud environments. In this way, the target API can be released to multiple cloud environments at the same time, thereby improving the release efficiency.
[0054] Preferably, the method further comprises:
[0055] S16: acquiring attribute identification information about a registered target API based on the API management system;
[0056] S17 queries the gateway call record information of the target API based on the attribute identification information of the target API;
[0057] S18 presents the gateway call record information to the API management system.
[0058] In this embodiment, the query and presentation of the target API's gateway call record information can be realized. Specifically, the querying user can input the attribute identification information of the target API to be queried in the API management system. After the API management system obtains the attribute identification information, it queries the target API's gateway call record information based on the attribute identification information, and presents the gateway call record information to the API management system. Furthermore, the call flow link information of the target API can be comprehensively analyzed through the gateway call record information to facilitate system problem troubleshooting and analysis.
[0059] Preferably, the method further comprises: classifying the registered one or more target APIs into an internal API list or an external API list based on preset rules. In this embodiment, permissions can be set for API calls. Some APIs can only be called within the enterprise and can be added to the internal API list. APIs that can be called externally can be classified into the external API list.
[0060] Furthermore, the method further includes: when the API management system receives an external request for a target API through an external gateway, synchronizing the route of the target API to the external gateway based on the external API list to implement a call to the target API.
[0061] In this embodiment, when an external request calls a target API, the API management system receives the external request about the target API through the external gateway, and then queries the external API list. When the target API is in the external API list, the route of the target API is synchronized to the external gateway based on the external API list to implement the call to the target API. If it is not in the external API list, the external request is rejected.
[0062] Compared with the prior art, this application obtains the API documents corresponding to one or more target APIs based on the preset document address, obtains the route-related information corresponding to each target API based on the API documents corresponding to the one or more target APIs, and then registers the one or more target APIs in the API management system based on the route-related information corresponding to each target API. In this way, the automatic registration of the target API is realized, the efficiency is improved, and the labor cost is saved.
[0063] In addition, an embodiment of the present application also provides a computer-readable medium on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the aforementioned method.
[0064] The embodiment of the present application further provides a management device for an API, wherein the device includes:
[0065] one or more processors; and
[0066] A memory storing computer readable instructions which, when executed, cause the processor to perform the operations of the aforementioned method.
[0067] For example, when the computer-readable instructions are executed, the one or more processors: obtain API documents corresponding to one or more target APIs based on a preset document address; obtain routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs; and register one or more target APIs in the API management system based on the routing related information corresponding to each target API.
[0068] Figure 2 A schematic diagram of a management system for API according to another aspect of the present application is shown, wherein the system 1 comprises:
[0069] A document module 11 is used to obtain API documents corresponding to one or more target APIs based on a preset document address;
[0070] A routing module 12, configured to obtain routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs;
[0071] The registration module 13 is used to register one or more target APIs in the API management system based on the routing related information corresponding to each target API.
[0072] In this embodiment, the document module obtains API documents corresponding to one or more target APIs based on a preset document address. Here, the preset document address can be one or more addresses, and each address has one or more API documents corresponding to one or more target APIs. Specifically, when the API management system receives a trigger instruction, it can automatically obtain one or more API documents at the preset document address.
[0073] Continuing in this embodiment, the routing module obtains routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs. Here, the routing related information includes but is not limited to API request parameters, response parameters, basic routing information, exception information, etc.
[0074] Continuing in this embodiment, the registration module implements registration of one or more target APIs in the API management system based on the routing related information corresponding to each target API. Here, the routing related information required for registering the target API is pre-set in the API management system, so the acquired routing related information of the target API can be automatically filled into the corresponding position of the API management system.
[0075] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
Claims
1. A method for managing an API, wherein: The management method is implemented through an API management system, and the method includes: Obtain API documents corresponding to one or more target APIs based on a preset document address; Acquire routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs; One or more target APIs are registered in the API management system based on the routing related information corresponding to each target API.
2. The method according to claim 1, wherein: The method further comprises: Obtaining system data of each target API, wherein the system data includes at least one of domain management, region management, and parameter model management; The registering of one or more target APIs in the API management system based on the routing related information corresponding to each target API includes: registering one or more target APIs in the API management system based on the routing related information corresponding to each target API and the system data.
3. The method according to claim 1 or 2, wherein: The acquiring of routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs includes: Based on the preset registration requirement information, matching is performed in the API documents corresponding to the one or more target APIs to obtain the routing related information corresponding to each target API.
4. The method according to claim 1, wherein: The method further comprises: Determine cloud addresses corresponding to one or more cloud environments; The registered target API is published to gateways corresponding to the one or more cloud environments based on the cloud address.
5. The method according to claim 1, wherein: The method further comprises: Acquire attribute identification information about a registered target API based on the API management system; Querying gateway call record information of the target API based on the attribute identification information of the target API; The gateway call record information is presented to the API management system.
6. The method according to claim 1, wherein: The method further comprises: The registered one or more target APIs are classified into an internal API list or an external API list based on preset rules.
7. The method according to claim 6, wherein: The method further comprises: When the API management system receives an external request for a target API through an external gateway, the route of the target API is synchronized to the external gateway based on the external API list to implement a call to the target API.
8. An API management system, wherein: The system includes: A document module is used to obtain API documents corresponding to one or more target APIs based on a preset document address; A routing module, used to obtain routing related information corresponding to each target API based on the API documents corresponding to the one or more target APIs; The registration module is used to register one or more target APIs in the API management system based on the routing related information corresponding to each target API.
9. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 7.
10. A management device for an API, wherein: The equipment includes: one or more processors; and A memory storing computer readable instructions which, when executed, cause the processor to perform the operations of the method as claimed in any one of claims 1 to 7.