Application program interface generation method and related device

The API generation method of the API management platform simplifies the API development process, solves the problem of slow API release speed, and improves development efficiency and user experience.

CN116028023BActive Publication Date: 2026-02-27BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310028946.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-09
Publication Date
2026-02-27
Estimated Expiration
2043-01-09

AI Technical Summary

Technical Problem

The release and update speed of existing APIs is consistently lagging, resulting in a poor user experience, posing a huge challenge to developers, and making it difficult for human resources to keep up with the demand.

Method used

By using the API generation methods and devices provided by the API management platform, the system receives API element information input by the user and selects downstream service interfaces, generates API request and response parameters, and generates a rule engine based on mapping relationships, thus simplifying the API development process.

Benefits of technology

It enables rapid API generation, simplifies the development process, improves API development efficiency and release speed, and meets the ever-increasing API needs of users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116028023B_ABST
    Figure CN116028023B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide an application program interface (API) generation method and related equipment. The method comprises: receiving element information of an API input by a user and a downstream service interface corresponding to the API selected by the user; pulling request parameters of the downstream service interface and response parameters of the downstream service interface according to the downstream service interface; generating at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface; generating a rule engine corresponding to the API; and storing the rule engine corresponding to the API to an address of the API. Through the API generation method and related equipment, the API can be quickly generated, the communication cost of API development is greatly simplified, and the development efficiency of the API is improved, thereby meeting the increasing API demand of users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of Internet, and particularly relates to an application program interface (API) generation method and related equipment. BACKGROUND

[0002] This section is intended to provide background or context to the embodiments of the present disclosure recited in the claims. The description herein does not constitute admission that the prior art is prior art nor does it constitute an admission of any description in this section as prior art to the present disclosure.

[0003] The API provides a more bottom-layer atomization capability, and a user can build an application platform by the API according to a business scene, process more customized demands, and bring greater expansion space for the business.

[0004] At present, the rise and demand of the API also brings great challenges to the developers. This is because, if the API is to be published externally, a large amount of manpower is needed to understand the business logic and manually encapsulate the interface, repeated communication is needed in the middle, and multi-platform operation is also needed, and the human resources are difficult to keep up, and it often takes at least several weeks from communication to online for an API. Such a situation causes the publishing speed and updating speed of the API to exist continuous lag, thereby greatly affecting the user experience. SUMMARY

[0005] Therefore, the present disclosure provides an application program interface generation method and related equipment, through the API generation method and API generation device provided by the API management platform, the API can be quickly generated, the communication cost of API development is greatly simplified, the development efficiency of the API is improved, and the increasing API demand of the user is met.

[0006] The API generation method provided in the embodiments of the present disclosure can include: receiving element information of an API input by a user and a downstream service interface corresponding to the API selected by the user; wherein the element information of the API includes an interface name of the API, an address of the API, and a request method of the API; pulling request parameters of the downstream service interface and response parameters of the downstream service interface according to the downstream service interface; generating at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface; generating a rule engine corresponding to the API based on the element information of the API, the downstream service interface, the at least one API request parameter, the at least one API response parameter, a mapping relationship between the at least one API request parameter and the request parameters of the downstream service interface, and a mapping relationship between the response parameters of the downstream service interface and the at least one API response parameter; and storing the rule engine corresponding to the API to the address of the API.

[0007] In the embodiments of the present disclosure, the receiving of the downstream service interface corresponding to the API selected by the user includes: receiving a downstream service framework corresponding to the API selected by the user; determining a list of downstream service interfaces contained in the downstream service framework; displaying the list of downstream service interfaces; and receiving the downstream service interface selected by the user from the list of downstream service interfaces.

[0008] In the embodiments of the present disclosure, the pulling of the request parameters of the downstream service interface and the response parameters of the downstream service interface according to the downstream service interface includes: pulling an interface description file corresponding to the downstream service framework; and extracting the request parameters of the downstream service interface and the response parameters of the downstream service interface from the interface description file.

[0009] In the embodiments of the present disclosure, the receiving of the downstream service framework corresponding to the API selected by the user includes: displaying a list of downstream service protocols including at least one downstream service protocol; receiving a downstream service protocol selected by the user from the list of downstream service protocols; determining a list of downstream service frameworks contained in the downstream service protocol; displaying the list of downstream service frameworks; and receiving the downstream service framework selected by the user from the list of downstream service frameworks.

[0010] In embodiments of the present disclosure, the generating the at least one API request parameter corresponding to the request parameter of the downstream service interface and the at least one API response parameter corresponding to the response parameter of the downstream service interface comprises: in response to detecting that the user selects the operation of generating the API parameter, generating the at least one API request parameter corresponding to the request parameter of the downstream service interface, and generating the at least one API response parameter corresponding to the response parameter of the downstream service interface; and displaying the at least one API request parameter, the at least one API response parameter, a mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and a mapping relationship between the response parameter of the downstream service interface and the at least one API response parameter.

[0011] In embodiments of the present disclosure, the method further comprises: in response to detecting that the user adds a custom API request parameter, receiving a name and a type of the API request parameter input by the user, receiving a target request parameter of the downstream service interface corresponding to the custom API request parameter selected by the user, and establishing a mapping relationship between the custom API request parameter and the target request parameter of the downstream service interface; or, in response to detecting that the user adds a custom API response parameter, receiving a name and a type of the API response parameter input by the user, receiving a target response parameter of the downstream service interface corresponding to the custom API response parameter selected by the user, and establishing a mapping relationship between the custom API response parameter and the target response parameter of the downstream service interface.

[0012] In embodiments of the present disclosure, the method further comprises: in response to detecting that the user modifies an attribute of a first API request parameter or a first API response parameter, displaying a parameter attribute setting interface; receiving an attribute value of the first API request parameter or the first API response parameter input by the user; and setting the attribute of the first API request parameter or the first API response parameter based on the attribute value; wherein the attribute comprises one or any combination of a format of the parameter, an enumeration type, a default value, a conversion function, a verification condition, and an example.

[0013] In embodiments of the present disclosure, the method further comprises: in response to detecting that the user sets a plug-in, displaying a plug-in input interface; receiving plug-in content input by the user in the plug-in input interface; wherein the plug-in content comprises a plug-in name, an input parameter of the plug-in, an output parameter of the plug-in, and a program of the plug-in; and adding the plug-in content to the rule engine.

