Application Programming Interface API Template Generation Method and System
By receiving and classifying APIs, extracting common configuration attributes to generate API templates, solving the problem of low API template generation efficiency in the existing technology, and achieving a more efficient development process.
Patent Information
- Application Number
- CN202010261467.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-03
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2040-04-03
AI Technical Summary
In the prior art, the generation efficiency of API templates is low, resulting in low development efficiency.
By receiving multiple APIs, classifying and extracting common configuration properties of the first type of API, generating corresponding API templates, simplifying the production process and improving generation efficiency.
Simplifies the production process of API templates, improves the generation efficiency of API templates, and improves the development efficiency.
Smart Images

Figure CN113495721B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of information technology, and in particular to a method and system for generating an application programming interface (API) template. Background Art
[0002] Applications based on Internet scenarios are becoming more and more popular. More and more sites integrate their own resources and open them to developers through a unified application programming interface (API) gateway. Since many APIs are similar, redeveloping the API for each solution will result in poor resource reuse and low efficiency. Therefore, you can extract a template for similar APIs, and then reuse the template to develop APIs, which can improve development efficiency.
[0003] In the prior art, developers usually create corresponding API templates according to template scenario requirements, and then configure related configuration attributes for the API templates according to business scenarios, such as authentication strategies, flow control strategies, etc. However, the existing API template creation method is relatively cumbersome, which leads to low efficiency in generating API templates. Summary of the invention
[0004] The embodiments of the present application provide a method and system for generating an application programming interface (API) template to solve the problem of low efficiency in generating API templates in the prior art.
[0005] The first aspect provides a method for generating an application programming interface API template, which is applied to an API template generation system, comprising: first, receiving multiple APIs, wherein the multiple APIs contain configuration attributes of the APIs. Subsequently, the multiple APIs are classified, and according to the configuration attributes of the first type of APIs, the common configuration attributes of the first type of APIs are obtained. Finally, according to the common configuration attributes of the first type of APIs, a first API template corresponding to the first type of API is generated, wherein the first API template is used to generate the first type of API based on the input API generation data reuse.
[0006] Through the method for generating an application programming interface API template provided by the first aspect, a first API template corresponding to the first type of API is generated by extracting the common configuration properties of the first type of API, thereby simplifying the API template production process and improving the API template generation efficiency.
[0007] In a possible implementation manner, classifying the multiple APIs includes: classifying the multiple APIs according to the service type, access method or orchestration method of the APIs.
[0008] Through this possible implementation, multiple APIs are classified according to the business type, access method or orchestration method of the API, so that corresponding API models can be generated according to the same type of APIs.
[0009] In one possible implementation, obtaining common configuration attributes of the first type of API based on the configuration attributes of the first type of API includes: obtaining configuration attributes with the same configuration attribute identifier from the configuration attributes of the first type of API as the common configuration attributes of the first type of API.
[0010] Through this possible implementation, the common configuration attributes of the API can be obtained from the configuration attributes of the API according to the configuration attribute identifier.
[0011] In a possible implementation, the configuration attribute identifier includes at least one of the following: an API displacement identifier, a resource unique identifier, a configuration unique identifier, and a policy type identifier.
[0012] In one possible implementation, after generating the first API template corresponding to the first type of API, the method further includes: receiving a configuration attribute change request input by a user, the configuration attribute change request including changed configuration attributes; and changing the configuration attributes of the first API template according to the configuration attribute change request.
[0013] Through this possible implementation, after completing the configuration of the API template, if a special API needs to be generated, the configuration properties of the API template can be adjusted through a configuration property change request.
[0014] In a possible implementation, the configuration attributes include endpoint configuration attributes and public definition configuration attributes.
[0015] In a possible implementation, the endpoint configuration attributes include a service address and / or an authentication policy.
[0016] In a possible implementation, the public definition configuration attribute includes at least one of the following: variable definition, dictionary value mapping, key association, user group management, public function, public process, error code and public policy.
[0017] A second aspect provides a system for generating an application programming interface (API) template, characterized by comprising:
[0018] A receiving module, used for receiving a plurality of APIs, wherein the plurality of APIs include configuration attributes of the APIs;
[0019] A processing module is used to classify the multiple APIs; obtain the common configuration attributes of the first type of API according to the configuration attributes of the first type of API; generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, and the first API template is used to generate the first type of API based on the input API generation data reuse.
[0020] In a possible implementation, the processing module is specifically configured to classify the multiple APIs according to the service type, access method, or orchestration method of the APIs.
[0021] In a possible implementation, the processing module is specifically configured to obtain configuration attributes having the same configuration attribute identifier from the configuration attributes of the API of the first type as the common configuration attributes of the API of the first type.
[0022] In a possible implementation, the configuration attribute identifier includes at least one of the following: an API displacement identifier, a resource unique identifier, a configuration unique identifier, and a policy type identifier.
[0023] In a possible implementation, the receiving module is further configured to receive a configuration attribute change request input by a user, wherein the configuration attribute change request includes a changed configuration attribute;
[0024] The processing module is further used to change the configuration attributes of the first API template according to the configuration attribute change request.
[0025] In a possible implementation, the configuration attributes include endpoint configuration attributes and public definition configuration attributes.
[0026] In a possible implementation, the endpoint configuration attributes include a service address and / or an authentication policy.
[0027] In a possible implementation, the public definition configuration attribute includes at least one of the following: variable definition, dictionary value mapping, key association, user group management, public function, public process, error code and public policy.
[0028] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0029] Wherein, the memory is used to store executable instructions of the processor;
[0030] The processor is configured to execute the method for generating an application programming interface API template described in the first aspect above.
[0031] A fourth aspect provides a program, which, when executed by a processor, is used to execute the method for generating an application programming interface API template described in the first aspect above.
[0032] A fifth aspect provides a program product, such as a computer-readable storage medium, comprising the program of the fourth aspect.
[0033] In the seventh aspect, an embodiment of the present application provides a chip, including: a memory and a processor, the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the method for generating a program programming interface API template described in the first aspect.
[0034] The eighth aspect provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method for generating an application programming interface API template described in the first aspect.
[0035] The method and device for generating an application programming interface (API) template provided in the embodiment of the present application receives multiple APIs, each of which contains configuration attributes of the APIs, and then classifies the multiple APIs, and obtains the common configuration attributes of the first type of APIs according to the configuration attributes of the first type of APIs, and finally generates a first API template corresponding to the first type of API according to the common configuration attributes of the first type of APIs, and the first API template is used to generate the first type of API based on the input API generation data reuse. In this method, the first API template corresponding to the first type of API is generated by extracting the common configuration attributes of the first type of API, thereby simplifying the production process of the API template and improving the efficiency of generating the API template. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic diagram of an application scenario of an API template generation system provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of an application scenario of another API template generation system provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0039] Figure 4 A flowchart of a method for generating an API template provided in an embodiment of the present application;
[0040] Figure 5 A schematic diagram of API classification provided in an embodiment of the present application;
[0041] Figure 6 A flowchart of another method for generating an API template provided in an embodiment of the present application;
[0042] Figure 7 A flowchart of another method for generating an API template provided in an embodiment of the present application;
[0043] Figure 8 A schematic diagram of the structure of a system for generating an API template provided in an embodiment of the present application;
[0044] Fig. 9 A schematic diagram of the structure of another computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] Applications based on Internet scenarios are becoming more and more popular. More and more sites integrate their own resources and open them to developers through a unified application programming interface (API) gateway. Since many APIs are similar, redeveloping the API for each solution will result in poor resource reuse and low efficiency. Therefore, you can extract a template for similar APIs, and then reuse the template to develop APIs, which can improve development efficiency.
[0046] In the prior art, developers usually create corresponding API templates according to template scenario requirements, and then configure related configuration attributes for the API templates according to business scenarios, such as authentication strategies, flow control strategies, etc. However, the existing API template creation method is relatively cumbersome, which leads to low efficiency in generating API templates.
[0047] To solve the above problems, the present application provides a method and system for generating an application programming interface (API) template to improve the efficiency of generating API templates. In the present application, by classifying existing APIs and associating the same configuration attributes to automatically generate API templates, there is no need to configure the associated configuration attributes for the API templates one by one according to the business scenario, which simplifies the production process of API templates and improves the efficiency of generating API templates.
[0048] Figure 1 A schematic diagram of an application scenario of an API template generation system provided in an embodiment of the present application, such as Figure 1As shown, in one embodiment, the API template generation system 100 can be deployed entirely in a cloud environment. A cloud environment is an entity that uses basic resources to provide cloud services to users in a cloud computing model. The cloud environment includes a cloud data center and a cloud service platform. The cloud data center includes a large number of basic resources (including computing resources, storage resources, and network resources) owned by a cloud service provider. The computing resources included in the cloud data center can be a large number of computing devices (such as servers). For example, taking the computing resources included in the cloud data center as a server running a virtual machine, the API template generation system 100 can be independently deployed on a server or virtual machine in a cloud data center. The API template generation system 100 can also be distributedly deployed on multiple servers in a cloud data center, or distributedly deployed on multiple virtual machines in a cloud data center, or distributedly deployed on servers and virtual machines in a cloud data center.
[0049] like Figure 1 As shown, the API template generation system 100 can be provided to users by the cloud service provider as an API template generation service on the cloud service platform. After the user purchases the cloud service on the cloud service platform (for example, pre-charge can be made and then settled according to the final resource usage), the cloud environment uses the API template generation system 100 deployed in the cloud data center to provide users with API model generation services. Users can send multiple APIs to the API template generation system 100. The AI model generation system 100 in the cloud environment receives the APIs sent by the user and performs the operation of automatically generating API templates. The API template generation system 100 then returns the automatically generated target API template to the user.
[0050] Figure 2 This is a schematic diagram of an application scenario of another API template generation system provided in an embodiment of the present application. The deployment of the API template generation system 100 provided in an embodiment of the present application is relatively flexible. Figure 2As shown, in another embodiment, the generation system 100 of the API template provided in the embodiment of the present application can also be distributedly deployed in different environments. The generation system 100 of the API template provided in the present application can be logically divided into multiple parts, each of which has different functions. The various parts in the generation system of the API template can be deployed in any two or three of the terminal computing device (located on the user side), the edge environment and the cloud environment. The terminal computing device located on the user side may include, for example, at least one of the following: a terminal server, a smart phone, a laptop, a tablet computer, a personal desktop computer, a smart camera, etc. The edge environment is an environment including a collection of edge computing devices that are close to the terminal computing device, and the edge computing device includes: an edge server, an edge station with computing power, etc. The various parts of the generation system 100 of the API template deployed in different environments or devices cooperate to provide users with the function of automatically generating API templates. It should be understood that the embodiment of the present application does not restrictively divide which parts of the generation system 100 of the API template are deployed in what environment. In actual application, it can be adaptively deployed according to the computing power of the terminal computing device, the resource occupancy of the edge environment and the cloud environment, or the specific application requirements. Figure 2 It is a schematic diagram of an application scenario in which an API template generation system 100 is deployed in an edge environment and a cloud environment as an example.
[0051] The API template generation system 100 can also be deployed separately on a computing device in any environment (for example, deployed separately on an edge server in an edge environment). Figure 3 is a schematic diagram of the hardware structure of the computing device 200, Figure 3 The computing device 200 shown includes a memory 201, a processor 202, and a communication interface 203. The memory 201, the processor 202, and the communication interface 203 are communicatively connected to each other. For example, the memory 201, the processor 202, and the communication interface 203 can be communicatively connected by a network connection. Alternatively, the computing device 200 may further include a bus 204. The memory 201, the processor 202, and the communication interface 203 are communicatively connected to each other via the bus 204. Figure 3 The computing device 200 is a memory 201 , a processor 202 , and a communication interface 203 that are communicatively connected to each other via a bus 204 .
[0052] The memory 201 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 201 may store a program. When the program stored in the memory 201 is executed by the processor 202, the processor 202 and the communication interface 203 are used to execute the program. Figure 3 The provided API template generation system 100 is a method for users to automatically generate target API templates. The memory can also store Figure 3 The provided API template generation system 100 automatically generates data required by a target API template, for example, a historical API.
[0053] The processor 202 may be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more integrated circuits.
[0054] The processor 202 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, the functions of the API template generation system 100 of the present application may be completed by hardware integrated logic circuits or software instructions in the processor 202. The above-mentioned processor 202 may also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps and logic block diagrams disclosed in the embodiments below of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments below in conjunction with the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 202 reads the information in the memory 201 and combines its hardware to complete the functions of the API template generation system 100 of the embodiment of the present application.
[0055] The communication interface 203 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the computing device 200 and other devices or a communication network. For example, a data set can be obtained through the communication interface 203 .
[0056] When the computing device 200 described above includes a bus 204 , the bus 204 may include a path for transmitting information between various components of the computing device 200 (eg, the memory 201 , the processor 202 , and the communication interface 203 ).
[0057] The following is a detailed description of the technical solution of how to automatically generate an API template in the embodiment of the present application in conjunction with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0058] Figure 4 A flowchart of a method for generating an API template provided in an embodiment of the present application is provided. The method can be executed by a system for generating an API template, such as Figure 4 As shown, the method includes:
[0059] S301. Receive multiple APIs, where the multiple APIs include configuration attributes of the APIs.
[0060] In this embodiment, the API template generation system can receive multiple APIs, wherein the above multiple APIs can be input by a user, or the above multiple APIs can also be sent to the API template generation system by other devices in the network. This embodiment of the application does not limit this.
[0061] It should be noted that the multiple APIs received in the embodiment of the present application may be existing APIs. In addition, the embodiment of the present application does not limit the types of the multiple APIs and can be specifically set according to actual conditions.
[0062] In some embodiments, if the user has not saved an existing API, the user may instruct the API template generation system to actively obtain multiple APIs, and the API template generation system will actively store the multiple APIs on the network or in a storage device.
[0063] S302, classify multiple APIs.
[0064] In this embodiment, after receiving multiple APIs, the API template generation system may classify the multiple APIs.
[0065] The embodiment of the present application does not limit how to classify multiple APIs, and multiple APIs can be classified in a classification method indicated by the user.
[0066] In an optional implementation, the API template generation system can classify multiple APIs according to the API's business type, access method, or orchestration method. In another optional implementation, the API template generation system can also classify multiple APIs according to the API's protocol, version, orchestration method, and calling process.
[0067] For example, a business scenario has multiple APIs, some of which are for querying user information. These APIs all provide REST protocol access, all have version V1.0.0, are orchestrated through processes, and are called by calling the same third-party service. Therefore, these APIs can be grouped together according to the different classification requirements entered by the user to generate a template.
[0068] Figure 5 This is a schematic diagram of API classification provided in the embodiment of the present application. Figure 5 The following table shows the same type of API. In the process of dividing API, users can enter the API status, protocol, version and orchestration method, and divide the API based on this. In this type of API, the status of all APIs is under development, the protocol is REST, the version is V1.0.0, and the orchestration method is process.
[0069] S303: Acquire common configuration attributes of the first type of API according to the configuration attributes of the first type of API.
[0070] In this embodiment, after the API template generation system classifies multiple APIs, the common configuration attributes of the first type of APIs can be acquired according to the configuration attributes of the first type of APIs.
[0071] The configuration attributes of the API may include endpoint configuration attributes and public definition configuration attributes.
[0072] In an optional implementation, the endpoint configuration attributes include a service address and / or an authentication policy. The endpoint refers to the service specifically called by the API, that is, the service that can implement the data required by the API, and correspondingly, the endpoint service refers to the downstream service.
[0073] In an optional implementation, the public definition configuration attribute includes at least one of the following: variable definition, dictionary value mapping, key association, user group management, public function, public process, error code and public policy. Specifically, the public definition configuration attribute refers to the API common attribute configuration.
[0074] Exemplarily, if the API for querying user information is classified as the first API, then several APIs in the first API all call the same third-party service UserService, but the specific operation resources are different, and the system will use the UserService service identifier as a public attribute. Secondly, several APIs in the first API are configured with the same public definition attributes (which can be variable definitions, dictionary value mappings, and error codes, etc.), and the API template generation system will automatically identify and extract the common attributes based on the association relationship of the public definition configuration attributes used by the API. Among them, the association relationship between the API and the public definition configuration attributes can be determined by the four attribute identifiers of the API's unique identifier apiId, the resource's unique identifier reopId, the configuration's unique identifier publicPolicyId, and the policy type type to determine the API's common configuration attributes. The API template generation system can accurately locate the common configuration attributes used by the specific API through these four attributes.
[0075] S304: Generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, where the first API template is used to generate the first type of API by multiplexing according to the input API generation data.
[0076] In this embodiment, after the API template generation system obtains the common configuration attributes of the first type of API according to the configuration attributes of the first type of API, it can generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API.
[0077] In some embodiments, the common configuration attributes of the API can be stored by the API template generation system. When generating the API template, the API template generation system will automatically identify and extract the common configuration attributes based on the stored common configuration attributes of the API to generate the configuration attributes of the API template.
[0078] For example, if the API template generation system has stored the configuration attributes (endpoint services and public definitions) used by the API, the system will extract the common configuration attributes by reading the stored data: the endpoint services share a UserService service, and the public definition configuration attributes use the same variable definition endpointUrl. The system will extract these two attributes as the configuration attributes of the API template.
[0079] The efficient API definition template solution provided in this application makes full use of the already produced APIs, automatically generates API templates by classifying the existing APIs, identifying and associating configuration attributes, thereby simplifying the production process, lowering the production threshold, and improving development efficiency.
[0080] The method for generating an application programming interface (API) template provided in the embodiment of the present application receives multiple APIs, each of which contains configuration attributes of the APIs, and then classifies the multiple APIs, and obtains the common configuration attributes of the first type of APIs according to the configuration attributes of the first type of APIs, and finally generates a first API template corresponding to the first type of API according to the common configuration attributes of the first type of APIs, and the first API template is used to generate the first type of API based on the input API generation data reuse. In this method, the first API template corresponding to the first type of API is generated by extracting the common configuration attributes of the first type of API, thereby simplifying the production process of the API template and improving the efficiency of generating the API template.
[0081] Based on the above embodiment, how to obtain the common configuration attributes of the first type of API is described below. Figure 6 A flowchart of another method for generating an API template provided in an embodiment of the present application, which method can be executed by a system for generating an API template, such as Figure 6 As shown, the method includes:
[0082] S401. Receive multiple APIs, where the multiple APIs include configuration attributes of the APIs.
[0083] S402: Classify the multiple APIs.
[0084] In this embodiment, the specific implementation process and implementation principle of steps S401-S402 are the same as Figure 3 The steps S301-S302 are similar and will not be described again here.
[0085] S403: Acquire configuration attributes having the same configuration attribute identifier from configuration attributes of the first type of API as common configuration attributes of the first type of API.
[0086] In this step, after classifying the multiple APIs, the API template generation system can obtain configuration attributes with the same configuration attribute identifier from the configuration attributes of the first type of APIs as the common configuration attributes of the first type of APIs.
[0087] The configuration attribute identifier includes at least one of the following: an API displacement identifier, a resource unique identifier, a configuration unique identifier, and a policy type identifier.
[0088] For example, the association between an API and a public defined configuration attribute can be determined by four attribute identifiers: the unique identifier of the API, apiId; the unique identifier of the resource, reopId; the unique identifier of the configuration, publicPolicyId; and the type of the policy, type. The API template generation system can accurately locate the common configuration attributes used by a specific API through these four attributes.
[0089] S404: Generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, where the first API template is used to generate the first type of API by multiplexing according to the input API generation data.
[0090] In this embodiment, the specific implementation process and implementation principle of step S404 are the same as Figure 3 The process is similar to step S304 in the above process and will not be described again here.
[0091] The method for generating an application programming interface API template provided in an embodiment of the present application receives multiple APIs, each of which contains configuration attributes of the APIs, and then classifies the multiple APIs, and obtains configuration attributes with the same configuration attribute identifier from the configuration attributes of the first type of APIs as the common configuration attributes of the first type of APIs, and finally generates a first API template corresponding to the first type of API based on the common configuration attributes of the first type of APIs, and the first API template is used to generate the first type of API based on the input API generation data reuse. In this method, the first API template corresponding to the first type of API is generated by extracting the common configuration attributes of the first type of API, thereby simplifying the production process of the API template and improving the efficiency of generating the API template.
[0092] Based on the above embodiments, the API template generated by the API generation system can be reused in business offices. Because the business scenarios of each business office are different, the required configuration attribute values are also different. In order to meet the needs of different scenarios, the reused API needs to support secondary development and support customized modification of configuration attributes. The following describes how the API generation system performs secondary development on the API template.
[0093] Figure 7 A flowchart of another method for generating an API template provided in an embodiment of the present application is provided. The method can be executed by a system for generating an API template, such as Figure 7 As shown, the method includes:
[0094] S501. Receive multiple APIs, where the multiple APIs include configuration attributes of the APIs.
[0095] S502: Classify multiple APIs.
[0096] S503: Acquire common configuration attributes of the first type of API according to the configuration attributes of the first type of API.
[0097] S504: Generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, where the first API template is used to generate the first type of API by multiplexing according to the input API generation data.
[0098] In this embodiment, the specific implementation process and implementation principle of steps S401-S404 are the same as Figure 3 The steps S301-S304 are similar and will not be described again here.
[0099] S505: Receive a configuration attribute change request input by a user, where the configuration attribute change request includes a changed configuration attribute.
[0100] S506: Change the configuration attributes of the first API template according to the configuration attribute change request.
[0101] In steps S505 and S506, after the API template generation system generates the first API template corresponding to the first type of API based on the common configuration properties of the first type of API, it can receive a configuration property change request input by the user, and then change the configuration properties of the first API template based on the configuration property change request.
[0102] In some embodiments, the API template generation system can open a configuration interface, and the user can modify the corresponding configuration parameter value based on the configuration parameter template generated above, thereby realizing customized development of business scenarios and meeting business demands. Subsequently, the user can send a configuration attribute change request to the API template generation system based on the changed configuration attribute, and the API template generation system changes the configuration attribute of the first API template according to the configuration attribute change request.
[0103] For example, the default values of the endpointUrl attribute in the variable definition of the API template are the local IP and Port. However, the specific service configuration of the site varies in different environments, so you need to modify the endpointUrl attribute value according to the environment information of your service and send an attribute change request to the API template generation system to change the endpointUrl attribute value to meet business requirements.
[0104] The method for generating an application programming interface API template provided in an embodiment of the present application receives multiple APIs, each of which includes configuration attributes of the API, and then classifies the multiple APIs, and obtains the common configuration attributes of the first type of API according to the configuration attributes of the first type of API, and then generates a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, and the first API template is used to reuse the input API generation data to generate the first type of API. Finally, a configuration attribute change request input by the user is received, the configuration attribute change request includes the changed configuration attributes, and the configuration attributes of the first API template are changed according to the configuration attribute change request. In this way, after the API template generated by the API template generation system is reused by different businesses, it supports the modification of configuration attribute values, meets the demands of different business scenarios, and realizes customized development of business scenarios.
[0105] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.
[0106] Figure 8 A schematic diagram of a system for generating an API template provided in an embodiment of the present application. The system 600 for generating an API template can be used to execute the method for generating an API template in the above embodiment, and the system 600 for generating an API template includes a receiving module 601 and a processing module 602.
[0107] The receiving module 601 is used to receive multiple APIs, where the multiple APIs include configuration attributes of the APIs.
[0108] Processing module 602 is used to classify multiple APIs; obtain the common configuration attributes of the first type of API according to the configuration attributes of the first type of API; generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, and the first API template is used to generate data based on the input API to reuse the generated first type of API.
[0109] In an optional implementation, the processing module is specifically used to classify multiple APIs according to the business type, access method or orchestration method of the API.
[0110] In an optional implementation, the processing module 602 is specifically configured to obtain configuration attributes having the same configuration attribute identifier from the configuration attributes of the first type of API as the common configuration attributes of the first type of API.
[0111] In an optional implementation manner, the configuration attribute identifier includes at least one of the following: an API displacement identifier, a resource unique identifier, a configuration unique identifier, and a policy type identifier.
[0112] In an optional implementation, the receiving module 601 is further configured to receive a configuration attribute change request input by a user, where the configuration attribute change request includes a changed configuration attribute;
[0113] The processing module 602 is further configured to change the configuration attributes of the first API template according to the configuration attribute change request.
[0114] In an optional implementation, the configuration attributes include endpoint configuration attributes and public definition configuration attributes.
[0115] In an optional implementation, the endpoint configuration attributes include a service address and / or an authentication policy.
[0116] In an optional implementation, the public definition configuration attributes include at least one of the following: variable definition, dictionary value mapping, key association, user group management, public function, public process, error code and public policy.
[0117] The API template generation system in this embodiment is used to implement the API template generation method in the above embodiment. Its specific implementation principle and implementation process are similar and will not be repeated here.
[0118] The present application also provides a Figure 3 In the computing device 200 shown, the processor 202 in the computing device 200 reads the program and API stored in the memory 201 to execute the API template generation method executed by the aforementioned API template generation system.
[0119] Fig. 9 A schematic diagram of another computing device provided in an embodiment of the present application. Since each module in the API template generation system 100 provided in the present application can be distributedly deployed on multiple computers in the same environment or in different environments, the present application also provides a Fig. 9 The computing device shown includes multiple computers 300, each of which includes a memory 301, a processor 302, a communication interface 303, and a bus 304. The memory 301, the processor 302, and the communication interface 303 are connected to each other through the bus 304.
[0120] The memory 301 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 301 may store a program. When the program stored in the memory 301 is executed by the processor 302, the processor 302 and the communication interface 303 are used to execute a part of the method in which the API template generation system automatically generates an API template for a user.
[0121] The processor 302 may be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more integrated circuits.
[0122] The processor 302 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, some or all of the functions of the generation system of the API template of the present application may be completed by the hardware integrated logic circuit or software instructions in the processor 302. The above-mentioned processor 302 may also be a general-purpose processor, a digital signal processor (Digital Signal Processing, DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the above embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly embodied as a hardware decoding processor for execution, or may be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 301, and the processor 302 reads the information in the memory 301 and completes part of the functions of the API template generation system of the embodiment of the present application in combination with its hardware.
[0123] The communication interface 303 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the computer 300 and other devices or communication networks. For example, a data set can be obtained through the communication interface 303 .
[0124] Bus 304 may include a path for transmitting information between various components of computer 300 (eg, memory 301 , processor 302 , communication interface 303 ).
[0125] A communication path is established between each of the above computers 300 through a communication network. Any one or more of the user I / O module 11 and the model generation module 12 are run on each computer 300. Any computer 300 can be a computer in a cloud data center (e.g., a server), a computer in an edge data center, or a terminal computing device.
[0126] The descriptions of the processes corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0127] An embodiment of the present application also provides a program, which, when executed by a processor, is used to execute the method provided in the above method embodiment.
[0128] The embodiment of the present application also provides a program product, such as a computer-readable storage medium, in which instructions are stored. When the program product is run on a computer, the computer executes the method provided by the above method embodiment.
[0129] An embodiment of the present application provides a chip, including: a memory and a processor, the memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the method provided by the above method embodiment.
[0130] An embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned method for generating an application programming interface API template.
[0131] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital driver line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
Claims
1. A method for generating an application programming interface API template, applied to an API template generation system, characterized in that: include: Receiving a plurality of APIs, wherein the plurality of APIs include configuration properties of the APIs; The configuration attributes include endpoint configuration attributes and public definition configuration attributes; wherein the endpoint configuration attributes include service addresses and / or authentication policies, and the public definition configuration attributes include at least one of the following: variable definition, dictionary value mapping, key association, user group management, public functions, public processes, error codes, and public policies; Classify the multiple APIs; According to the configuration attributes of the first type of API, obtain the common configuration attributes of the first type of API; Generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of API, wherein the first API template is used to generate the first type of API according to input API generation data and reuse the first API template; The multiple APIs are classified into categories, including: The multiple APIs are classified according to the service type, access method or orchestration method of the API.
2. The method according to claim 1, characterized in that The acquiring, according to the configuration attributes of the first type of API, the common configuration attributes of the first type of API comprises: From the configuration attributes of the API of the first type, configuration attributes with the same configuration attribute identifier are obtained as common configuration attributes of the API of the first type.
3. The method according to claim 2, characterized in that The configuration attribute identifier includes at least one of the following: a unique identifier of an API, a unique identifier of a resource, a unique identifier of a configuration, and a type identifier of a policy.
4. The method according to claim 1, characterized in that: After generating the first API template corresponding to the first type of API, the method further includes: Receiving a configuration attribute change request input by a user, wherein the configuration attribute change request includes a changed configuration attribute; According to the configuration attribute change request, the configuration attributes of the first API template are changed.
5. A system for generating an application programming interface API template, characterized in that: include: A receiving module, configured to receive a plurality of APIs, wherein the plurality of APIs include configuration attributes of the APIs; the configuration attributes include endpoint configuration attributes and public definition configuration attributes; wherein the endpoint configuration attributes include a service address and / or an authentication policy, and the public definition configuration attributes include at least one of the following: variable definition, dictionary value mapping, key association, user group management, public function, public process, error code, and public policy; A processing module, configured to classify the multiple APIs; obtain the common configuration attributes of the first type of APIs according to the configuration attributes of the first type of APIs; generate a first API template corresponding to the first type of API according to the common configuration attributes of the first type of APIs, wherein the first API template is used to generate the first type of API according to the input API generation data and reuse the first API template; The processing module is specifically used to classify the multiple APIs according to the service type, access method or arrangement method of the API.
6. The system according to claim 5, characterized in that The processing module is specifically configured to obtain configuration attributes having the same configuration attribute identifier from the configuration attributes of the API of the first type as the common configuration attributes of the API of the first type.
7. The system according to claim 6, characterized in that The configuration attribute identifier includes at least one of the following: a unique identifier of an API, a unique identifier of a resource, a unique identifier of a configuration, and a type identifier of a policy.
8. The system according to claim 5, characterized in that The receiving module is further used to receive a configuration attribute change request input by a user, wherein the configuration attribute change request includes a changed configuration attribute; The processing module is further used to change the configuration attributes of the first API template according to the configuration attribute change request.
Citation Information
Patent Citations
Page construction method and device, computer equipment and storage medium
CN108762729A
Management system and management method based on API
CN110569299A