Application program interface management and control method and device, computing equipment and readable storage medium
By introducing management and control modules into the API gateway and directly issuing API control rules, the problems of low complexity and flexibility of existing API gateway management are solved, and efficient and accurate API management and multi-functional expansion are achieved.
Patent Information
- Application Number
- CN202411272164.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-13
AI Technical Summary
The management and control methods of existing API gateways are complex and have low flexibility, making it difficult to meet multifunctional needs, affecting the normal use of applications and the management and control efficiency of APIs.
The management and control module is introduced into the API gateway, which receives the API configuration information of the backend server, generates and issues API control rules, and directly controls the API gateway for management and control, avoids modifying configuration files and restarting, and realizes fine-grained management of the API.
It simplifies the API management method, improves flexibility and control accuracy, improves the management efficiency of the API, and supports extended functions such as account authentication, permission authentication and traffic management.
Smart Images

Figure CN119135529A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular to an application program interface management method, as well as an application program interface management apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of computer technology, various applications are widely used by users. Applications can be installed on the user's terminal device. When running the application, the terminal device usually needs to communicate with the corresponding server, access the application program interface (API) on the server, and use the corresponding services of each API to provide support for the implementation of various functions of the application.
[0003] After the application is released, its functions need to be continuously updated and improved, and accordingly, the API of the application on the server needs to be updated. Currently, an API gateway can be connected between the terminal device and the server, and the API gateway is used to manage and control the APIs on the server. For example, when the access method of the API of an application on the server is updated, the configuration file of the API gateway needs to be modified, and then the API gateway with the modified configuration file is restarted, so that the API gateway can control the API on the server based on the modified configuration file.
[0004] However, the API control method in this way is more complicated and has low control flexibility. Summary of the invention
[0005] The embodiments of this specification provide an application program interface management method, which can simplify the management method for API in the server and improve the management flexibility of API. One or more embodiments of this specification also involve an application program interface management device, a computing device, a computer-readable storage medium and a computer program product.
[0006] According to one aspect of an embodiment of this specification, an application program interface management method is provided, which is applied to a management module of an application program interface API gateway, wherein the API gateway connects a terminal device and a backend server, and the backend server includes an API corresponding to an application installed in the terminal device, and the method includes:
[0007] Receiving configuration information for an API corresponding to a target application in the backend server;
[0008] Based on the configuration information, sending API control rules for the target application to the API gateway;
[0009] The API gateway is controlled to manage the API corresponding to the target application based on the API management and control rules.
[0010] According to another aspect of an embodiment of the present specification, an application program interface control device is provided, which is applied to a control module of an application program interface API gateway, wherein the API gateway connects a terminal device and a backend server, wherein the backend server includes an API corresponding to an application program installed in the terminal device, and the application program interface control device includes:
[0011] A receiving module, used to receive configuration information of an API corresponding to a target application in the back-end server;
[0012] A sending module, used to send API control rules for the target application to the API gateway based on the configuration information;
[0013] The control module is used to control the API gateway to control the API corresponding to the target application based on the API control rules.
[0014] According to another aspect of the embodiments of this specification, there is provided a computing device, including: a memory and a processor;
[0015] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above method are implemented.
[0016] According to another aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and the steps of the above method are implemented when the computer program / instruction is executed by a processor.
[0017] According to another aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, and when the computer program / instruction in the computer program product is executed in a processor, the steps of the above method are implemented.
[0018] In one embodiment of the present specification, a control module is set for the API gateway between the client and the back-end server, and the API corresponding to the target application in the back-end server is configured through the control module, so that the API gateway processes the API access request for the target application according to the corresponding API access rules. By setting up the control module of the API gateway in this way, the corresponding control rules can be directly issued to the API gateway through the control module, without modifying the configuration file of the API gateway and restarting it. This can simplify the control method for the API in the server and improve the flexibility of API control. In addition, it is possible to implement control of each API in the application dimension with high control accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flow chart of an application program interface management method provided by an embodiment of this specification;
[0020] Figure 2 It is a schematic diagram of an API configuration page provided in an embodiment of this specification;
[0021] Figure 3 It is a structural diagram of an application program interface control device provided by an embodiment of this specification;
[0022] Figure 4 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0023] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0024] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items. The term "at least one" in one or more embodiments of this specification refers to "one or more", and "multiple" refers to "two or more". The term "including" is an open description and should be understood as "including but not limited to", and may include other content on the basis of the content already described.
[0025] It should be understood that although the terms "first", "second", etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, "first" may also be referred to as "second", and similarly, "second" may also be referred to as "first". Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0026] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant standards and requirements, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0027] At present, there are more and more applications for realizing various functions, and the requirements for the use effect of applications are getting higher and higher. Applications can be installed in terminal devices, and applications can also correspond to back-end servers, which are used to provide support for the normal operation of applications. For example, the back-end server can execute data processing processes that require large computing resources, and the terminal device can send the data to be processed to the back-end server for processing through the application, and obtain the processing results. Different terminal devices can also realize information exchange through the back-end server, such as information transmission between different users of instant messaging applications through the back-end server. The back-end server can also connect different types of devices so that users can obtain data from other devices or the Internet through terminal devices. For example, the back-end server corresponding to the news application can obtain news published on the Internet and send it to each terminal device where the application is installed.
[0028] The backend server can be set up with multiple application programming interfaces (APIs), and different APIs can correspond to different functions of the application. When a user needs to use a function of an application, he can trigger the terminal device to call the API corresponding to the function in the server, so that the backend server runs the service corresponding to the API to support the implementation of the function. The control of the API in the backend server will affect the operation of the application, so effective control of the API is crucial.
[0029] An API gateway can be connected between the terminal device and the backend server, and the API gateway controls the APIs on the backend server. For example, the API gateway can manage the accessible scope of the API, so that the API is set in the whitelist and is open to the public network (it can also be called whitelisting the API), so that any terminal device can access the API; it can also make the API only open to the set intranet or the office network. In the method of using nginx as the API gateway, the management method of the API is written in its configuration file. If you want to change the access method of the API, you need to directly modify the configuration file of the API gateway, and then restart the API gateway to make the modified configuration file effective. Because the format of the configuration file is relatively complex, this API control method is more complex when adjusting, and the control flexibility is relatively low. During the restart of the API gateway, the APIs it controls cannot be normally accessed by the terminal device, which will have a certain impact on the normal use of the application, resulting in poor control effect. Using this method, when there are multiple API control methods that need to be adjusted, the configuration file is modified together, so the control efficiency of the API is low. Moreover, this method has weak scalability and is difficult to meet the multi-functional requirements of the API gateway.
[0030] The embodiments of this specification provide an application interface management method, which can simplify the management method for APIs in servers, improve the flexibility of API management, improve the efficiency of API management, and ensure the multifunctional expansion of API gateways. This specification also relates to an application interface management device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments. The application interface management method can be executed by the application interface management device or computing device, such as the application interface management device and computing device can be a server-side device, or can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0031] The application interface management method provided in the embodiments of this specification can be applied to the management module of the API gateway. The management module can be integrated with the API gateway, such as integrated into a server or a server cluster; or it can be independent, such as the management module and the API gateway are two connected servers or server clusters, or the management module can also be a terminal device, which is not limited here. The API gateway connects the terminal device and the back-end server. The back-end server includes an API corresponding to the application installed in the terminal device. Different functions of the application can correspond to different APIs in the back-end server. Each API corresponds to one or more services. By accessing the API, the corresponding service can be called to support the application to implement the corresponding function.
[0032] In the embodiments of this specification, the back-end server can be a server cluster, and the back-end server can correspond to multiple applications, wherein APIs corresponding to multiple applications can be provided, or it can correspond to only one application, which is not limited here. The API gateway can connect all terminal devices installed with any of the multiple applications. The control module in the embodiments of this specification can actually be a group of control modules composed of multiple control modules, and the API gateway can also be a group of API gateways composed of multiple API gateways. In some embodiments, Traefik can be used as an API gateway in the embodiments of this specification. Traefik is a modern HTTP reverse proxy and load balancing tool that can support configuration hot updates, API-granular account authentication, authorization, current limiting and observability and other functions.
[0033] Figure 1 is a flow chart of an application program interface management method provided in an embodiment of this specification, such as Figure 1 As shown, the application interface management method includes the following steps 102 to 106.
[0034] Step 102: Receive configuration information for the API corresponding to the target application in the backend server.
[0035] Business personnel can use the control module to control the API gateway. The control of the API gateway is equivalent to the control of the API set on the backend server. The control module can have a display function. For example, the control module includes a display screen. Business personnel can trigger the control module to display the control page for the API gateway, and then input the control information for the API gateway through the control page, so that the control module can control the API gateway accordingly based on the control information.
[0036] In the embodiments of this specification, the control module can control the API in the application dimension, that is, to control the API corresponding to each application in the backend server. For example, the control module can input unified configuration information for each API corresponding to an application to implement the control of the API based on the configuration information. In the embodiments of this specification, the control module can also specify one or more APIs for the application to directly input the corresponding configuration information for the specified API to control the specified API based on the configuration information. In this way, the control granularity can be further reduced and the control accuracy can be improved.
[0037] The embodiments of this specification are described by taking the control of the API corresponding to the target application in the backend server as an example. For the API control methods of other applications, you can refer to the relevant introduction of the target application. Optionally, the control of the APIs of different applications can be carried out at the same time, such as inputting the configuration information of the APIs corresponding to multiple applications to the control module at the same time, so as to control the corresponding APIs separately based on the configuration information of each API.
[0038] In some embodiments, step 102 may include the following steps: displaying an API configuration page, wherein the API configuration page includes an API information upload area and operation controls for the API; and obtaining API configuration information for the target application in the backend server based on the information entered in the API configuration page.
[0039] Figure 2 Schematic diagram of an API configuration page provided in an embodiment of this specification. Figure 2 As shown, the API configuration page can refer to the aforementioned management and control page for the API gateway. The box where "Configuration Information" is located in the API configuration page can refer to the API information upload area, and the "Delete", "Add API" and "Confirm" controls can all be operation controls for the API, and different operation controls correspond to different operations on the API.
[0040] For example, the business personnel can select the target application from the applications corresponding to the backend server in the box where "Application" is located on the API configuration page, and then trigger the box where "API" is located to trigger the API configuration page to display the APIs that have been set for the target application in the backend server (such as A, B and C are all set APIs), as shown below, the set APIs are referred to as existing APIs. The business personnel can select any existing API, and then enter the configuration information for the selected API in the box where "Configuration Information" is located.
[0041] As another example, a corresponding "Delete" control is displayed after each existing API, and the business personnel can also click the "Delete" control corresponding to any existing API, which is equivalent to entering configuration information for the existing API in the configuration page, and the configuration information indicates the deletion of the API. As another example, the business personnel can click the "Add API" control and enter the name of the newly added API in the box where "API" is located, and can also enter configuration information for the newly added API in the box where "Configuration Information" is located, which is equivalent to indicating the addition of a new API in the configuration page and entering configuration information for the newly added API.
[0042] In the embodiments of this specification, the configuration information for the API may indicate the addition, deletion or modification of the API. In some embodiments, the configuration information includes at least one of the following: prohibition information of existing APIs, release information of new APIs, access condition information of APIs, access flow restriction information of APIs, and domain name information corresponding to the APIs.
[0043] The prohibition of access to an existing API is equivalent to deleting the API, and accordingly can also indicate that the corresponding function of the API in the target application is unavailable. When an API is prohibited from access, the terminal device can no longer implement the function corresponding to the API. For example, if Figure 2 The "Delete" control displayed after clicking an existing API in the API configuration page shown can be considered as inputting the access prohibition information of the existing API into the management and control module.
[0044] The configuration information for the newly added API may include the release information of the newly added API, which may include the path information of the newly added API, the corresponding function information and the corresponding backend service information (such as the name), as well as the creation instruction of the API. Figure 2 After clicking the "Add API" control in the API configuration page shown, you can enter the path information, corresponding function name and corresponding backend service name of the newly added API in the box where the "Configuration Information" is located, and then click the "Confirm" control to trigger the control module to perform API control based on the input configuration information for the newly added API. For example, the control module is triggered to control the API gateway to publish the newly added API on the backend server, and set the access path and the corresponding relationship with the service for the API, so that the API can be accessed based on the specified path to call the specified service on the backend server to implement the specified function.
[0045] The access condition information of an API can be for an existing API or a newly added API. For example, when a business person selects an existing API, the configuration information of the existing API can be changed, such as re-entering the access condition information as the configuration information to change the original access condition information of the API. Optionally, the original access condition information of the existing API can also be displayed in the API configuration page, and the business person can make changes based on the original access condition information to implement the input of the access condition information. When a business person chooses to add a new API, the access condition information corresponding to the newly added API can be directly entered.
[0046] The access condition information of the API in the embodiments of this specification may include the customer range facing the API, such as the customer range can be a public network range, an office network range or an intranet range. The access condition information may also include whether account authentication is required for access to the API, and if account authentication is required, the account permission information required for access to the API. The account authentication refers to logging into a user account in the target application. Different user accounts may have different account permissions based on different identity information. For example, if the terminal device cannot access the API for viewing points without account authentication (such as not logging into any user account), it can access the API to view the points under the account after account authentication. The terminal device can obtain specific types of information by accessing an API based on a VIP user account, but cannot access the API based on an ordinary user account.
[0047] The service corresponding to each API can process a limited number of requests in parallel. If too many requests are processed, the processing efficiency will be affected, resulting in poor feedback efficiency of the application. Business personnel can set access flow limit information for each API to specify the maximum number of requests that the API can process. The access flow limit information can be used by the API gateway to decide whether to continue forwarding access requests to the API.
[0048] Different APIs corresponding to the same application can correspond to the same domain name, or they can correspond to different domain names. In some cases, APIs corresponding to different applications can also correspond to the same domain name. The API gateway can preliminarily determine the API scope for the received API access request by monitoring the domain name.
[0049] In some cases, the API corresponding to the target application in the backend server may be reconfigured to respond to updates to the target application. For example, when a new version of the target application is released, the API corresponding to the target application may be reconfigured.
[0050] Step 104: Based on the configuration information, send API control rules for the target application to the API gateway.
[0051] In the embodiments of this specification, the API on the back-end server needs to be actually managed and controlled through the API gateway. After obtaining the configuration information of the API corresponding to the target application, the management and control module can control the API gateway based on the configuration information and instruct the API gateway to perform corresponding actions to achieve actual management and control of the API on the back-end server. The management and control module can serve as the control plane in the network layer, responsible for configuration changes to the API gateway; the API gateway can serve as the data plane in the network layer, responsible for traffic forwarding from received requests to the API. The API gateway can also perform load balancing based on the received requests to determine the specific service in the back-end server to handle each request.
[0052] The API gateway needs to perform API control based on API control rules in a specific format. The control module can convert the configuration information into API control rules corresponding to the API gateway and send them to the API gateway. Figure 2 After entering the configuration information in the API configuration page shown, the business personnel can click the "Confirm" control to trigger the control module to convert the received configuration information into API control rules and send them to the API gateway.
[0053] In some implementations, the control module may generate API control rules for the target application based on the configuration information and the information format supported and recognized by the API gateway, and send the API control rules to the API gateway.
[0054] The control module can obtain the information format supported by the API gateway, which can be information pre-set for the API gateway. After obtaining the configuration information of the API corresponding to the target application, the control module can convert the configuration information into the information format supported by the API gateway to obtain the API control rules for the target application.
[0055] In some embodiments, the control module can assemble the configuration information and the network address information corresponding to the target application in the backend server in an information format supported and recognized by the API gateway to obtain API control rules for the target application. The network address information can be obtained based on the configuration management database (CMDB, Configuration Management Database). For example, the service corresponding to the target application can be deployed in one or more sub-servers in the backend server, and the network address information corresponding to the target application in the backend server can include the Internet Protocol (IP, Internet Protocol) address information of the one or more sub-servers. If the information format supported and recognized by the API gateway includes: domain name plus API path plus network address information, the control module can obtain the information required in the information format, convert the obtained configuration information into an API path, and then assemble each information according to the information format to obtain the API control rules for the target application. When the target application is a containerized application, its corresponding network address information in the backend server will change dynamically, and the information in the API control rules generated by the control module can also be adjusted dynamically.
[0056] Step 106: Control the API gateway to manage the API corresponding to the target application based on the API management and control rules.
[0057] After receiving the API control rules, the API gateway can identify the API access policy from the API control rules. For example, the access policy for an API is to only support account access with specific permissions, and the maximum access request volume is the target threshold.
[0058] In some embodiments, the management and control module can control the API gateway to adjust the effectiveness status of each API access policy for the target application based on the API management rules, and manage the API corresponding to the target application based on the effective API access policy, and process the API access request for the target application.
[0059] After reconfiguring the API corresponding to the target application to obtain a new access policy, the API gateway may not directly delete the access policies historically configured for each API, but change the effective status of each access policy, set the newly configured access policy to effective, and set the historically configured access policy to invalid. The API gateway controls the API corresponding to the target application based on the currently effective API access policy. The API gateway controls the API based on a certain access policy, that is, it processes the received access requests for the API according to the access policy. In this process, the API gateway can perform operations such as account authentication, permission identification, and traffic restriction.
[0060] For example, the access policy for a certain API is to support access only by accounts with specific permissions, and the maximum number of access requests is the target threshold. When the API gateway receives an access request for the API, it needs to determine whether an account with the specific permission is logged in on the terminal device that sends the access request, and determine whether the current number of access requests for the API has reached the target threshold. If it is determined that an account with the specific permission is logged in on the terminal device, and the current number of access requests for the API does not exceed the target threshold, the access request is sent to the API for processing. If the current number of access requests for the API exceeds the target threshold, a current limiting operation can be performed to prohibit the access request from being sent to the API for processing.
[0061] Optionally, when reconfiguring the API, if the reconfigured access policy is the same as a historically configured access policy, the historically configured access policy can be directly set to take effect again. This eliminates the need to re-enter configuration information, convert control rules, etc., which can simplify the access policy generation process and improve the efficiency of API control.
[0062] In some implementations, some APIs can only support access by terminal devices that have logged in user accounts, and the API gateway can perform account authentication operations for the API, and only send the corresponding access request to the API for processing if the account authentication is successful. Accordingly, the method provided in the embodiments of this specification may include: for an access request to a first API with authentication requirements, controlling the API gateway to send the access request to the first API for processing if the account information is obtained from the terminal device that sends the access request.
[0063] The authentication requirement information of the first API can be input as configuration information by the business personnel through the management and control module, and then instruct the API gateway to perform corresponding management and control. When the API gateway receives an access request for the first API, it can obtain account information from the terminal device that sends the access request. When the account information is obtained, it can be considered that the user account is logged in on the terminal device, and then the access request is sent to the first API for processing, and the request processing result is obtained and fed back to the terminal device. If the account information can be carried in the access request, if the account information is not carried in the access request, it can be considered that the terminal device is not logged in to the user account, and then information prompting it to log in to the user account can be sent to the terminal device.
[0064] In some implementations, some APIs can only support access by terminal devices with certain operating permissions, and the API gateway can perform permission authentication operations on the API, and only send the corresponding access request to the API for processing if the permission authentication passes. Accordingly, the method provided in the embodiments of this specification may include: for an access request to a second API with operating permission restrictions, controlling the API gateway to send the access request to the second API for processing if it is determined that the terminal device sending the access request has the operating permission of the second API.
[0065] The operation permission restriction information of the second API can be input as configuration information by business personnel through the management and control module, and then instruct the API gateway to perform corresponding management and control. When the API gateway receives an access request for the second API, it can obtain account information from the terminal device that sends the access request, and determine whether the account corresponds to the operation permission required by the second API. In the case that the account corresponds to the operation permission required by the second API, the access request can be sent to the second API for processing, and the request processing result can be obtained and fed back to the terminal device. If the account does not correspond to the operation permission required by the second API, information can be sent to the terminal device to prompt that it does not have the permission.
[0066] In some implementations, there is a certain limit on the number of access requests that an API can support processing. Accordingly, the method provided in the embodiments of this specification may include: controlling the API gateway to count access requests for a third API with access traffic restrictions, and prohibiting access requests from being sent to the third API when the number of access requests being processed by the third API is greater than a threshold.
[0067] The access flow restriction information (such as the quantity threshold) of the third API can be input as configuration information by the business personnel through the management and control module, and then instruct the API gateway to perform corresponding management and control. Every time the API gateway receives an access request for the third API, it can determine whether the number of requests currently being processed by the third API is greater than the quantity threshold. In the case where the number of requests currently being processed by the third API is greater than the quantity threshold, the access request is sent to the third API for processing, and the request processing result is obtained and fed back to the terminal device. If the current number of access requests for the third API does not exceed the target threshold, a flow limiting operation can be performed to prohibit the access request from being sent to the third API for processing.
[0068] In some implementations, business personnel can also observe the overall information of the API gateway through the management and control module to observe the traffic information carried by the API gateway, determine the health of the API gateway and the request processing time of each API, etc. Accordingly, the method provided in the embodiment of this specification may include: when receiving an observation request for the API gateway, displaying an access information page, wherein the access information page includes the processing information of the access request for each API carried by the API gateway.
[0069] For example, an observation button can be displayed on the display page of the control module, and the business personnel can click the button to trigger the control module to receive an observation request for the API gateway. This can then trigger the control module to display an access information page, which displays the processing status of access requests for each API. For example, the request processing log of each API, access link information, etc. can be displayed.
[0070] In the embodiments of this specification, business personnel configure the configuration information of the API for the application in the control module. The control module can assemble the API control rules that can be recognized by the API gateway based on the configuration information and the application details of the target application (such as the network address of the server where the API is deployed), and send it to the API gateway. The API gateway manages the access requests of each API in real time according to the received API control rules. In this way, the API corresponding to the target application can be reconfigured without affecting the normal operation of the target application, ensuring a better API control effect. And fine-grained management can be performed on the API, which improves the management accuracy. In addition, it can also support extended functions such as account authentication, permission identification, current limiting management, and information visualization observation, which improves the flexibility of API control.
[0071] In summary, in the application interface management method provided in the embodiments of this specification, a management module is set for the API gateway between the client and the back-end server, and the API corresponding to the target application in the back-end server is configured through the management module, so that the API gateway processes the API access request for the target application according to the corresponding API access rules. By setting up the management module of the API gateway in this way, the corresponding management rules can be directly issued to the API gateway through the management module, without modifying the configuration file of the API gateway and restarting it. The management method for the API in the server can be simplified, and the flexibility of API management can be improved. In addition, it is possible to implement management and control of each API in the application dimension, with high management and control accuracy.
[0072] Corresponding to the above method embodiment, this specification also provides an application program interface control device embodiment, Figure 3FIG. 1 shows a schematic diagram of the structure of an application program interface control device provided by an embodiment of the present specification. Figure 3 As shown, the application interface control device includes:
[0073] The receiving module 302 is used to receive configuration information of the API corresponding to the target application in the backend server;
[0074] A sending module 304 is used to send API control rules for the target application to the API gateway based on the configuration information;
[0075] The control module 306 is used to control the API gateway to manage the API corresponding to the target application based on the API management rules.
[0076] Optionally, the receiving module 302 is used for:
[0077] Display the API configuration page, where the API configuration page includes an API information upload area and API operation controls;
[0078] Based on the information entered in the API configuration page, API configuration information for the target application in the backend server is obtained.
[0079] Optionally, the configuration information includes at least one of prohibited access information of existing APIs, publishing information of newly added APIs, access condition information of APIs, access traffic restriction information of APIs, and domain name information corresponding to the APIs.
[0080] Optionally, the sending module 304 is used to:
[0081] Based on the configuration information and the information format supported by the API gateway, generate API control rules for the target application and send the API control rules to the API gateway.
[0082] Optionally, the sending module 304 is used to:
[0083] The configuration information and the network address information corresponding to the target application in the backend server are assembled in an information format that the API gateway supports and recognizes to obtain API control rules for the target application.
[0084] Optionally, the control module 306 is used to:
[0085] The control API gateway adjusts the effectiveness of each API access policy for the target application based on the API control rules, and controls the API corresponding to the target application based on the effective API access policy, and processes the API access request for the target application.
[0086] Optionally, the application program interface control device provided in the embodiment of this specification further includes:
[0087] The first request sending module is used to control the API gateway to send the access request to the first API for processing when the account information is obtained from the terminal device sending the access request, in response to the access request of the first API with authentication requirements.
[0088] Optionally, the application program interface control device provided in the embodiment of this specification further includes:
[0089] The second request sending module is used to control the API gateway to send the access request to the second API for processing when it is determined that the terminal device sending the access request has the operation authority of the second API for the access request of the second API with operation authority restriction.
[0090] Optionally, the application program interface control device provided in the embodiment of this specification further includes:
[0091] The third request sending module is used to control the API gateway to count access requests for the third API with access traffic restrictions, and prohibit sending access requests to the third API when the number of access requests being processed by the third API is greater than a number threshold.
[0092] Optionally, the application program interface control device provided in the embodiment of this specification further includes:
[0093] The display module is used to display an access information page when an observation request for the API gateway is received, wherein the access information page includes processing information of access requests for each API carried by the API gateway.
[0094] In summary, in the application interface control device provided in the embodiment of this specification, a control module is set for the API gateway between the client and the back-end server, and the API corresponding to the target application in the back-end server is configured through the control module, so that the API gateway processes the API access request for the target application according to the corresponding API access rules. By setting up the control module of the API gateway in this way, the corresponding control rules can be directly issued to the API gateway through the control module, without modifying the configuration file of the API gateway and restarting it. The control method for the API in the server can be simplified, and the flexibility of API control can be improved. In addition, it is possible to implement control of each API in the application dimension, with high control accuracy.
[0095] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For the application interface control device, since it is basically similar to the application interface control method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the application interface control method embodiment.
[0096] Figure 4 4 is a block diagram of a computing device provided in an embodiment of the present specification. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
[0097] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0098] In one embodiment of the present specification, the above components of the computing device 400 and Figure 4 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0099] The computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 400 may also be a mobile or stationary server.
[0100] The processor 420 is used to execute computer programs / instructions, which, when executed by the processor, implement the above Figure 1 The method shown.
[0101] As for the computing device embodiment, since it is basically similar to the application interface management method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the application interface management method embodiment.
[0102] One embodiment of this specification also provides a computer-readable storage medium, which stores computer instructions, which implement the steps of the above-mentioned application interface control method when executed by the processor. The computer instructions include computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.
[0103] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned application program interface management method when the computer program / instruction is executed in a processor.
[0104] As for the computer-readable storage medium embodiment and the computer program product embodiment, since they are basically similar to the application interface management method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the application interface management method embodiment.
[0105] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0106] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0107] It should be noted that the above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present specification.
[0108] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0109] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well.
Claims
1. An application program interface management and control method, characterized in that: A control module applied to an application program interface API gateway, the API gateway connects a terminal device and a backend server, the backend server includes an API corresponding to an application installed in the terminal device, and the method includes: Receiving configuration information for an API corresponding to a target application in the backend server; Based on the configuration information, sending API control rules for the target application to the API gateway; The API gateway is controlled to manage the API corresponding to the target application based on the API management and control rules.
2. The method according to claim 1, characterized in that The configuration information includes at least one of prohibited access information of existing APIs, release information of newly added APIs, access condition information of APIs, access flow restriction information of APIs, and domain name information corresponding to the APIs.
3. The method according to claim 1, characterized in that: The receiving configuration information of the API corresponding to the target application in the backend server includes: Displaying an API configuration page, wherein the API configuration page includes an API information upload area and operation controls for the API; Based on the information input in the API configuration page, the API configuration information for the target application in the backend server is obtained.
4. The method according to any one of claims 1 to 3, characterized in that: The sending, based on the configuration information, the API control rules for the target application to the API gateway includes: Based on the configuration information and the information format supported and recognized by the API gateway, generate API control rules for the target application, and send the API control rules to the API gateway.
5. The method according to claim 4, characterized in that The generating of API control rules for the target application based on the configuration information and the information format supported and recognized by the API gateway includes: The configuration information and the network address information corresponding to the target application in the backend server are assembled in an information format supported and recognized by the API gateway to obtain API management rules for the target application.
6. The method according to any one of claims 1 to 3, characterized in that: The controlling the API gateway to control the API corresponding to the target application based on the API control rule includes: The API gateway is controlled to adjust the effectiveness status of each API access policy for the target application based on the API management and control rules, and the API corresponding to the target application is managed based on the effective API access policy, and the API access request for the target application is processed.
7. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: For an access request to a first API with an authentication requirement, controlling the API gateway to send the access request to the first API for processing when the account information is obtained from the terminal device that sends the access request; and / or, for an access request to a second API with restricted operation permissions, controlling the API gateway to send the access request to the second API for processing if it is determined that the terminal device sending the access request has the operation permissions for the second API; and / or, controlling the API gateway to count access requests for a third API with access traffic restrictions, and prohibiting access requests from being sent to the third API when the number of access requests being processed by the third API is greater than a number threshold; And / or, in case of receiving an observation request for the API gateway, displaying an access information page, wherein the access information page includes processing information of access requests for each API carried by the API gateway.
8. An application program interface control device, characterized in that: A control module applied to an application program interface API gateway, wherein the API gateway connects a terminal device and a backend server, wherein the backend server includes an API corresponding to an application program installed in the terminal device, and the application program interface control device includes: A receiving module, used to receive configuration information of an API corresponding to a target application in the back-end server; A sending module, used to send API control rules for the target application to the API gateway based on the configuration information; The control module is used to control the API gateway to control the API corresponding to the target application based on the API control rules.
9. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: A computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 7 when the computer program / instruction is executed in a processor.
Citation Information
Cited By
Distributed service access method and device, equipment and storage medium
CN119766533A