[0014] In an embodiment of the present disclosure, the method further includes: in response to detecting that a user deletes a second API request parameter, deleting the second API request parameter and deleting a mapping relationship between the second API request parameter and a request parameter of a downstream service interface; or, in response to detecting that a user deletes a second API response parameter, deleting the second API response parameter and deleting a mapping relationship between a response parameter of a downstream service interface and the second API response parameter.

[0015] In an embodiment of the present disclosure, the method further includes: generating a blank test case of the API based on the element information of the API and the at least one API request parameter; receiving a parameter value of the at least one request parameter input by a user; and generating a test case of the API based on the blank test case and the parameter value of the at least one request parameter.

[0016] In an embodiment of the present disclosure, the element information of the API further includes: an interface description of the API; and the method further includes: generating an interface description document of the API based on the element information of the API, the at least one API request parameter, the at least one API response parameter, and a pre-set interface description document template.

[0017] In an embodiment of the present disclosure, the element information of the API further includes: authentication type information.

[0018] In an embodiment of the present disclosure, the method further includes: in response to detecting that a user browses generated third API information, obtaining element information and parameter configuration information of the third API and element information and parameter configuration information of a fourth API stored in address information of the third API; comparing the element information and the parameter configuration information of the third API with the element information and the parameter configuration information of the fourth API; and displaying the element information and the parameter configuration information of the third API; wherein information that is different from the element information and the parameter configuration information of the fourth API is highlighted when the element information and the parameter configuration information of the third API are displayed.

[0019] The API generation apparatus in the embodiments of the present disclosure can include:

[0020] The information receiving unit is configured to receive element information of an API input by a user and a downstream service interface corresponding to the API selected by the user; wherein the element information of the API includes: an interface name of the API, an address of the API, and a request method of the API;

[0021] The downstream service interface parameter extraction unit is configured to pull request parameters of the downstream service interface and response parameters of the downstream service interface according to the request of the downstream service interface.

[0022] The API parameter generation unit is configured to generate at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface.

[0023] The rule engine generation unit is configured to generate a rule engine corresponding to the API based on the element information of the API, the downstream service interface, a mapping relationship between the at least one API request parameter and the request parameters of the downstream service interface, and a mapping relationship between the response parameters of the downstream service interface and the at least one API response parameter.

[0024] The storage unit is configured to store the rule engine corresponding to the API to an address of the API.

[0025] The computer device provided in the embodiments of the present disclosure can include:

[0026] one or more processors, a memory; and

[0027] one or more programs;

[0028] The one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the API generation method.

[0029] The non-volatile computer readable storage medium containing the computer program provided in the embodiments of the present disclosure, when the computer program is executed by one or more processors, causes the processor to execute the API generation method.

[0030] The computer program product provided in the embodiments of the present disclosure includes computer program instructions, when the computer program instructions run on a computer, cause the computer to execute the API generation method.

[0031] Through the API generation method and the related device, a user can quickly complete API configuration through simple operation on a visual interface, and an API can be quickly generated without writing code for encapsulating a downstream service interface, so that the efficiency of API external publication can be improved while the quality of the API is ensured. BRIEF DESCRIPTION OF DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the present disclosure or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without any creative effort based on these drawings.

[0033] Figure 1 An implementation flowchart of the API generation method described in the embodiments of the present disclosure is shown.

[0034] Figure 2 An example of the API element information configuration interface described in the embodiments of the present disclosure is shown.

[0035] Figure 3 An implementation flowchart of the method for receiving user selection of a downstream service interface corresponding to an API described in the embodiments of the present disclosure is shown.

[0036] Figure 4 An example of the API parameter configuration interface described in the embodiments of the present disclosure is shown.

[0037] Figure 5 An implementation flowchart of the method for pulling request parameters and response parameters of a downstream service interface according to user selection of the downstream service interface described in the embodiments of the present disclosure is shown.

[0038] Figure 6 An implementation flowchart of the method for generating at least one API request parameter corresponding to request parameters of a downstream service interface and at least one API response parameter corresponding to response parameters of the downstream service interface described in the embodiments of the present disclosure is shown.

[0039] Figure 7 An application scenario example of the API management platform described in the embodiments of the present disclosure is shown.

[0040] Figure 8 An internal structure diagram of the API generation module described in the embodiments of the present disclosure is shown.

[0041] Figure 9 A hardware structure of an exemplary computer device provided by the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0042] To make the objects, technical solutions and advantages of the present disclosure clearer, the principles and spirits of the present disclosure will be described below with reference to a number of exemplary embodiments. It should be understood that the embodiments are given only for better understanding of the present disclosure by those skilled in the art, and in no way limit the scope of the present disclosure. On the contrary, the embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0043] In this document, it should be understood that any number of elements in the drawings are used for illustration only and not limitation, and any naming is only for differentiation and does not have any limiting meaning.

[0044] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood as the common meanings understood by those skilled in the art to which the present disclosure belongs. The terms "first", "second" and similar terms used in the embodiments of the present disclosure do not represent any order, number or importance, but are only used to distinguish different components. The terms "include" or "contain" and similar terms mean that the elements or objects before the terms encompass the elements or objects listed after the terms and their equivalents, and do not exclude other elements or objects. The terms "connect" or "connected" and similar terms are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The terms "up", "down", "left", "right" and the like are only used to represent relative positional relationships, and when the absolute positions of the described objects are changed, the relative positional relationships may also be changed accordingly.

[0045] It can be understood that, before using the technical solutions of various embodiments of the present disclosure, the user will be informed of the type, scope of use, use scenario and the like of the personal information involved in a proper manner, and the authorization of the user will be obtained.

[0046] For example, in response to receiving the active request of the user, the user is sent prompt information to explicitly prompt the user that the operation requested to be performed will require the acquisition and use of personal information of the user. Thus, the user can voluntarily choose whether to provide personal information to the software or hardware such as electronic device, application program, server or storage medium that performs the operation of the technical solutions of the present disclosure according to the prompt information.

[0047] As an optional but not limiting implementation manner, in response to accepting the active request of the user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, in which the prompt information can be presented in the form of text. In addition, the pop-up window can also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0048] It can be understood that the above notification and user authorization obtaining process is only illustrative and does not limit the implementation of the present disclosure, and other methods meeting relevant laws and regulations can also be applied to the implementation of the present disclosure.

