API (Application Program Interface) determination method and device and computer equipment
By receiving query text in interface call requests, extracting and matching data nodes, and determining the target interface, the cumbersome problem of the API interface retrieval process is solved, efficient management and optimization of the API interface is realized, and system performance and user experience are improved.
Patent Information
- Application Number
- CN202411392142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-17
AI Technical Summary
In the cloud computing environment, the management, testing and optimization of API interfaces are complicated, low efficiency and high error rates, especially in complex and dynamic environments, which lack automation and intelligent support.
By receiving the query text in the interface call request, extracting data nodes, matching the operation steps of the target platform, determining the target interface, realizing the method of determining the target interface in natural language query text, and simplifying the query process of the API interface.
It improves the retrieval efficiency of API interfaces, reduces the need for manual intervention, reduces repetitive work, and improves system performance and user experience.
Smart Images

Figure CN119149568A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software technology, and in particular to a method, device and computer equipment for determining an API. Background Art
[0002] In the cloud computing environment, API (Application Programming Interface) interfaces play an important role in software development, application integration, business process automation, etc. API interfaces are used to connect different software systems, modules, services, etc., and by calling API interfaces, function expansion and business process automation can be achieved. However, the efficiency and quality of API interface calling, using, testing, optimizing and other operations will directly affect the performance of the overall system and the user experience of the final product. Especially in a complex and dynamically changing environment, the APIs are huge in number, complex, and frequently called, which puts higher requirements on the management, testing, and optimization of API interfaces. However, the management, testing, and optimization of API interfaces are currently mainly completed manually, which has a lot of repetitive work, time-consuming, labor-consuming, low efficiency, high error rate, and high maintenance cost. Especially in the retrieval of API interfaces, the following problems exist: the retrieval of API interfaces relies on the developer's in-depth understanding and mastery of the API interfaces, and the retrieval process is too cumbersome, and the retrieval results usually only involve some API interfaces; the retrieval of API interfaces lacks automated and intelligent support, and needs to rely on manual verification and performance evaluation of the interface, which is time-consuming, labor-intensive, inefficient, and has a high error rate. Summary of the invention
[0003] The embodiments of the present application provide a method, apparatus and computer device for determining an API, so as to at least solve the technical problem that the retrieval process of the target interface in the related art is too complicated.
[0004] According to one aspect of an embodiment of the present application, a method for determining an API is provided, comprising: receiving an interface call request, the interface call request comprising a query text, the query text being used to represent description information of a target application program interface API; extracting from the query text a plurality of data nodes in a process of acquiring and calling a target interface, the plurality of data nodes comprising a plurality of operation steps for acquiring data from the outside in a process of calling the target interface; matching the operation steps corresponding to the plurality of data nodes with the operations corresponding to a target platform to determine operation information of the plurality of data nodes within the target platform; and determining the target interface based on the operation information of the plurality of data nodes within the target platform.
[0005] Optionally, extracting multiple data nodes in the process of obtaining and calling the target interface from the query text includes: removing special characters, punctuation marks and spaces in the query text to obtain a processed query text; performing word segmentation processing on the processed query text to obtain multiple word segments, and performing part-of-speech tagging on the multiple word segments to obtain multiple word segmentation after part-of-speech tagging, marking text paragraphs matching the predetermined entity in the multiple word segmentation after part-of-speech tagging according to a predetermined entity to obtain a marked query text, the predetermined entity including at least: a database table name, a uniform resource locator of an API interface and a structured query statement; identifying the marked query text to obtain the multiple data nodes.
[0006] Optionally, the operation steps corresponding to the multiple data nodes are matched with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform, including: traversing each data node among the multiple data nodes to obtain parsing information of each data node, the parsing information at least including: input parameters, output parameters, logical relationships with other data nodes and actions that each data node needs to perform; determining the operation steps corresponding to each data node based on the parsing information; based on the operation steps corresponding to each data node, selecting corresponding operation information from a preset function library of the target platform, and using the operation information selected from the preset function library as the operation information of each data node on the target platform.
[0007] Optionally, based on the operation steps corresponding to each data node, corresponding operation information is selected from a preset function library of the target platform to determine the operation information of each data node on the target platform, including: obtaining a preset function library of the target platform, the preset function library at least including: a mapping relationship between the operation steps corresponding to the data node and the operation steps of the target platform; determining the operation information of the multiple data nodes in the target platform according to the mapping relationship.
[0008] Optionally, the target interface is determined based on the operation information of the multiple data nodes in the target platform, including: determining a standard template corresponding to the interface call request based on the operation information of the multiple data nodes in the target platform; comparing the standard template with the interface information corresponding to the interface supported by the target platform, and determining the target interface based on the comparison result.
[0009] Optionally, the target interface is determined by comparing the standard template with the interface information corresponding to the interface supported by the target platform, including: obtaining multiple interface information supported by the target platform, and converting the multiple interface information into interface information in a target format, wherein the target format is a format recognizable by the target platform; converting the standard template into a verification script, wherein the format of the verification script is the same as the target format; comparing the verification script with the interface information in the target format one by one to obtain a comparison result, and determining the target interface based on the comparison result.
[0010] Optionally, the verification script is compared one by one with the interface information of the target format to obtain a comparison result, and the target interface is determined based on the comparison result, including: obtaining the similarity between the verification script and the interface information of the target format; and selecting the interface with the highest similarity from the multiple interfaces as the target interface.
[0011] According to another aspect of an embodiment of the present application, a device for determining an API is also provided, including: a receiving module for receiving an interface call request, the interface call request containing a query text, the query text being used to represent the description information of a target application program interface API; an extraction module for extracting from the query text a plurality of data nodes in a process of obtaining and calling a target interface, the plurality of data nodes including a plurality of operation steps for obtaining data from the outside in a process of calling the target interface; a matching module for matching the operation steps corresponding to the plurality of data nodes with the operations corresponding to a target platform to determine the operation information of the plurality of data nodes within the target platform; and a determination module for determining the target interface based on the operation information of the plurality of data nodes within the target platform.
[0012] According to another aspect of the embodiment of the present application, a computer device is provided, including: a memory and a processor, wherein the memory is used to store program instructions; and the processor is connected to the memory and is used to execute the above-mentioned API determination method.
[0013] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned API determination method by running the computer program.
[0014] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned API determination method when executed by a processor.
[0015] In an embodiment of the present application, an interface call request is received, wherein the interface call request includes a query text, wherein the query text is used to represent the description information of the target application program interface API; multiple data nodes in the process of obtaining and calling the target interface are extracted from the query text, wherein the multiple data nodes include multiple operation steps for obtaining data from the outside during the process of calling the target interface; the operation steps corresponding to the multiple data nodes are matched with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform; the target interface is determined based on the operation information of the multiple data nodes in the target platform, thereby achieving the purpose of determining the target interface by using a natural language query text, thereby realizing the technical effect of simplifying the target interface query process, and further solving the technical problem that the retrieval process of the target interface in the related technology is too cumbersome. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 is a hardware structure block diagram of a computer terminal for implementing an API determination method according to an embodiment of the present application;
[0018] Figure 2 is a flowchart of a method for determining an API according to an embodiment of the present application;
[0019] Figure 3 It is a structural diagram of an API determination device according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] The information collected in the embodiments of the present application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or reject automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.
[0023] In order to solve the problems existing in the related art, the present application embodiment provides a method for determining an API, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.
[0024] The API determination method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing an API determination method. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art can understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0025] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0026] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method for determining the API in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the method for determining the API described above is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0027] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0028] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .
[0029] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.
[0030] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a method for determining an API. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] Figure 2 is a flowchart of a method for determining an API according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0032] Step S202, receiving an interface call request, wherein the interface call request includes a query text, and the query text is used to represent description information of a target application program interface API;
[0033] In step S202, the query text is a text described in natural language, which at least includes: request method, parameter type, expected function, etc.
[0034] Among them, the request method indicates the method used by the client to send a request to the server, for example: get (a request method), the parameter types include: input parameters and output parameters, and the expected function indicates the purpose of calling the target program interface, for example: obtaining data, modifying data, etc.
[0035] Step S204, extracting multiple data nodes in the process of acquiring and calling the target interface from the query text, wherein the multiple data nodes include multiple operation steps of acquiring data from the outside in the process of calling the target interface;
[0036] In step S204, data nodes refer to the steps in which the system needs to obtain data from the outside to complete a specific operation during the interface call process. Each data node represents a process of obtaining external data. The mode and method of this process vary according to the interface design and system platform, such as calling the interface of other systems, reading database records, or sending network requests. After obtaining external data, the system can perform a series of code operations according to the business logic to process, calculate, and verify the data. Finally, through the operation and processing of the logic code, the system will obtain the final result and return it to the user. By identifying and processing these data nodes, the system can effectively perform data operations and process control, thereby completing the processing and output of user needs.
[0037] Step S206, matching the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform;
[0038] In step S206, the operation steps of the operation corresponding to each data node in the target platform can be determined according to a predetermined mapping relationship. It can be understood that the target platform is a low-code platform.
[0039] Step S208: determining the target interface based on the operation information of the multiple data nodes in the target platform.
[0040] Through the above steps S202 to S208, the purpose of determining the target interface by using the query text in natural language is achieved, thereby achieving the technical effect of simplifying the target interface query process, and further solving the technical problem that the target interface retrieval process is too complicated in the related technology. The following is a detailed description.
[0041] In step S202 of the above-mentioned method for determining the API, a plurality of data nodes in the process of obtaining and calling the target interface are extracted from the query text, including: removing special characters, punctuation marks and spaces in the query text to obtain a processed query text; performing word segmentation processing on the processed query text to obtain a plurality of word segments, and performing part-of-speech tagging on the plurality of word segments to obtain a plurality of word segments after the part-of-speech tagging, marking text paragraphs matching the predetermined entity in the plurality of word segments after the part-of-speech tagging according to a predetermined entity to obtain a marked query text, wherein the predetermined entity includes at least a database table name, a uniform resource locator of an API interface and a structured query statement; and identifying the marked query text to obtain the plurality of data nodes.
[0042] Specifically, the uploaded query text is segmented and POS tagged using the SpaCy (an open source natural language processing library), and the phrases, word groups and sentence components in the text are identified. The named entity recognition function in the SpaCy library is used to identify and extract entity information in the query text, such as database table names, SQL statements or URLs of external interfaces and other key information. The syntactic analysis function of SpaCy is used to analyze the syntactic structure in the query text, identify the data acquisition process as a data node and parse the data operations of each node, for example: analyze the dependency between words in the sentence, identify the subject, object, verb and other components, and the relationship between them, identify data nodes: by analyzing the structure and context of the sentence, identify the statements representing the data nodes, such as "calling the queryUser interface" or "reading user information from the database".
[0043] In some embodiments of the present application, the operation steps corresponding to the multiple data nodes are matched with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform, including: traversing each data node among the multiple data nodes to obtain parsing information of each data node, the parsing information at least including: input parameters, output parameters, logical relationships with other data nodes and actions that each data node needs to perform; determining the operation steps corresponding to each data node based on the parsing information; based on the operation steps corresponding to each data node, selecting corresponding operation information from a preset function library of the target platform, and using the operation information selected from the preset function library as the operation information of each data node on the target platform.
[0044] For example: for each data node, analyze its related parameters, including input parameters (such as custId, customer ID) and output parameters (such as userId, user ID), as well as the association between these parameters and other entities in the text. Action recognition: Identify the actions involved in the data node, such as "call", "query", "judgment", etc. Logical processing: Identify the logical relationship between data nodes, such as conditional judgment (such as "if the return value is empty") and process control (such as "continue to call the queryOrder interface").
[0045] Among them, based on the operation steps corresponding to each data node, corresponding operation information is selected from the preset function library of the target platform to determine the operation information of each data node on the target platform, including: obtaining the preset function library of the target platform, the preset function library at least including: a mapping relationship between the operation steps corresponding to the data node and the operation steps of the target platform; determining the operation information of the multiple data nodes in the target platform according to the mapping relationship.
[0046] In some embodiments of the present application, the target interface is determined based on the operation information of the multiple data nodes in the target platform, including: determining a standard template corresponding to the interface call request based on the operation information of the multiple data nodes in the target platform; comparing the standard template with the interface information corresponding to the interface supported by the target platform, and determining the target interface based on the comparison result.
[0047] In an optional approach, you can also use intent recognition algorithms to analyze the specific development content of each node, which can be specific steps involving writing SQL statements, calling external interfaces, or development tasks related to other data node operations. Match each data node with a predefined capability library to determine the platform capabilities used by each data node. Match the development content of each data node with the development functions of the platform, complete the integration of each data node, and then integrate each data node into a standard template for the interface required by the user.
[0048] It can be understood that the development content of each node represents the operation steps corresponding to the data node, and the platform capabilities used by each data node represent the operation information of the data node in the target platform.
[0049] In some embodiments of the present application, the target interface is determined by comparing the standard template with the interface information corresponding to the interface supported by the target platform, including: obtaining multiple interface information supported by the target platform, and converting the multiple interface information into interface information in a target format, wherein the target format is a format recognizable by the target platform; converting the standard template into a verification script, wherein the format of the verification script is the same as the target format; comparing the verification script with the interface information in the target format one by one to obtain a comparison result, and determining the target interface based on the comparison result.
[0050] The interface information is as follows:
[0051] request: request information;
[0052] headers: request header settings;
[0053] body: request body;
[0054] attrs: parameters;
[0055] attrType: the source of the attribute;
[0056] isRequired: whether it is required;
[0057] desc: description;
[0058] params: request parameters;
[0059] response: the response data of the interface;
[0060] body: The response body of the interface is mainly the structure of the response body of the interface;
[0061] httpStatus: the response status code of the interface;
[0062] heasers: response header of the interface;
[0063] Nodes: The business logic in the process includes the called interface, the queried database, and other specific operations, which are a collection of multiple data nodes;
[0064] nodeNum: node number;
[0065] perScript: The pre-script is used to modify the incoming parameters of the data node;
[0066] scriptType: script type, such as js, groovy, etc.
[0067] context: script content The content of the script to be executed, such as the SQL to be executed, dynamic input parameters of the interface, etc.
[0068] postScript: The pre-script is used to modify the return parameters of the data node;
[0069] scriptType: script type, such as js, groovy, etc.
[0070] context: script content The content of the script to be executed;
[0071] response: the node returns data;
[0072] body: the content of the data returned by the node;
[0073] request: data input by the node;
[0074] body: the content of the node input parameter;
[0075] condition: node concurrency, such as concurrent execution of multiple threads;
[0076] concurrents: The node execution judgment condition is determined by judging whether the data node is executed;
[0077] service: the capabilities corresponding to the node;
[0078] serviceId: node code;
[0079] info: information about capabilities;
[0080] name: the name of the capability;
[0081] description: description of the capability;
[0082] requsetType: The request method of the capability.
[0083] Among them, the verification script is compared with the interface information of the target format one by one to obtain a comparison result, and the target interface is determined based on the comparison result, including: obtaining the similarity between the verification script and the interface information of the target format; and selecting the most similar interface from the multiple interfaces to determine it as the target interface.
[0084] Specifically, the data of the standard template is converted into a corresponding verification script, and a text in a format supported by the platform, such as JSONSchema format (target format), can be used to verify the matching degree between the existing interface of the platform and the standard template.
[0085] Use the pre-generated interface information in the target format (interface information supported by the target platform) to perform verification with the verification script to obtain the matching degree of each interface and achieve accurate search of capabilities.
[0086] This application also provides another method for determining the API, as shown below:
[0087] Step 1: pre-process the existing platform interface, for example, convert it into a format readable by the platform, and parse it into the candidate data in a format that can be recognized by the platform, such as JSON format.
[0088] Step 2: The developer will write the search text according to the above style and then upload the written file to the system.
[0089] Step 3: The engine parses and identifies the process of interface calls and the part involving data acquisition operations, and analyzes various information of the interface such as input and output parameters, request headers, data nodes, and data operations between nodes.
[0090] Step 4: The engine matches the development content of each data node with the platform operation according to the actual situation of the low-code platform, maps it to the specific platform operation, and determines the specific operation data of each data node. The information of each data node is generated into a suitable verification script in the JSONSchema format.
[0091] Step 5: Use the pre-generated candidate data and verification script for verification to obtain the matching degree of each interface and achieve accurate search of capabilities.
[0092] Figure 3 is a structural diagram of an API determination device according to an embodiment of the present application, such as Figure 3 As shown, the device comprises:
[0093] A receiving module 30, configured to receive an interface call request, wherein the interface call request includes a query text, and the query text is used to represent description information of a target application program interface API;
[0094] An extraction module 32, used to extract from the query text a plurality of data nodes in the process of acquiring and calling the target interface, the plurality of data nodes including a plurality of operation steps of acquiring data from the outside in the process of calling the target interface;
[0095] A matching module 34, used to match the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform;
[0096] The determination module 36 is configured to determine the target interface based on the operation information of the multiple data nodes in the target platform.
[0097] Through the above-mentioned API determination device, by receiving an interface call request, the interface call request contains a query text, and the query text is used to represent the description information of the target application program interface API; extracting multiple data nodes in the process of obtaining and calling the target interface from the query text, and the multiple data nodes include multiple operation steps for obtaining data from the outside during the process of calling the target interface; matching the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform; determining the target interface based on the operation information of the multiple data nodes in the target platform, thereby achieving the purpose of determining the target interface by using a natural language query text, thereby realizing the technical effect of simplifying the target interface query process, and further solving the technical problem that the retrieval process of the target interface in the related technology is too cumbersome.
[0098] The extraction module 32 in the above-mentioned API determination device includes: an extraction submodule, which is used to extract multiple data nodes in the process of obtaining and calling the target interface from the query text, including: removing special characters, punctuation marks and spaces in the query text to obtain a processed query text; performing word segmentation processing on the processed query text to obtain multiple word segments, and performing part-of-speech tagging on the multiple word segments to obtain multiple word segmentation after part-of-speech tagging, marking text paragraphs matching the predetermined entity in the multiple word segmentation after part-of-speech tagging according to a predetermined entity to obtain a marked query text, and the predetermined entity at least includes: a database table name, a uniform resource locator of an API interface and a structured query statement; identifying the marked query text to obtain the multiple data nodes.
[0099] The extraction submodule includes: a matching unit, which is used to match the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform, including: traversing each data node among the multiple data nodes to obtain the parsing information of each data node, and the parsing information at least includes: input parameters, output parameters, logical relationships with other data nodes and actions that each data node needs to perform; determining the operation steps corresponding to each data node based on the parsing information; based on the operation steps corresponding to each data node, selecting corresponding operation information from the preset function library of the target platform, and using the operation information selected from the preset function library as the operation information of each data node on the target platform.
[0100] The matching unit includes: a selection subunit, which is used to select corresponding operation information from the preset function library of the target platform based on the operation steps corresponding to each data node to determine as the operation information of each data node on the target platform, including: obtaining the preset function library of the target platform, the preset function library at least including: a mapping relationship between the operation steps corresponding to the data node and the operation steps of the target platform; determining the operation information of the multiple data nodes in the target platform according to the mapping relationship.
[0101] The determination module 36 includes: a determination submodule, which is used to determine the target interface based on the operation information of the multiple data nodes in the target platform, including: determining a standard template corresponding to the interface call request based on the operation information of the multiple data nodes in the target platform; comparing the standard template with the interface information corresponding to the interface supported by the target platform, and determining the target interface based on the comparison result.
[0102] The determination submodule includes: a determination unit, which is used to compare the standard template with the interface information corresponding to the interface supported by the target platform to determine the target interface, including: obtaining multiple interface information supported by the target platform, and converting the multiple interface information into interface information in a target format, wherein the target format is a format recognizable by the target platform; converting the standard template into a verification script, wherein the format of the verification script is the same as the target format; comparing the verification script with the interface information in the target format one by one to obtain a comparison result, and determining the target interface based on the comparison result.
[0103] The determination unit includes: comparing the verification script with the interface information of the target format one by one to obtain a comparison result, and determining the target interface based on the comparison result includes: obtaining the similarity between the verification script and the interface information of the target format; selecting the interface with the highest similarity from the multiple interfaces to determine it as the target interface.
[0104] It should be noted that Figure 3 The API shown determines the means for executing Figure 2 The method for determining the API shown in the figure, therefore the relevant explanations in the above-mentioned method for determining the API are also applicable to the device for determining the API, and will not be repeated here.
[0105] An embodiment of the present application also provides a computer device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned API determination method.
[0106] An embodiment of the present application further provides a non-volatile storage medium, which includes a stored computer program, wherein a device where the non-volatile storage medium is located executes the above-mentioned API determination method by running the computer program.
[0107] An embodiment of the present application also provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the API determination method in the present application are implemented.
[0108] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the API determination method in the present application.
[0109] An embodiment of the present application also provides a computer program, which, when executed by a processor, implements the steps of the method for determining the API in the present application.
[0110] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0111] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0112] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0114] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0115] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0116] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining an API, characterized in that: include: Receive an interface call request, wherein the interface call request includes a query text, and the query text is used to represent description information of a target application program interface API; Extracting multiple data nodes in the process of acquiring and calling the target interface from the query text, the multiple data nodes including multiple operation steps of acquiring data from the outside in the process of calling the target interface; Matching the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform; The target interface is determined based on operation information of the plurality of data nodes in the target platform.
2. The method according to claim 1, characterized in that Extracting multiple data nodes in the process of acquiring and calling the target interface from the query text includes: Removing special characters, punctuation marks and spaces from the query text to obtain a processed query text; Performing word segmentation processing on the processed query text to obtain multiple word segments, performing part-of-speech tagging on the multiple word segments to obtain multiple word segmentation after part-of-speech tagging, marking text paragraphs matching the predetermined entity in the multiple word segmentation after part-of-speech tagging according to a predetermined entity to obtain a marked query text, wherein the predetermined entity at least includes: a database table name, a uniform resource locator of an API interface, and a structured query statement; The marked query text is identified to obtain the multiple data nodes.
3. The method according to claim 2, characterized in that Matching the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform includes: Traversing each data node of the plurality of data nodes to obtain parsing information of each data node, the parsing information at least including: input parameters, output parameters, logical relationships with other data nodes, and actions that each data node needs to perform; Determine the operation steps corresponding to each data node based on the parsed information; Based on the operation steps corresponding to each data node, corresponding operation information is selected from a preset function library of the target platform, and the operation information selected from the preset function library is used as the operation information of each data node on the target platform.
4. The method according to claim 3, characterized in that Selecting corresponding operation information from a preset function library of the target platform based on the operation steps corresponding to each data node to determine the operation information of each data node on the target platform includes: Acquire a preset function library of the target platform, wherein the preset function library at least includes: a mapping relationship between operation steps corresponding to data nodes and operation steps of the target platform; The operation information of the multiple data nodes in the target platform is determined according to the mapping relationship.
5. The method according to claim 1, characterized in that Determining the target interface based on the operation information of the plurality of data nodes in the target platform includes: Determine, based on the operation information of the multiple data nodes in the target platform, a standard template corresponding to the interface call request; The standard template is compared with the interface information corresponding to the interface supported by the target platform, and the target interface is determined based on the comparison result.
6. The method according to claim 5, characterized in that Comparing the standard template with the interface information corresponding to the interface supported by the target platform to determine the target interface includes: Acquire multiple interface information supported by the target platform, and convert the multiple interface information into interface information in a target format, where the target format is a format recognizable by the target platform; Converting the standard template into a verification script, wherein the format of the verification script is the same as the target format; The verification script is compared with the interface information of the target format one by one to obtain a comparison result, and the target interface is determined based on the comparison result.
7. The method according to claim 6, characterized in that Comparing the verification script with the interface information of the target format one by one to obtain a comparison result, and determining the target interface based on the comparison result includes: Obtaining the similarity between the verification script and the interface information of the target format; An interface with the highest similarity is selected from the multiple interfaces and determined as the target interface.
8. An API determination device, characterized in that: include: A receiving module, used for receiving an interface call request, wherein the interface call request includes a query text, and the query text is used for representing description information of a target application program interface API; An extraction module, used to extract from the query text a plurality of data nodes in the process of acquiring and calling the target interface, the plurality of data nodes including a plurality of operation steps of acquiring data from the outside in the process of calling the target interface; A matching module, used to match the operation steps corresponding to the multiple data nodes with the operations corresponding to the target platform to determine the operation information of the multiple data nodes in the target platform; A determination module is used to determine the target interface based on the operation information of the multiple data nodes in the target platform.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory, and is used to execute the API determination method described in any one of claims 1 to 7.
10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method for determining the API described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and equipment used for providing open API (Application Program Interface) search result
CN108255874A
API information retrieval method for natural language form and based on lecture note and Stack Overflow
CN109933660A
Data report obtaining method and device, computer equipment and storage medium
CN110222045A
Data processing method and device, electronic equipment and storage medium
CN117540805A
Method for calling external API or querying database and storage medium
CN118132568A
