API interface marking method and device, electronic equipment, storage medium and product
By obtaining the API interface to access traffic data and using the target model to extract function description and interface name information, the API interface is marked, which solves the problem of difficulty in maintaining and operating the API interface and achieves more efficient management and security.
Patent Information
- Application Number
- CN202411303185.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-07
AI Technical Summary
The maintenance and operation of existing API interfaces is difficult, resulting in increased operating costs and security protection costs, making it difficult for users to understand the functions and functions of API interfaces.
By obtaining the API interface to access traffic data, input data to the target model to obtain function description information and interface name information, marking the API interface based on this information, simplifying management and use.
It reduces the difficulty of maintaining and operating the API interface, improves management efficiency and security, reduces operational costs, and enhances the semantic understanding and recognition capabilities of API interfaces.
Smart Images

Figure CN119271261A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device, storage medium and product for marking an API interface. Background Art
[0002] API (Application Program Interface) is an interface for applications to provide services to the outside world, which allows different applications, services or modules to share data and functions. However, the existing API interface record information is usually difficult to directly see the role or function of the API interface, which makes maintenance and operation more difficult, and the operating cost and security protection cost also increase accordingly. Summary of the invention
[0003] In view of this, the purpose of the present disclosure is to propose a marking method, device, electronic device, storage medium and product for an API interface, which can at least to some extent solve the technical problems in the related technology such as the increased difficulty in maintenance and operation of the API interface, and the increase in operating costs and security protection costs.
[0004] Based on the above purpose, the first aspect of the present disclosure provides a method for marking an API interface, including:
[0005] Get API interface information from API interface access traffic data;
[0006] Input the API interface information into a target model, and obtain first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first training interface information and corresponding first functional description information and / or first interface name information;
[0007] The API interface is marked based on the first information.
[0008] A second aspect of the present disclosure provides an API interface marking device, including:
[0009] The acquisition module is used to obtain the API interface information in the API interface access traffic data;
[0010] A model module, used to input the API interface information into a target model, and obtain first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first training interface information and corresponding first functional description information and / or first interface name information;
[0011] A marking module is used to mark the API interface based on the first information.
[0012] A third aspect of the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0013] A fourth aspect of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.
[0014] Based on the same inventive concept, a fifth aspect of the exemplary embodiments of the present disclosure provides a computer program product, including computer program instructions. When the computer program instructions are executed on a computer, the computer executes the method described in the first aspect.
[0015] From the above, it can be seen that the API interface marking method, device, electronic device, storage medium and product provided by the present invention, through semantic understanding of the interface information of the API interface, thereby determining the functional description information and interface name information of the API interface, so as to mark the API interface, facilitate user use and management, and are suitable for various network security scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 A schematic flowchart of a method for marking an API interface provided by an embodiment of the present disclosure is shown.
[0018] Figure 2 A schematic diagram of a marking method for an API interface provided in an embodiment of the present disclosure is shown.
[0019] Figure 3 A schematic diagram of an exemplary device provided by an embodiment of the present disclosure is shown.
[0020] Figure 4 A schematic diagram of the hardware structure of an exemplary computer device provided in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0021] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0022] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0023] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0024] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0025] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0026] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0027] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0028] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, the principles and spirit of the present disclosure will be described with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0029] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0030] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.
[0031] API (application program interface) refers to a set of functions of an operating component, application or operating system that allows different applications to communicate with each other, share data, and integrate in an orderly manner. Its main purpose is to allow application developers to call a set of routine functions without considering the underlying source code or understanding the details of its internal working mechanism. As the types and number of applications increase and become more complex, the iteration and update of applications are very frequent, resulting in frequent iteration of application program interfaces. In order to manage the API interface, the maintenance information of the API interface can be automatically discovered or manually maintained. However, the maintenance information of the API interface usually only records the path, request method and parameters of the application program interface, and users cannot know the role or function of the application program interface. In actual applications, there are usually hundreds or thousands of application program interfaces in use for a domain name, which makes the maintenance and operation of the API interface very difficult, and the operating cost and security protection cost also increase accordingly, and the maintenance efficiency and operating efficiency also become low. How to reduce the maintenance and operation difficulty of the API interface, reduce the operating cost and security protection cost, and improve the maintenance efficiency and operating efficiency have become technical problems that need to be solved urgently.
[0032] See also Figure 1 , Figure 1A schematic flow chart of a marking method for an API interface according to an embodiment of the present disclosure is shown. The marking method for an API interface according to an embodiment of the present disclosure can be deployed on a terminal or a server. Figure 1 In the example, the marking 100 of the API interface may further include the following steps.
[0033] Step S110, obtaining API interface information in the API interface access traffic data.
[0034] Among them, API interface access traffic data refers to recorded data related to the access to the API interface, including data such as the number of requests, frequency, source, and response time. For example, the number of requests can refer to the number of times a certain API interface is called in a day; the response time can refer to the average time required for the API interface to process a request and return a response. To obtain access traffic data, you can usually collect access traffic data in the target system or target system cluster, and capture the usage of the API interface through log records, traffic detection tools, or other methods. Among them, log records include detailed information about each request recorded by the API gateway or server, such as request time, response time, request method (GET, POST, etc.), client IP address, etc. Access traffic data can be multi-source fused log stream data, or access logs backed up in a database, which are not limited here.
[0035] API interface information can refer to various descriptions and metadata related to the API interface, such as: interface path (Endpoint), which is used to define the target location of the API interface request; calling method (HTTP method), which is used to specify how to interact with the API interface, common methods include GET, POST, PUT, DELETE, etc. Request parameters can refer to the input data that the API interface expects to receive, which can be query string parameters, path parameters, or data in the request body. API interface information can also include response format, status code, version control, authentication and authorization, rate limiting, documentation and examples, error handling and other information.
[0036] Step S120, input the API interface information into the target model, and obtain the first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first interface information and corresponding first functional description information and / or first interface name information.
[0037] The target model may refer to a model used to extract information and perform semantic analysis based on the API interface information to determine the functional description and / or name information of the corresponding API interface. The first information may refer to key information that can identify or describe the API interface, the functional description information may refer to the description of the API interface function, and the interface name information may refer to the naming identifier of the API interface, such as a descriptive name or path.
[0038] Specifically, a large amount of labeled API interface information and corresponding interface function description information and / or interface naming description information can be collected as the first training data to train the initial model, and a target model that can output corresponding API function description information and / or name information based on the input API interface information can be obtained. During the training process of the target model, the corresponding output result, that is, the output function description information and / or the output interface name information, can be generated based on the first interface information in the first training data (for example, it can be obtained based on the configuration information of the API interface). The output result is compared with the actual first function description information, and / or, the first interface name information, and the parameters of the target model can be adjusted based on minimizing the cross entropy loss between the output result and the actual first function description information and / or the first interface name information, thereby obtaining a trained target model.
[0039] In some embodiments, inputting the API interface information into a target model, and obtaining first information about the API interface information output by the target model includes:
[0040] The target model performs semantic analysis on the interface path and the calling method in the API interface information to obtain a first analysis result;
[0041] The first information is determined based on the first analysis result.
[0042] Among them, the interface path may refer to the path part in the URL (Uniform Resource Locator) of the API interface, which specifies the target resource or resource collection of the request. The interface path usually follows the protocol (such as HTTP / HTTPS) and the domain name, and is used to identify a specific resource or service. . The calling method may refer to the method of the HTTP request, which indicates the type of operation that the client wants to perform. Common HTTP methods include GET, POST, PUT, DELETE, PATCH, etc. Specifically, GET can be used to request to obtain resource information; POST can be used to submit data to the server, usually used to create a new resource; PUT can be used to update resources, usually replacing the entire resource; DELETE can be used to delete resources; PATCH can be used to partially update resources. Semantic analysis may refer to understanding and interpreting the content involved in the API interface information, such as the meaning of the interface path and the calling method, to determine the function and purpose of the API interface. For example, if the API interface information includes the interface path: / products and the calling method: GET, it can be semantically analyzed through the target model, and the first analysis result input is an interface for obtaining product information. At this time, the functional description information in the first information can be "get a product list". In this way, the functions of the API interface can be automatically identified, thereby helping users to manage and use the API interface more effectively, which is conducive to reducing work costs and improving work efficiency.
[0043] Specifically, when the API interface information includes the interface path and the calling method, the first analysis result can be obtained by performing semantic analysis on the entire API interface information based on the target model. Figure 2 , Figure 2 A schematic diagram of a marking method for an API interface according to an embodiment of the present disclosure is shown. Figure 2 In the example, after obtaining the API interface information, it can be determined whether the API interface information includes the interface path and the calling method. If so, semantic analysis can be performed based on the interface path and the calling method. If not, the analysis can be terminated or the API interface information can be obtained again. Furthermore, it can be determined whether the API interface information only includes the interface path and the calling method. Figure 2 As shown in S210. If the API interface information only includes the interface path and the calling method, it means that only the API interface information needs to be semantically analyzed as a whole, and no local analysis of other parameters is required. If the API interface information includes not only the interface path and the calling method, it means that there are other key parameters that need to be semantically analyzed to more accurately determine the function of the API interface.
[0044] In some embodiments, inputting the API interface information into a target model, and obtaining first information about the API interface information output by the target model includes:
[0045] Aggregating and folding the API interface information to obtain folding parameters of the API interface information;
[0046] In response to determining that the API interface information includes the folding parameter, the target model performs semantic analysis on the interface path, the calling method and the folding parameter to obtain a second analysis result;
[0047] The first information is determined based on the first analysis result or the second analysis result.
[0048] After obtaining the access traffic data, the access traffic data can be aggregated and folded to obtain the meaning and function of the folding parameters in the access traffic data. At this time, the interface path, calling method and folding parameters of the API interface information can be semantically analyzed to obtain the second analysis result. The final first information is then determined from the first analysis result or the second analysis result.
[0049] The API interface information is aggregated and folded. Specifically, the field parameters and corresponding field values in the access traffic data can be obtained, and then the field parameters can be folded and identified based on the field values corresponding to the field parameters, and the interface access path and interface access parameters stored in the field parameters can be obtained, and then the interface folding information can be obtained based on the interface access path and interface access parameters. The access traffic data includes multiple field parameters, and the field parameters can be folded and identified based on the field values corresponding to each field parameter, that is, the function of the field parameter can be inferred based on the content of the field value corresponding to the field parameter, for example: what kind of information the field parameter is used to store, and the field parameters with the same function can be folded to obtain the interface folding information such as the interface access path and interface access parameters stored in the field parameters. Then, the domain name can be obtained, that is, the basic API interface information can be obtained based on the combination of the domain name, interface access path and interface access parameters.
[0050] In some embodiments, the first analysis result has a first confidence level, the second analysis result has a second confidence level, and the first confidence level is less than a confidence level threshold;
[0051] determining the first information based on the first analysis result or the second analysis result includes:
[0052] In response to determining that the second confidence is greater than or equal to the confidence threshold, determining that the second analysis result is the first information;
[0053] Alternatively, in response to determining that the second confidence level is less than the confidence level threshold and greater than or equal to the first confidence level, determining that the second analysis result is the first information;
[0054] Alternatively, in response to determining that the first confidence level is greater than the second confidence level, the first analysis result is determined to be the first information.
[0055] Among them, if the first confidence of the first analysis result is greater than or equal to the confidence threshold, the first analysis result can be directly determined as the first information without further analysis of the folding parameters or query parameters and other subsequent tasks. If the first confidence of the first analysis result is less than the confidence threshold, it is necessary to further analyze the folding parameters or query parameters to improve the accuracy of the semantic analysis of the API interface information. Figure 2 In the example, if the API interface information includes not only the interface path and the calling method, but also the folding parameters, the semantic analysis can be performed by combining the folding parameters, the interface path and the calling method, such as Figure 2 As shown in S220. The role and function of the API interface is thereby determined, and a second analysis result with more accurate interface function description information is obtained. At this time, if the second confidence of the second analysis result is greater than or equal to the confidence threshold, the second analysis result can be directly determined as the first information without performing subsequent semantic analysis of the query parameters. If the second confidence of the second analysis result is less than the confidence threshold, the confidences of the first analysis result and the second analysis result are both less than the confidence threshold, and the analysis result with the larger confidence can be determined as the first information. For example, when the first analysis result is greater than the second analysis result, the first analysis result is determined as the first information; when the first analysis result is less than or equal to the second analysis result, the second analysis result is determined as the first information.
[0056] It can be seen that the API interface marking method described in this embodiment obtains API interface information such as interface path, calling method and folding parameters in the access traffic data, and then performs semantic understanding on the API interface information to obtain function description information and interface name information. The interface name information can be summarized and described into readable functions and names based on the interface function description information, thereby obtaining the interface name information of the API interface. This can more intuitively display the functions of the API interface, further improve the convenience of work, and facilitate user use and management.
[0057] In some embodiments, inputting the API interface information into a target model, and obtaining first information about the API interface information output by the target model includes:
[0058] In response to determining that the API interface information also includes query parameters, the target model performs semantic analysis on the interface path, the calling method, the folding parameter and the query parameter to obtain a third analysis result;
[0059] The first information is determined based on the first analysis result, the second analysis result, or the third analysis result.
[0060] Among them, the query parameter can refer to the query string part in the URL, for example, after the question mark (?) in the URL, and is composed of a series of key-value pairs, the key-value pairs are connected by equal signs (=), and multiple key-value pairs are separated by ampersands (&). When the API interface information also includes query parameters, the interface path, calling method, folding parameters and query parameters can be further combined for semantic analysis to obtain a third analysis result to further improve the accuracy of the semantic analysis. The final first information is then determined from the first analysis result, the second analysis result or the third analysis result.
[0061] In some embodiments, the first analysis result has a first confidence level, the second analysis result has a second confidence level, the third analysis result has a third confidence level, and the first confidence level and the second confidence level are less than a confidence threshold;
[0062] determining the first information based on the first analysis result, the second analysis result, or the third analysis result, including:
[0063] In response to determining that the third confidence level is greater than or equal to the confidence level threshold, determining that the third analysis result is the first information;
[0064] Alternatively, in response to determining that the third confidence level is less than the confidence level threshold, determining that an analysis result corresponding to a maximum value among the first confidence level, the second confidence level, or the third confidence level is the first information;
[0065] Alternatively, in response to determining that the third confidence is less than the confidence threshold, and the third confidence is equal to both the first confidence and the second confidence, the third analysis result is determined to be the first information.
[0066] When the third confidence information is greater than or equal to a preset threshold, the subsequent task is no longer executed, and the current third recognition result is determined as the interface function description information and / or interface name information of the interface resource.
[0067] Among them, if the second confidence of the second analysis result is greater than or equal to the confidence threshold, the second analysis result can be directly determined as the first information without further analysis of the query parameters and other subsequent tasks. If the second confidence of the second analysis result is less than the confidence threshold, the query parameters can be further analyzed to improve the accuracy of the semantic analysis of the API interface information. Figure 2 In the example, if the API interface information also includes query parameters, semantic analysis can be performed by combining query parameters, folding parameters, interface path, and calling method. Figure 2 As shown in S230. Thus, the role and function of the API interface are determined, and a third analysis result with more accurate interface function description information is obtained. At this time, if the third confidence of the third analysis result is greater than or equal to the confidence threshold, the third analysis result can be directly determined as the first information without performing subsequent semantic analysis of the query parameters. If the third confidence of the third analysis result is less than the confidence threshold, the confidences of the first analysis result, the second analysis result, and the third analysis result are all less than the confidence threshold, and the analysis result with a larger confidence can be determined as the first information. For example, when the first confidence is greater than the second confidence and the third confidence, the first analysis result corresponding to the first confidence is determined as the first information; when the second confidence is greater than the first confidence and the third confidence, the second analysis result corresponding to the second confidence is determined as the first information; when the third confidence is greater than the first confidence and the second confidence, the third analysis result corresponding to the third confidence is determined as the first information. If the first confidence, the second confidence, and the third confidence are all equal, the third analysis result can be determined as the first information.
[0068] In some embodiments, method 100 may further include:
[0069] Correcting the first information to obtain second information;
[0070] Determining the API interface information and the second information as positive training samples, and determining the API interface information and the first information as negative training samples;
[0071] The positive training samples and the negative training samples are used as second training data to train the target model to update the target model.
[0072] In the process of training and applying the target model, the generated first information can be further processed, for example, the first information can be corrected to obtain the second information. When interface function description information and / or interface name information that do not meet the requirements or are inaccurate appear, the interface function description information and / or interface name information that do not meet the requirements can be used as a negative sample, and the corrected second information can be used as a positive sample. The negative samples and positive samples are then used to adjust and further train the parameters and network of the target model, thereby achieving the tuning of the target model and continuously improving the accuracy of the target model.
[0073] In some embodiments, method 100 may further include:
[0074] Detecting the first information based on a preset rule;
[0075] In response to detecting that the first information includes target information related to the preset rule, the target information in the first information is modified to update the first information.
[0076] The preset rules may include a label description that is allowed for the API interface, or a label description that is not allowed for the API interface. Specifically, in order to prevent misunderstanding of the name of the interface, the first information may be detected and corrected based on the preset rules (for example, using a pre-trained first model), and the process of identifying and generating the first information may be judged and corrected through the detection of the first model, so that the generated first information meets the preset rules.
[0077] In step S130, the API interface is marked based on the first information.
[0078] Among them, marking the API interface can refer to adding labels or classifications to the API interface according to its basic attributes and functional descriptions (such as the first information), or naming the API interface (that is, writing the functions and effects of the API interface into its name information) for easy management and identification. Specifically, the API interface can be given corresponding labels or names according to the first information, so as to help users quickly locate and understand the functions, usage scenarios and restrictions of the API. For example, if the API interface is used for user authentication, it can be marked with labels such as "authentication" and "security", or functional descriptions such as authentication can be added to its name; if the API interface is used for data query, it can be marked as "query", "read" or functional descriptions such as query can be added to its name. It should be understood that the above-mentioned labels and / or names are only examples, and the labels and / or names can also include more descriptions, which are not limited here. Through these labels or names, API resources can be effectively organized and retrieved, and development efficiency and maintenance convenience can be improved. This helps to optimize API interface performance, manage resource usage, ensure security, and understand API usage trends.
[0079] It can be seen that the method according to the embodiment of the present disclosure can perform intelligent semantic analysis on API interface information, quickly and accurately extract key descriptions, and automatically mark the functional information and name information of API interface resources, which can significantly improve the management efficiency and security of network security products such as Web application firewalls. This function not only simplifies the classification and identification of API interface resources, but also enhances the detection and protection of API interface traffic, allowing network security products to more intelligently respond to increasingly complex threat environments and ensure the safe and stable operation of Web applications.
[0080] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0081] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0082] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a marking device for an API interface. Figure 3 , the marking device of the API interface includes:
[0083] The acquisition module is used to obtain the API interface information in the API interface access traffic data;
[0084] A model module, used to input the API interface information into a target model, and obtain first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first interface information and corresponding first functional description information and / or first interface name information;
[0085] A marking module is used to mark the API interface based on the first information.
[0086] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the marking method of the API interface described in any of the above embodiments is implemented.
[0087] Figure 4 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0088] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0089] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0090] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0091] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0092] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0093] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0094] The electronic device of the above embodiment is used to implement the marking method of the corresponding API interface in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0095] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the API interface marking method described in any of the above embodiments.
[0096] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0097] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the API interface marking method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0098] Based on the same inventive concept, corresponding to the data processing method described in any of the above embodiments, the present disclosure also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor executes the marking method of the API interface. Corresponding to the execution subject corresponding to each step in each embodiment of the marking of the API interface, the processor that executes the corresponding step may belong to the corresponding execution subject.
[0099] The computer program product of the above embodiment is used to enable the computer and / or the processor to execute the API interface marking method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0100] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, method, or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." In addition, in some embodiments, the present disclosure may also be implemented in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.
[0101] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive examples) of computer-readable storage media may include, for example: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device.
[0102] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0103] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0104] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0105] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified in the boxes in the flowchart and / or block diagram.
[0106] These computer program instructions may also be stored in a computer-readable medium that enables a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable medium produce a product that includes an instruction device that implements the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0107] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable device to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0108] In addition, although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0109] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0110] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0111] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0112] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0113] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0114] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for marking an API interface, comprising: Get API interface information from API interface access traffic data; Input the API interface information into a target model, and obtain first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first interface information and corresponding first functional description information and / or first interface name information; The API interface is marked based on the first information.
2. The method according to claim 1, wherein: Inputting the API interface information into a target model, and acquiring first information about the API interface information output by the target model, including: The target model performs semantic analysis on the interface path and the calling method in the API interface information to obtain a first analysis result; The first information is determined based on the first analysis result.
3. The method according to claim 2, wherein: Inputting the API interface information into a target model, and acquiring first information about the API interface information output by the target model, including: Aggregating and folding the API interface information to obtain folding parameters of the API interface information; In response to determining that the API interface information includes the folding parameter, the target model performs semantic analysis on the interface path, the calling method and the folding parameter to obtain a second analysis result; The first information is determined based on the first analysis result or the second analysis result.
4. The method according to claim 3, wherein: The first analysis result has a first confidence level, the second analysis result has a second confidence level, and the first confidence level is less than a confidence level threshold; determining the first information based on the first analysis result or the second analysis result includes: In response to determining that the second confidence is greater than or equal to the confidence threshold, determining that the second analysis result is the first information; Alternatively, in response to determining that the second confidence level is less than the confidence level threshold and greater than or equal to the first confidence level, determining that the second analysis result is the first information; Alternatively, in response to determining that the first confidence level is greater than the second confidence level, the first analysis result is determined to be the first information.
5. The method according to claim 3, wherein: Inputting the API interface information into a target model, and acquiring first information about the API interface information output by the target model, including: In response to determining that the API interface information also includes query parameters, the target model performs semantic analysis on the interface path, the calling method, the folding parameter and the query parameter to obtain a third analysis result; The first information is determined based on the first analysis result, the second analysis result, or the third analysis result.
6. The method according to claim 5, wherein: The first analysis result has a first confidence level, the second analysis result has a second confidence level, the third analysis result has a third confidence level, and the first confidence level and the second confidence level are less than a confidence threshold; determining the first information based on the first analysis result, the second analysis result, or the third analysis result, including: In response to determining that the third confidence level is greater than or equal to the confidence level threshold, determining that the third analysis result is the first information; Alternatively, in response to determining that the third confidence level is less than the confidence level threshold, determining that an analysis result corresponding to a maximum value among the first confidence level, the second confidence level, or the third confidence level is the first information; Alternatively, in response to determining that the third confidence is less than the confidence threshold, and the third confidence is equal to both the first confidence and the second confidence, the third analysis result is determined to be the first information.
7. The method according to claim 1, further comprising: Correcting the first information to obtain second information; Determining the API interface information and the second information as positive training samples, and determining the API interface information and the first information as negative training samples; The positive training samples and the negative training samples are used as second training data to train the target model to update the target model.
8. The method according to claim 1, further comprising: Detecting the first information based on a preset rule; In response to detecting that the first information includes target information related to the preset rule, the target information in the first information is modified to update the first information.
9. A marking device for an API interface, comprising: The acquisition module is used to obtain the API interface information in the API interface access traffic data; A model module, used to input the API interface information into a target model, and obtain first information about the API interface information output by the target model; wherein the first information includes at least one of the following: functional description information and interface name information of the API interface; the target model is obtained by training based on first training data, and the first training data includes first training interface information and corresponding first functional description information and / or first interface name information; A marking module is used to mark the API interface based on the first information.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the API interface marking method as claimed in any one of claims 1 to 8 when executing the program.
11. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the API interface marking method described in any one of claims 1 to 8.
12. A computer program product, characterized in that The method comprises computer program instructions, which, when executed on a computer, enable the computer to execute the method for identifying interface resources as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Financial certificate information input processing method, device, equipment, medium and product
CN116863486A
Method for discovering interface resources and related equipment
CN118368236A
Interface test method and device based on API dependency automatic acquisition
CN118467391A