[0049] As mentioned above, the rise and increasing demand of API bring great challenges to the work of developers, and the update speed of API is continuously lagging. In order to solve this problem, the embodiment of the present disclosure provides an API management platform. The API management platform provides the user with API configuration, API testing, API audit release, API calling, API monitoring, API interface description document management and other API full life cycle management capabilities. The API generation method provided by the API management platform can quickly generate API, greatly simplifying the communication cost of API development, improving the development efficiency of API, and meeting the increasing API demand of users.

[0050] Figure 1 The implementation flowchart of the API generation method described in the embodiment of the present disclosure. The API generation method can be implemented through the API generation function of the API management platform. As shown in Figure 1 The API generation method can include the following steps.

[0051] In step 102, the element information of the API input by the user and the downstream service interface corresponding to the API selected by the user are received.

[0052] In step 104, the request parameters of the downstream service interface and the response parameters of the downstream service interface are pulled according to the downstream service interface.

[0053] In step 106, at least one API request parameter corresponding to the request parameter of the downstream service interface and at least one API response parameter corresponding to the response parameter of the downstream service interface are generated.

[0054] In step 108, the rule engine corresponding to the API is generated based on the element information of the API, the downstream service interface, the at least one API request parameter, the at least one API response parameter, the mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the at least one API response parameter.

[0055] In step 110, the rule engine corresponding to the API is stored in the address of the API.

[0056] The specific implementation method of each step in the API generation method will be described in detail below in combination with the drawings and specific examples.

[0057] Regarding step 102 above, in the embodiments of this disclosure, the element information of the API may include: the interface name of the API, the address of the API, and the request method of the API.

[0058] The address of the aforementioned API can be in the form of a Uniform Resource Locator (URL), and may include the API's domain name and path information. This API address serves as the storage address for the corresponding rule engine, and users can invoke the generated API through this address.

[0059] In some embodiments of this disclosure, the generated API is an API conforming to the Hypertext Transfer Protocol (HTTP). In this case, the request method for the aforementioned API can include various HTTP request methods, such as GET, POST, PUT, and DELETE, etc.

[0060] In some other embodiments of this disclosure, the element information of the API may further include: the interface description of the API. The interface description of the API is mainly used to describe the functionality of the API and can be applied to the generation process of the API's interface description document.

[0061] In some embodiments of this disclosure, the API management platform described above can provide an API element information configuration interface. Figure 2 An example of an API element information configuration interface as described in an embodiment of this disclosure is shown. Figure 2 As shown, the API element information configuration interface allows for the creation of input boxes 201 for the API's interface name and 202 for the API's interface description, where users can input these information. The interface also allows for input boxes or dropdown lists 203 and 204 for the API's domain name and path, allowing users to select or input these information. Furthermore, the interface allows for a dropdown list 205 for the API's request method, where users can select the appropriate request method. Therefore, through the above... Figure 2 The API element information configuration interface shown allows users to intuitively, easily, and quickly fill in or select API element information.

[0062] After the element information of the API is input, the user can further select the downstream service interface corresponding to the API. It can be understood that in the embodiments of the present disclosure, the API encapsulates a certain downstream service interface under a certain downstream service framework. In this way, the downstream service interface can be invoked by invoking the generated API, so as to realize a certain service under the downstream service framework. In this case, the downstream service interface corresponding to the API needs to be selected when the API is generated, for example, the API to be generated can correspond to an authentication interface under a downstream authentication service framework, and the like.

[0063] In order to facilitate the user to quickly select the downstream service interface corresponding to the API, in the embodiments of the present disclosure, the user can be quickly positioned to the target downstream service interface which the user wants to select through a step-by-step selection manner. Figure 3 The implementation process of the method for receiving the user to select the downstream service interface corresponding to the API is shown. Specifically, as shown in Figure 3 The method for receiving the user to select the downstream service interface corresponding to the API can include the following steps.

[0064] In step 302, the user-selected downstream service framework is received.

[0065] It can be understood that the downstream service interface is opened by the downstream service framework. Generally, a downstream service framework can provide multiple downstream service interfaces, and the downstream service interfaces provided by different downstream service frameworks are different. Therefore, the user can quickly position to the downstream service interface which the user wants to select by selecting a certain downstream service framework supported by the API management platform.

[0066] Further, considering that the downstream service framework conforms to a certain service protocol, in the process of selecting the downstream service framework, the step-by-step selection manner can still be realized. Specifically, in the embodiments of the present disclosure, the user-selected downstream service framework can be received through the following steps: first, a downstream service protocol list including at least one downstream service protocol is displayed; second, the user-selected downstream service protocol from the above downstream service protocol list is received; third, a list of downstream service frameworks supporting the above downstream service protocol is determined based on the above downstream service protocol; fourth, the determined list of downstream service frameworks is displayed; and fifth, the user-selected downstream service framework from the above list of downstream service frameworks is received.

[0067] In the embodiments of the present disclosure, the downstream service protocol refers to a service protocol supported by each downstream service framework, and can generally include a Thrift protocol, an HTTP protocol, a Bizrpc protocol, and the like. In the selection of the downstream service framework, the downstream service protocol option is further added to classify the downstream service frameworks that can be supported by the API management platform, so as to help the user quickly locate the target downstream service framework. The downstream service framework under each downstream service protocol is pre-configured on the API management platform. In this way, after the user selects the downstream service protocol, the list of the downstream service frameworks supporting the downstream service protocol can be determined, and all the downstream service frameworks under the selected service protocol can be further displayed for the user.

[0068] In the embodiments of the present disclosure, the API management platform can provide an API parameter configuration interface. Figure 4 An example of the API parameter configuration interface is shown. As shown in Figure 4 The API parameter configuration interface can be provided with multiple options 401 of the downstream service protocol, from which the user can select a downstream service protocol, for example, the Thrift protocol. Alternatively, the multiple options of the downstream service protocol can also be provided in the form of a drop-down list. The API parameter configuration interface can also be provided with a drop-down list 402 of the downstream service framework, which displays the list of the downstream service frameworks supporting the selected downstream service protocol by the user, and the user can select a downstream service framework from the drop-down list, for example, the authentication service.

[0069] In the embodiments of the present disclosure, the downstream service framework can be regarded as a warehouse containing all the downstream service interfaces under the downstream service framework, for example, an authentication service framework, a pangolin service framework, an open advertisement service framework, and the like.

[0070] In step 304, the list of the downstream service interfaces contained in the downstream service framework is determined.

[0071] As described above, the downstream service framework can be regarded as a warehouse containing all the downstream service interfaces under the downstream service framework, so that by locating the target downstream service framework, the list of all the downstream service interfaces under the downstream service framework can be obtained. The downstream service interfaces contained in each downstream service framework are also pre-configured on the API management platform. In this way, after the user selects the downstream service framework, the list of the downstream service interfaces contained in the downstream service framework can be determined.

[0072] In step 306, the list of the downstream service interfaces is displayed.

[0073] After obtaining the list of downstream service interfaces of the selected downstream service framework, all the downstream service interfaces under the selected downstream service framework can be displayed to the user for the user to select a target downstream service interface. Figure 4 As shown in FIG. 4, in the API parameter configuration interface, a drop-down list 403 of downstream service interfaces can also be set, from which the user can select a downstream service interface, for example, an authentication interface.

[0074] At step 308, the downstream service interface selected by the user from the list of downstream service interfaces is received.

[0075] As can be seen, by the method shown in FIG. 4, the user can be helped to quickly locate the target downstream service interface by selecting the downstream service protocol first, then the downstream service framework under the downstream service protocol, and finally the downstream service interface under the downstream service framework. Figure 3

[0076] After receiving the downstream service interface selected by the user, at step 104, the request parameters and the response parameters of the downstream service interface selected by the user can be pulled. Figure 5 An implementation process of the method of pulling the request parameters and the response parameters of the downstream service interface selected by the user is shown in FIG. 5. Specifically, as shown in FIG. 5, the method of pulling the request parameters and the response parameters of the downstream service interface selected by the user can include the following steps. Figure 5

[0077] At step 502, the interface description file corresponding to the downstream service framework is pulled.

[0078] In an embodiment of the present disclosure, each downstream service framework is pre-configured with an interface description file corresponding thereto, which is used to describe all the downstream service interfaces contained in the downstream service framework, for example, the function description of each downstream service interface, the request parameters and the response parameters of each downstream service interface, and the like. In some embodiments of the present disclosure, the interface description file can be an Interface Description Language (IDL) file. The IDL is a computer language used to describe the interface of a software component. Therefore, in these embodiments, the interface description file can also be referred to as the IDL file corresponding to the downstream service framework.

[0079] ​​In an embodiment of the present disclosure, each downstream service framework can be preconfigured with multiple versions of interface description files, or allow a user to generate a new version of interface description file on site, then in the step 502, all versions of interface description files corresponding to the user-selected downstream service framework can be pulled according to the user-selected downstream service framework, and a version list of the interface description files is displayed for the user to select from. As shown in Figure 4 As shown in the above API parameter configuration interface, a drop-down list 404 of multiple versions of interface description files corresponding to the downstream service framework can also be set, from which a user can select an interface description file corresponding to a downstream service framework, for example, an interface description file corresponding to a version number of 1.0.0.1 of the downstream service framework.

[0080] In step 504, the request parameters of the downstream service interface and the response parameters of the downstream service interface are extracted from the interface description file corresponding to the above-mentioned downstream service framework.

[0081] As described above, each downstream service framework is preconfigured with an interface description file corresponding thereto, which is used to describe all downstream service interfaces contained in the downstream service framework. Therefore, in the above-mentioned step 504, the request parameters of the downstream service interface and the response parameters of the downstream service interface can be directly extracted from the interface description file corresponding to the downstream service framework according to the user-selected downstream service interface. In an embodiment of the present disclosure, the extracted information at least includes the name and type of the parameters.

[0082] After determining the request parameters and response parameters of the user-selected downstream service interface, the request parameters and response parameters of the API interface can be generated according to the above-mentioned request parameters and response parameters in the above-mentioned step 106.

[0083] In an embodiment of the present disclosure, in order to quickly generate API request parameters and API response parameters, a control for generating API parameters can be set on the API parameter configuration interface, as shown in the “one-click parameter configuration” control 405 in Figure 4 When the user clicks the above-mentioned control for generating API parameters, the API request parameters and API response parameters can be automatically generated according to the request parameters and response parameters of the user-selected downstream service interface.

[0084] Figure 6 The implementation process of the method for generating at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface is shown in an embodiment of the present disclosure. As shown in Figure 6 In response to detecting that the user selects the operation of generating API parameters, the method for generating at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface can be executed, as shown in Figure 6The method can specifically include the following steps.

[0085] At step 602, at least one API request parameter corresponding to the request parameter of the downstream service interface is generated.

[0086] At step 604, at least one API response parameter corresponding to the response parameter of the downstream service interface is generated.

[0087] It should be noted that the execution order of the above steps 602 and 604 is not limited in the embodiments of the present disclosure. That is, the above steps 602 and 604 can be executed in series in any order or in parallel.

[0088] In the embodiments of the present disclosure, the at least one API request parameter corresponding to the request parameter of the downstream service interface generated in the above steps can have the same type as the request parameter of the downstream service interface. Similarly, the at least one API response parameter corresponding to the response parameter of the downstream service interface generated in the above steps can have the same type as the response parameter of the downstream service interface. In addition, the names of the API request parameter and the API response parameter can also be automatically generated based on the request parameter of the downstream service interface and the response parameter of the downstream service interface according to a preset naming rule. The embodiments of the present disclosure do not limit the naming rule of the parameters.

[0089] At step 606, the at least one API request parameter, the at least one API response parameter, the mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the at least one API response parameter are displayed.

[0090] In the embodiments of the present disclosure, the names and types of the generated at least one API request parameter and at least one API response parameter can be directly displayed on the API parameter configuration interface, and the mapping relationship between the parameters is also displayed.

[0091] It can be seen that, through the above Figure 6 The method can directly automatically generate API request parameters and API response parameters based on the downstream service interface selected by the user, and the generated API request parameters and the request parameters of the downstream service interface have a one-to-one correspondence relationship; the generated API response parameters and the response parameters of the downstream service interface also have a one-to-one correspondence relationship. In this case, it can be considered that the parameters of the API have been initially configured, and the above Figure 1 The steps 108 and 110.

[0092] In step 108, the rule engine corresponding to the API is generated based on the received element information of the API, the selected downstream service interface, the generated at least one API request parameter, the at least one API response parameter, the mapping relationship between the API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the API response parameter.

[0093] In an embodiment of the present disclosure, the rule engine records the name, address, request method, and other element information of the API. The rule engine also records the name and type of the API request parameter and the API response parameter. In addition, the rule engine also records the mapping relationship between the API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the API response parameter. It can be seen that the rule engine records all information of the API, and can realize the mapping of the API to the downstream service interface, so as to complete the calling of the downstream service interface.

[0094] After the rule engine corresponding to the API is generated, in step 110, the rule engine corresponding to the API can be stored in the address of the API. As described above, the address of the API can include domain name information and path information. The domain name information can be one of a plurality of domain names pre-configured and selectable by the user, and the path information can be a path input by the user. In some embodiments of the present disclosure, the domain name information is the domain name information of the server where the API management platform is located by default.

[0095] After the above steps are completed, the rule engine corresponding to the API is stored to the address of the API, and it is considered that the generation of the API is completed. After the above API is audited by the API auditor and is published, the user can call the above API to realize the calling of the corresponding downstream service interface, so as to realize the corresponding business. Specifically, when calling the API, the user can send a calling request to the address of the API, and carry at least one parameter value of an API request parameter in the calling request. After receiving the calling request, the server (in some embodiments, the API management platform) corresponding to the domain name information in the address of the API can find the rule engine corresponding to the API according to the path information in the address of the API. Then, the rule engine determines the downstream service interface actually called by the calling request according to the rules recorded in the rule engine. Then, the rule engine maps the parameter value of the API request parameter in the calling request to each request parameter of the downstream service interface as the input parameter of the downstream service interface, and calls the corresponding downstream service interface. After the downstream service interface receives the input parameter and completes the corresponding logic, the downstream service interface returns the parameter value of the downstream service interface response parameter. After receiving the parameter value of the downstream service interface response parameter, the rule engine maps the parameter value of the downstream service interface response parameter to each API response parameter according to the rules recorded in the rule engine. Finally, the rule engine returns the parameter value of each API response parameter to the user as a response.

[0096] In the embodiments of the present disclosure, before an API is generated and submitted to the API auditor for auditing, the API management platform can also provide the user with a browsing function of API information, can provide an API information browsing interface, and display all information such as element information and parameter configuration information of the generated API on the API information browsing interface for the user to check the information. Further, in order to provide more rich prompt information for the user, the following operations can be performed when displaying the element information and the parameter configuration information of the API: in response to detecting that the user browses the third API, obtaining the element information and the parameter configuration information of the third API and the element information and the parameter configuration information of the fourth API stored in the address information of the fourth API; comparing the element information and the parameter configuration information of the third API with the element information and the parameter configuration information of the fourth API respectively; and displaying the element information and the parameter configuration information of the third API; wherein, when the element information and the parameter configuration information of the third API are displayed, the information different from the element information and the parameter configuration information of the fourth API is highlighted to help the user understand the differences between the third API currently generated and the fourth API already opened in the same address.

[0097] It can be seen from the above method that, by using the API generation method provided by the API management platform, the user can quickly complete API configuration through simple operation of the visual interface, and an API can be quickly generated without writing code for encapsulating the downstream service interface, thereby improving the efficiency of API external release while ensuring API quality.

[0098] As can be seen from the above embodiments, in the configuration process of the API parameters, the API request parameters and the API response parameters corresponding to the request parameters and the response parameters of the downstream service interface are automatically generated. In some other embodiments of the present disclosure, in order to realize more flexible parameter configuration, the API management platform further provides functions of adding, deleting, and modifying the generated API request parameters and API response parameters.

[0099] As described above, after the API request parameters and the API response parameters are automatically generated, at least one API request parameter, at least one API response parameter, a mapping relationship between the at least one API request parameter and the request parameters of the downstream service interface, and a mapping relationship between the response parameters of the downstream service interface and the at least one API response parameter are displayed on the API parameter configuration interface. On the basis of the above scheme, the user can further add, delete, and modify the displayed API request parameters and API response parameters.

[0100] Specifically, for the addition of the API request parameters and the API response parameters, the API parameter configuration interface can be provided with controls of “adding API request parameter” and “adding API response parameter”. When the user clicks one of the controls, a corresponding parameter adding interface can be displayed for the user to fill in the name, type, attribute, and mapping relationship between the newly added parameter and the request parameter or the response parameter of the downstream service interface of the custom API request parameter or the custom API response parameter. Specifically, when adding an API request parameter, in response to detecting the user's operation of adding a custom API request parameter, the name and type of the API request parameter input by the user are received, the target request parameter of the downstream service interface corresponding to the custom API request parameter selected by the user is received, and a mapping relationship between the custom API request parameter and the target request parameter of the downstream service interface is established. When adding an API response parameter, in response to detecting the user's operation of adding a custom API response parameter, the name and type of the API response parameter input by the user are received, the target response parameter of the downstream service interface corresponding to the custom API response parameter selected by the user is received, and a mapping relationship between the custom API response parameter and the target response parameter of the downstream service interface is established.

[0101] For the modification of API request parameters and API response parameters, in embodiments of the present disclosure, a user can modify the name and attributes of the above-mentioned parameters, wherein the attributes can include one or any combination of format, enumeration type, default value, conversion function, verification condition, and example.

[0102] The format refers to the sub-classification of the parameter under the current parameter type, for example, if the type of an API request parameter is a string, the user can further select the format of the API request parameter as one of data, time, binary file, or email, etc., so as to more clearly indicate the classification of a certain parameter.

[0103] The enumeration type refers to the enumeration package commonly used by multiple parameters set by the API management platform, for example, a parameter representing gender can be set as a gender enumeration type including male and female. In embodiments of the present disclosure, by setting the enumeration type of the API request parameter and the API response parameter, the value range of the API request parameter and the API response parameter can be limited. Moreover, the value range of the parameters set as the enumeration type in each API interface can be modified synchronously by directly updating the enumeration type, without modifying the value range of each parameter one by one, so that the API interface generation and updating operation is more convenient.

[0104] The default value refers to the default value of each parameter, for example, a parameter representing gender can set its default value as male or female.

[0105] The conversion function refers to the further expansion of the API request parameter and the API response parameter. In embodiments of the present disclosure, the conversion function can include two types of operators and functions. The operators can include addition, subtraction, multiplication, division, modulus operation, comparison operation, bit operation, and list operation, etc. The functions can include numerical operation function (integer operation, power operation, and decimal retention operation, etc.), type conversion function (conversion to integer, etc.), time function (conversion between time and timestamp, conversion of time format, and time calculation, etc.), and list operation, etc. By setting operators or functions for the API request parameter or the API response parameter, the API request parameter or the API response parameter can be further operated or converted to meet the needs of different applications.

[0106] The verification condition refers to the verification method set for the API request parameter and the API response parameter, which can be verified by the set verification condition.

[0107] In embodiments of the present disclosure, the names and attributes of the API request parameters and the API response parameters displayed on the API parameter configuration interface are all allowed to be modified by the user. Specifically, in response to detecting that the user modifies the attribute of a first API request parameter or a first API response parameter, a parameter attribute setting interface is displayed; then, the attribute value of the first API request parameter or the first API response parameter input by the user is received; and finally, the name and attribute of the first API request parameter or the first API response parameter are updated based on the attribute value input by the user.

[0108] In order to further expand the business processing capability of the API and implement more complex and richer business logic, a plug-in program can be further set in the API interface. In embodiments of the present disclosure, a "new plug-in" control can be added to the API parameter configuration interface. When the user clicks the control, it can be considered that the user wants to set a plug-in program in the API. Specifically, in embodiments of the present disclosure, in response to detecting that the user sets a plug-in, a plug-in input interface is first displayed. Then, the plug-in content input by the user on the plug-in input interface is received. The plug-in content can include, for example, the plug-in name, the input parameter of the plug-in, the output parameter of the plug-in, and the program of the plug-in. Finally, the received plug-in content is added to the rule engine corresponding to the API.

[0109] For the deletion of the API request parameters and the API response parameters, a "delete" control can be set on the API parameter configuration interface at a position corresponding to each API request parameter and each API response parameter. When the user clicks the control, it can be considered that the user wants to delete a corresponding parameter. Specifically, in response to detecting that the user deletes a second API request parameter, the related configuration of the second API request parameter is deleted, and the mapping relationship between the second API request parameter and the request parameter of the downstream service interface is deleted. In response to detecting that the user deletes a second API response parameter, the related configuration of the second API response parameter is deleted, and the mapping relationship between the response parameter of the downstream service interface and the second API response parameter is deleted.

[0110] As can be seen from the above method, in embodiments of the present disclosure, the API management platform allows the user to add, delete, and modify the API request parameters and the API response parameters in the process of generating the API, so that flexible configuration of the API parameters and expansion of the service capability of the API can be implemented.

[0111] It should be noted that the request parameters of the downstream service interface are generally not allowed to be modified by the user. However, the optional request parameters of the downstream service interface are generally allowed to be deleted by the user.

[0112] It can be seen that the method shown by the above embodiments can achieve more flexible API parameter configuration and expand the function of the API on the basis of quickly generating an API.

[0113] In addition to the above API generation method, the API management platform also provides an API test function for testing the generated API for the user. In the embodiments of the present disclosure, the API management platform can automatically generate a blank test case of the API and display it on the API test interface. The user can directly fill in the parameter values of the API request parameters on the blank test case displayed on the API test interface to generate a real test case. Then, click the "send" control on the API test interface to realize the call test of the API interface. Thereafter, the return result of the API response parameters will be displayed on the API test interface. Specifically, in the embodiments of the present disclosure, the API management platform will generate a blank test case of the API based on the element information of the API and the above at least one API request parameter, and display the generated blank test case; then, receive the parameter values of the above at least one API request parameter input by the user; finally, generate a test case of the API based on the above blank test case and the parameter values of the above at least one request parameter. It should be noted that in the embodiments of the present disclosure, for the generated test case and the return result of the API response parameters, the user can also choose to save the test case for retesting or generating an API interface description document.

[0114] In some specific examples of the present disclosure, the API generated by the API management platform is an HTTP API, and the above blank test case will include two parts of HTTP Header and HTTP Body. Among them, the HTTP Header part can be generated according to the API element information, and the HTTP Body part can be generated according to the API parameter configuration part. In addition, the user can set the parameter values of each of the above at least one API request parameter in the HTTP Body part.

[0115] In addition to the above-mentioned API generation method and the method of generating API test cases, the API management platform also provides a function of automatically generating an API interface description document for the user. Specifically, in an embodiment of the present disclosure, the API management platform can generate an interface description document of the API based on the element information of the API, the at least one API request parameter, the at least one API response parameter, and a pre-set document template. Generally, the interface description document of the API will include an introduction to the name, address, interface description, and request method of the API. These information can be directly obtained from the element information of the API. In addition, the interface description document of the API will also include an introduction to the API request parameter and the response parameter. These information can also be directly obtained from the API parameter configuration information. Further, the interface description document of the API can also include examples of API calls. These example information can be obtained from the saved API test cases.

[0116] In still another embodiment of the present disclosure, the element information of the API can further include authentication type information. The authentication type information defines the identity of the user who can access the API. In an embodiment of the present disclosure, different levels of authentication type information can be pre-set, and each authentication type information option or drop-down list is displayed in the API element information configuration interface, so that the user can select the authentication type information corresponding to the API when filling in the API element information. The authentication type information can also include blacklist and whitelist information of the user who calls the API. In an embodiment of the present disclosure, in response to detecting that the user selects a certain authentication type information for the API, the authentication type information selected by the user is recorded in the element information of the API. After the API is published, each time a user's call request is received, the API management platform provides the authentication type information set in the element information of the API and the identification information of the user sending the call request to an authentication server that completes the authentication service, so that the authentication server determines whether the user has the right to access the API according to the authentication type information corresponding to the API and the identification information of the user, and returns the authentication result to the API management platform. If it is determined that the user has the right to access the API, the API management platform can continue the call of the API; and if it is determined that the user does not have the right to access the API, the API management platform can return a prompt information to the user that the user does not have the right to access the API, and end the call of the API.

[0117] In addition, in still another embodiment of the present disclosure, the API management platform can also provide an API auditing and publishing function, so that the auditors can audit the API generated by the user, and the API can be published after the audit is passed.

[0118] Further, the API management platform can further provide an API monitoring function for counting and analyzing the access of the published API, such as counting the access amount, visitor identification, API response, and the like. Further, by counting and analyzing the access of the API, the API access throttling function can be realized, and when the API access amount exceeds the maximum access amount of the API, the user access can be directly rejected, and the user can be notified of the throttling message.

[0119] It can be seen that in the above embodiments of the present disclosure, the API management platform can provide the API configuration, API testing, API auditing and publishing, API monitoring, API interface description document management, and the like.

[0120] Corresponding to the method described in the above embodiments, the present disclosure further provides an API management platform. Figure 7 The application scenario example of the API management platform described in the embodiments of the present disclosure is shown. As shown in Figure 7 The API management platform 710 can include an API generation module, an API testing module, an API auditing module, an API calling module, an API monitoring module, and an API interface description document module, so as to realize the API generation, API testing, API auditing, API calling, API monitoring, and API interface description document generation functions.

[0121] In the embodiments of the present disclosure, the API management platform 710 can provide the user operation interface of the API generation, API testing, API auditing, API monitoring, and API interface description document generation functions. The user 720 can call the API generation, API testing, API auditing, API monitoring, and API interface description document generation functions of the API management platform 710 through the user operation interface provided by the API management platform 710. In the embodiments of the present disclosure, the rule engine corresponding to the generated API can be stored in the database 730. In addition, the generated API actually encapsulates the downstream service interface provided by a certain downstream service framework 740. Therefore, when calling a certain published API, the API management platform 710 will call the downstream service interface encapsulated by the API.

[0122] The internal structure of the API generation module in the API management platform 710 will be described in detail below with reference to the accompanying drawings. Figure 8 The internal structure of the API generation module described in the embodiments of the present disclosure is shown. As shown in Figure 8 The API generation module can include:

[0123] The information receiving unit 802 is configured to receive element information of an API input by a user and a downstream service interface corresponding to the API selected by the user, wherein the element information of the API includes an interface name of the API, an address of the API, and a request method of the API.

[0124] The downstream service interface parameter extracting unit 804 is configured to pull request parameters of the downstream service interface and response parameters of the downstream service interface according to the downstream service interface.

[0125] The API parameter generating unit 806 is configured to generate at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface.

[0126] The rule engine generating unit 808 is configured to generate a rule engine corresponding to the API based on the element information of the API, the downstream service interface, a mapping relationship between the at least one API request parameter and the request parameters of the downstream service interface, and a mapping relationship between the response parameters of the downstream service interface and the at least one API response parameter.

[0127] The storage unit 810 is configured to store the rule engine corresponding to the API to the address of the API.

[0128] It should be noted that the specific implementation method of each module described above can refer to the foregoing embodiments, which will not be repeated here. In addition, the specific implementation method of the API test module, the API monitoring module, and the API interface description document module described above can also refer to the foregoing embodiments, which will not be repeated here.

[0129] Figure 9 A more specific electronic device hardware structure schematic diagram provided by the embodiment is shown, which can include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 for communication within the device.

[0130] The processor 1010 can be implemented in the form of a general-purpose CPU (Central Processing Unit, central processor), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the embodiments of the present specification.

[0131] The memory 1020 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 can store an operating system and other application programs, and when the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, the related program codes are stored in the memory 1020 and are called and executed by the processor 1010.

[0132] The input / output interface 1030 is configured to connect an input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. The input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.

[0133] The communication interface 1040 is configured to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices. The communication module can realize communication through a wired manner (such as USB, network cable, etc.) or through a wireless manner (such as mobile network, WIFI, Bluetooth, etc.).

[0134] The bus 1050 includes a channel for transmitting information between various components (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040) of the device.

[0135] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device can also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device can also only contain the components necessary to implement the embodiments of the present specification, and does not have to contain all the components shown in the figure.

[0136] The electronic device of the above embodiments is used to implement the corresponding API generation method in any of the preceding embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described here.

[0137] Based on the same inventive concept, the disclosure also provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to execute the API generation method according to any of the above embodiments.

[0138] The above non-transitory computer-readable storage medium can be any available medium or data storage that can be accessed by a computer, including but not limited to magnetic storage (e.g., floppy disks, hard disks, tape, MO, etc.), optical storage (e.g., CD, DVD, BD, HVD, etc.), and semiconductor storage (e.g., ROM, EPROM, EEPROM, NAND FLASH, SSD, etc.), etc.

[0139] The storage medium of the above embodiments stores computer instructions for causing the computer to perform the API generation method as described in any of the above exemplary method embodiments, and has the beneficial effects of the corresponding method embodiments, which are not repeated here.

[0140] Those skilled in the art know that the embodiments of the present disclosure can be implemented as a system, a method, or a computer program product. Therefore, the present disclosure can be embodied in the form of entire hardware, entire software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, which are generally referred to herein as "circuitry", "module" or "system". In addition, in some embodiments, the present disclosure can also be embodied in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.

[0141] Any combination of one or more computer-readable media can be employed. The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium can include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0142] The computer readable medium can include a transmission line, a carrier wave propagating through program instructions, a computer readable storage medium, or memory medium encoding a computer program of instructions. As used herein, the term "computer-readable storage medium" encompasses only a tangible computer-readable medium that can be targeted to or transitory signals per se. By way of example, and not limitation, a computer-readable storage medium can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other tangible medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, or twisted pair, then the coaxial cable, fiber optic cable, or twisted pair are included in the definition of medium. Disk and disc, as used herein, include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), and Blu-Ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0143] In one embodiment, the computer readable program instructions are executed by one or more processors of a computer.

[0144] Computer readable program instructions for carrying out operations of the present disclosure can be written in any of a number of programming languages or combinations of languages including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, application specific circuitry, or field programmable gate array (FPGA) circuitry can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform operational actions.

[0145] It should be understood that each block of the flowchart and / or block diagram illustrations, and combinations of blocks in the flowchart and / or block diagram illustrations, can be implemented by computer program instructions. Such computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0146] These computer program instructions can also be stored in a computer- readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer-readable medium produce an article of manufacture including instructions which implement the function / act specified in the flowchart and / or block diagram block or blocks. The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0147] Further, although operations of the disclosed methods are described in a particular order in the figures, this is not meant to imply that operations are required to be performed in this particular order, or that all illustrated operations are required to achieve a desired result. Rather, the steps depicted in the flowcharts can be changed, performed in an alternative order, omitted, combined, and / or divided into multiple steps.

[0148] The use of the verbs "comprise", "belong", "contain", "have", "include", "possess", "provide", "store", "take", "terminate", or their conjugates are not intended to exclude the presence of elements or steps other than those listed in the claims. The articles "a" and "an" preceding an element are intended to be equivalent to "one or more" of that element.

[0149] While the spirit and principles of the disclosure have been described with reference to several specific implementations, it is to be understood that the disclosure is not limited to the specific implementations disclosed and that the division into aspects is not meant to imply that features from one aspect cannot be combined with features from another aspect to advantage. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the appended claims is to be construed according to the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

Claims

1. A method for generating an application programming interface (API), comprising: The system receives API element information input by the user and the downstream service interface corresponding to the API selected by the user; wherein, the API element information includes: the API interface name, the API address, and the API request method; The request parameters and response parameters of the downstream service interface are retrieved according to the downstream service interface. Generate at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface; Based on the API's element information, the downstream service interface, the at least one API request parameter, the at least one API response parameter, the mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the at least one API response parameter, a rule engine corresponding to the API is generated. The rule engine records the API's interface name, API address, API request method, the name and type of the API request parameter, the name and type of the API response parameter, the mapping relationship between the API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the API response parameter. The rule engine is used to implement the mapping from the API to the downstream service interface to complete the invocation of the downstream service interface. The rule engine corresponding to the API is stored at the address of the API to generate the API.

2. The method according to claim 1, wherein, The downstream service interface corresponding to the API selected by the user includes: Receive the downstream service framework selected by the user corresponding to the API; Determine the list of downstream service interfaces included in the downstream service framework; Display a list of the downstream service interfaces; and Receive the downstream service interface selected by the user from the list of downstream service interfaces.

3. The method according to claim 2, wherein, The step of retrieving the request parameters and response parameters of the downstream service interface based on the downstream service interface includes: Retrieve the interface description file corresponding to the downstream service framework; and Extract the request parameters and response parameters of the downstream service interface from the interface description file.

4. The method according to claim 2, wherein, The downstream service framework corresponding to the API selected by the user includes: Displays a list of downstream service protocols that include at least one downstream service protocol; Receive the downstream service protocol selected by the user from the list of downstream service protocols; Determine the list of downstream service frameworks included in the downstream service protocol; Display a list of the downstream service frameworks; and Receive the downstream service framework selected by the user from the list of downstream service frameworks.

5. The method according to claim 1, wherein, The generation of at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface includes: In response to detecting that a user has selected to generate API parameters, at least one API request parameter corresponding one-to-one with the request parameters of the downstream service interface is generated, and at least one API response parameter corresponding one-to-one with the response parameters of the downstream service interface is generated; and Display the at least one API request parameter, at least one API response parameter, the mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the at least one API response parameter.

6. The method according to claim 5, wherein, The method further includes: In response to detecting that a user has added a custom API request parameter, the system receives the name and type of the API request parameter input by the user, receives the target request parameter of the downstream service interface selected by the user corresponding to the custom API request parameter, and establishes a mapping relationship between the custom API request parameter and the target request parameter of the downstream service interface; or, In response to detecting that a user has added a custom API response parameter, the system receives the name and type of the API response parameter input by the user, receives the target response parameter of the downstream service interface selected by the user that corresponds to the custom API response parameter, and establishes a mapping relationship between the custom API response parameter and the target response parameter of the downstream service interface.

7. The method according to claim 5 or 6, wherein, The method further includes: In response to detecting that a user has modified the parameters of the first API request or the first API response, a parameter attribute setting interface is displayed; wherein, the attribute includes: the parameter format, enumeration type, default value, conversion function, validation condition, and one or any combination thereof. Receive the attribute values ​​of the first API request parameters or the first API response parameters input by the user; The attributes of the first API request parameter or the first API response parameter are set based on the attribute values.

8. The method according to claim 5 or 6, wherein, The method further includes: In response to the detection of a user setting a plugin, the plugin input interface is displayed; The plugin input interface receives plugin content from the user; wherein the plugin content includes: plugin name, plugin input parameters, plugin output parameters, and plugin program; and Add the plugin content to the rule engine.

9. The method according to claim 5 or 6, wherein, The method further includes: In response to detecting that a user has deleted a second API request parameter, delete the second API request parameter and remove the mapping relationship between the second API request parameter and the request parameters of the downstream service interface; or, In response to detecting that a user has deleted the second API response parameter, the second API response parameter is deleted and the mapping relationship between the response parameters of the downstream service interface and the second API response parameter is deleted.

10. The method according to claim 1, wherein, The method further includes: Based on the API's element information and at least one API request parameter, generate blank test cases for the API. Receive parameter values ​​of at least one request parameter input by the user; and Test cases for the API are generated based on the blank test cases and the parameter values ​​of the at least one request parameter.

11. The method according to claim 1, wherein, The API's element information further includes: the API's interface description; wherein, The method further includes: generating an interface description document for the API based on the API's element information, the at least one API request parameter, the at least one API response parameter, and a pre-set interface description document template.

12. The method according to claim 1, wherein, The API's element information further includes: authentication type information.

13. The method according to claim 1, wherein, The method further includes: In response to detecting a user browsing a third API, the feature information and parameter configuration information of the third API, as well as the feature information and parameter configuration information of the fourth API stored under the address information of the third API, are obtained. The feature information and parameter configuration information of the third API are compared with the feature information and parameter configuration information of the fourth API, respectively; and Display the feature information and parameter configuration information of the third API; wherein, when displaying the feature information and parameter configuration information of the third API, highlight the information that differs from the feature information and parameter configuration information of the fourth API.

14. An application programming interface (API) generation apparatus, comprising: An information receiving unit is used to receive API element information input by a user and downstream service interfaces corresponding to the API selected by the user; wherein, the API element information includes: the API interface name, the API address, and the API request method. The downstream service interface parameter extraction unit is used to extract the request parameters and response parameters of the downstream service interface according to the downstream service interface. The API parameter generation unit is used to generate at least one API request parameter corresponding to the request parameters of the downstream service interface and at least one API response parameter corresponding to the response parameters of the downstream service interface. A rule engine generation unit is used to generate a rule engine corresponding to the API based on the API's element information, the downstream service interface, the mapping relationship between the at least one API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the response parameter of the at least one API. The rule engine corresponding to the API records the API's interface name, API address, API request method, the name and type of the API request parameter, the name and type of the API response parameter, the mapping relationship between the API request parameter and the request parameter of the downstream service interface, and the mapping relationship between the response parameter of the downstream service interface and the API response parameter. The rule engine corresponding to the API is used to implement the mapping from the API to the downstream service interface to complete the invocation of the downstream service interface. A storage unit is used to store the rule engine corresponding to the API at the address of the API in order to generate the API.

15. A computer device, comprising: One or more processors and memory; as well as One or more programs; The one or more programs are stored in the memory and executed by the one or more processors, the programs including instructions for performing the API generation method according to any one of claims 1 to 13.

16. A non-volatile computer-readable storage medium comprising a computer program, which, when executed by one or more processors, causes the processors to perform the API generation method of any one of claims 1 to 13.

17. A computer program product comprising computer program instructions that, when executed on a computer, cause the computer to perform the API generation method as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • System interface docking method and device, medium and electronic equipment

    CN111158661A

  • Interface configuration method and device, computer equipment and storage medium

    CN113900725A