Method, device and equipment for merging API interfaces based on traffic

By obtaining and analyzing API traffic data, using analysis engine services to determine the target API interface, and merging based on merge rules, the problem of difficulty in API interface management is solved, and system performance and efficiency improvement is achieved.

CN118760421BActive Publication Date: 2025-05-02HANG ZHOU LING XIN SHU KE XIN XI JI SHU YOU XIAN GONG SI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411245813.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-05-02
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

In the prior art, API interface management is difficult, especially when the number of API interfaces reaches hundreds of thousands, the management difficulty of the system increases significantly.

Method used

By obtaining API traffic data reported through traffic acquisition probes, using analysis engine services to determine the target API interface, and merging the target API interface based on the merge rules. The merge rules include the target address, the target port, the request method and the request path.

Benefits of technology

Reduces the number of API interfaces, improves system performance and efficiency, and simplifies system maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760421B_ABST
    Figure CN118760421B_ABST
Patent Text Reader

Abstract

The present invention provides a method, system and device for merging an API interface based on traffic, and relates to the technical field of computers. The method comprises: obtaining data application program interface traffic data reported by a traffic collection probe; using an analysis engine service to determine a target data application program interface corresponding to the data application program interface traffic data, wherein the target data application program interface is a data application program interface that needs to be merged; based on a merging rule, merging each target data application program interface; wherein the merging rule is: obtaining a target address, a target port, a request method and a request path of the target data application program interface; based on the target address, the target port, the request method and the request path, when determining that each target data application program interface meets the merging rule, saving each target data application program interface in a corresponding module, thereby reducing the number of data application program interface APIs and improving the performance and efficiency of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device and equipment for merging flow-based API interfaces. Background Art

[0002] With the rapid development of information technology and the deepening of digital transformation, big data and artificial intelligence technologies have been widely used in all walks of life. Among them, the data application program interface (API) is the core component for data exchange and integration between different systems, and its importance is becoming increasingly prominent. The API interface enables efficient data interaction and intercommunication between different software components or systems by defining a series of rules, protocols and tool sets, thereby promoting rapid iteration of software development and flexible expansion of business.

[0003] However, with the large-scale application of API interfaces and the explosive growth of data volume, data security and privacy issues have gradually become challenges that cannot be ignored. Especially when the number of API interfaces reaches hundreds of thousands, the difficulty of system management increases significantly. Summary of the invention

[0004] The purpose of the present invention is to provide a method, device and equipment for merging API interfaces based on traffic, so as to solve the technical problem of the difficulty in managing API interfaces in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a method for merging API interfaces based on traffic, including:

[0006] Obtain data application program interface traffic data reported by traffic collection probes;

[0007] Determine, by using the analysis engine service, a target data application program interface corresponding to the data application program interface flow data, the target data application program interface being the data application program interface to be merged;

[0008] Based on the merging rules, each target data application program interface is merged; the merging rules are: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, target port, request method and request path, when it is determined that each target data application program interface meets the merging rules, each target data application program interface is saved in the corresponding module.

[0009] In an optional embodiment, the merging rules include:

[0010] Based on the target address, target port, request method and request path, obtain a list of merge rules;

[0011] When it is determined that the merge rule list is not empty, traverse the merge rule list to obtain the current merge rule;

[0012] If the address of the target data application program interface does not conform to the current merge rule, when it is determined that there is no merge rule matching the address of the target data application program interface in the merge rule list, the target data application program interface is saved in the API list.

[0013] In an optional embodiment, it also includes:

[0014] When it is determined that each target data application program interface does not comply with the merging rule according to the target address, target port, request method and request path of each target data application program interface, each target data application program interface is saved in the API list.

[0015] In an optional embodiment, it also includes:

[0016] Get the target API address in the API list;

[0017] Based on the trained training model, determine the target API merging rule corresponding to the target API address;

[0018] Send the target API merge rules to the user for confirmation through the management service;

[0019] The target API merging rule confirmed by the user is received, and the confirmed target API merging rule is stored in the API merging rule library.

[0020] In an optional embodiment, based on the trained training model, determining the target API merging rule corresponding to the target API address includes:

[0021] Preprocess the target API address to obtain the API merging rule corresponding to the target API address;

[0022] Based on the decision tree strategy, the usage frequency of the API merge rule is marked. If the usage frequency of the API merge rule reaches the preset threshold, the API merge rule is saved.

[0023] In an optional embodiment, the target API address is preprocessed to obtain an API merging rule corresponding to the target API address, including:

[0024] Split the target API address to obtain a string array;

[0025] Replace the last character in the string array with the preset character;

[0026] Merge the replaced string arrays to obtain the API merging rules.

[0027] In a second aspect, an embodiment of the present application provides a flow-based API interface merging device, including:

[0028] A first acquisition module is used to acquire data application program interface flow data reported by the flow collection probe;

[0029] A second acquisition module is used to determine a target data application program interface corresponding to the data application program interface flow data by using an analysis engine service, where the target data application program interface is a data application program interface that needs to be merged;

[0030] A merging module is used to merge each target data application program interface based on a merging rule; wherein the merging rule is: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, target port, request method and request path, when it is determined that each target data application program interface meets the merging rule, each target data application program interface is saved in the corresponding module. In a third aspect, an embodiment of the present application provides a merging system for an API interface based on traffic, including: a switch, a traffic collection probe and a situation awareness device, wherein the switch is connected to the situation awareness device via the traffic collection probe;

[0031] The traffic collection probe is used to send the mirror data application program interface API traffic data on the switch to the situation awareness device;

[0032] The situation awareness device is used to use the analysis engine service to obtain the data application interface traffic data reported by the traffic collection probe; use the analysis engine service to determine the target data application interface corresponding to the data application interface traffic data, and the target data application interface is the data application interface that needs to be merged; based on the merging rules, merge each target data application interface; the merging rules are: obtain the target address, target port, request method and request path of the target data application interface; based on the target address, target port, request method and request path, when it is determined that each target data application interface meets the merging rules, save each target data application interface to the corresponding module.

[0033] In a fourth aspect, an embodiment of the present application further provides a situational awareness device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the merging method as described in any one of the first aspects above is implemented.

[0034] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, the merging method as described in any one of the first aspects above is implemented.

[0035] The present invention provides a method, system and device for merging API interfaces based on traffic, which obtains data application program interface API traffic data reported by a traffic collection probe; uses an analysis engine service to determine the target data application program interface corresponding to the data application program interface traffic data, and the target data application program interface is the data application program interface that needs to be merged; based on a merging rule, each target data application program interface is merged; wherein the merging rule is: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, target port, request method and request path, when it is determined that each target data application program interface meets the merging rule, each target data application program interface is saved in a corresponding module, thereby reducing the number of data application program interface APIs, improving the performance and efficiency of the system, and facilitating the maintenance of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A schematic diagram of the structure of a traffic-based API interface merging system provided by an embodiment of the present invention;

[0038] Figure 2 A schematic diagram of the structure of a situation awareness platform provided by an embodiment of the present invention;

[0039] Figure 3 A working principle diagram of the situation awareness platform provided by an embodiment of the present invention;

[0040] Figure 4 A flow chart of a method for merging traffic-based API interfaces provided by an embodiment of the present invention;

[0041] Figure 5 A flow chart of the API merging rule judgment logic provided by an embodiment of the present invention;

[0042] Figure 6 A flowchart of a specific training process of a training model provided by an embodiment of the present invention;

[0043] Figure 7 A schematic diagram of the structure of a flow-based API interface merging device provided by an embodiment of the present invention;

[0044] Figure 8 A schematic diagram of the structure of a situation awareness device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] In order to facilitate those skilled in the art to better understand the present application, the technical terms involved in the present application are briefly introduced below.

[0048] 1. Traffic collection probe, which collects network traffic data and reports the collected API traffic to the situation awareness platform;

[0049] 2. Situational awareness platform, to merge API lists according to certain rules;

[0050] 3. Switch, in order to mirror the data packets of a specific port to another port, which is connected to the traffic collection probe.

[0051] After introducing the technical terms involved in this application, the application scenarios and design concepts of the embodiments of this application are briefly introduced.

[0052] At present, when auditing API interfaces, the API list parsed by capturing and analyzing traffic is expected to reach hundreds of thousands, resulting in low efficiency in real-time data processing. Based on this, the embodiments of the present application provide a method, system and device for merging API interfaces based on traffic, such as Figure 1 As shown, the API traffic data of the switch port is collected by the traffic collection probe, and the API traffic data is reported to the situation awareness platform. The situation awareness platform merges the API list according to certain rules, thereby reducing the number of data application program interfaces API, improving the performance and efficiency of the system, and facilitating the maintenance of the system.

[0053] Figure 2 A schematic diagram of the structure of a situation awareness platform provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the situation awareness platform includes a data storage module, a data processing module and a data display module, wherein the data storage module includes a first storage unit and a second storage unit, the first storage unit is used to store the API traffic data reported by the traffic collection probe, namely, the API original event, and the second storage unit is used to store the API list and the API merging rules, the data processing module includes a management service unit, an analysis engine service unit and a training model unit, wherein the analysis engine unit is used to process the API traffic data and merge the API list, the training model unit is used to train and learn the API list to obtain the API merging rules, and the management service unit is used to display and interact with the administrator through the data display module.

[0054] Furthermore, the first storage unit is the distributed stream processing platform Kafka, which serves as the message middleware; the second storage unit is the relational database management system Mysql; the analysis engine service unit is Etl; the training model unit is Ueba; the management service unit is Manage; and the data display module is UI.

[0055] like Figure 3 As shown in the figure, the specific process of the situation awareness platform merging the API list according to certain rules is as follows:

[0056] The first storage unit is connected to the flow collection probe and is used to store the API flow data obtained by the flow collection probe;

[0057] The analysis engine service unit is connected to the first storage unit and the second storage unit respectively, and is used to consume the API traffic data stored in the first storage unit through Flink, obtain the target data application program interface API, and determine whether the target data application program interface API complies with the API merging rule. If not, the target data application program interface API is saved to the second storage unit to form an API list;

[0058] The training model unit is connected to the second storage unit, and is used to obtain API merging rules based on the API list by using a decision tree algorithm, and store the API merging rules in the second storage unit to form an API merging rule library;

[0059] The management service unit is connected to the training model and the second storage unit respectively, and is used to save the API merging rules confirmed by the user into the second storage unit;

[0060] The data display unit is connected to the management service unit and is used to display data and interact with the administrator.

[0061] In this application, the situational awareness platform is used to merge the API lists according to certain rules, thereby reducing the number of data application program interfaces (APIs), improving the performance and efficiency of the system, and facilitating the maintenance of the system.

[0062] Figure 4 A flow chart of a method for merging a traffic-based API interface provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the method comprises the following steps:

[0063] Step S110: Acquire data application program interface traffic data reported by the traffic collection probe.

[0064] Among them, the flow collection probe is set at the key position of the network, such as the server entrance, exit point or network equipment such as routers and switches, etc., to monitor and capture the passing data packets. In this application, it mainly captures the data application program interface API flow data.

[0065] The traffic collection probe reports the captured data application program interface API traffic data to the situation awareness platform, where the data application program interface API traffic data includes but is not limited to IP address, port number, protocol type, data packet size and timestamp, etc.

[0066] Furthermore, the data application program interface API traffic data collected by the traffic collection probe is reported to the Kafka message queue.

[0067] Step S120: using the analysis engine service to obtain a target data application program interface in the data application program interface traffic data, wherein the target data application program interface is a data application program interface that needs to be merged.

[0068] In this application, the data in the Kafka message queue is consumed through the ETL processing flow, and data cleaning, conversion, and loading operations are performed to obtain the target data application program interface API.

[0069] Step S130: Based on the merging rules, each target data application program interface is merged; wherein the merging rules are: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, target port, request method and request path, when it is determined that each target data application program interface meets the merging rules, each target data application program interface is saved in the corresponding module.

[0070] In a possible embodiment, the merging rules include:

[0071] Get the merge rule list based on the target address, target port, request method and request path;

[0072] When it is determined that the merge rule list is not empty, traverse the merge rule list to obtain the current merge rule;

[0073] If the address of the target data application program interface does not conform to the current merge rule, when it is determined that there is no merge rule matching the address of the target data application program interface in the merge rule list, the target data application program interface is saved in the API list.

[0074] In a possible embodiment, when it is determined that each target data application program interface does not meet the merging rule based on the target address, target port, request method and request path of each target data application program interface, each target data application program interface is saved in the API list.

[0075] like Figure 5 The API merging rule judgment logic is as follows:

[0076] Step 1. Get the API merge rule list: Get the API merge rule list based on the target IP and target port;

[0077] Step 2. Determine whether the API merge rule list is empty: If the API merge rule list is empty, it is considered that the API merge rule is not met, and jump directly to step 7; if it is not empty, execute the next step;

[0078] Step 3: Traverse the API merge rule list: Check the API merge rules one by one;

[0079] Step 4: Compare API addresses: If the target data application program interface API address is completely consistent with the API merging rule, it is considered that the target data application program interface API meets the merging rule; if not completely consistent, proceed to the next step;

[0080] Step 5: Verify the API address: Verify the target data application program interface API address through a regular expression. If the target data application program interface API address matches the API merge rule, it is considered that the target data application program interface API meets the merge rule; if it does not match, proceed to the next step;

[0081] Step 6: Check the API merge rule: Determine whether the API merge rule is the last one. If it is the last one, it is considered that the API merge rule is not met. If it is not the last one, go to step 3;

[0082] Step 7: Determine whether the API exists: If the target data application program interface API does not exist, add the target data application program interface API to the API list.

[0083] Further, for example, the regular expression is:

[0084] Assume that there are the following series of user information interfaces, the interface request method is GET: / api / users / 1; / api / users / 2; / api / users / 3, then they can be merged through the corresponding regular expression, where the regular expression content is: / api / users / *;

[0085] Assume that there are the following series of user detail interfaces, the interface request method is GET: / api / users / 1 / detail; / api / users / 2 / detail; / api / users / 3 / detail, then they can be merged through the corresponding regular expression, where the regular expression content is: / api / users / * / detail;

[0086] Assume that there is the following set of search user interfaces, the interface access request is POST, where the user list is: / api / users / list; the administrator list is: / api / users / admin / search; the most recently accessed user list is: / api / users / lastAccessList, then they can be merged through the corresponding regular expression, where the regular expression content is: / api / users / **.

[0087] In a possible embodiment, the merging method further includes:

[0088] Get the target API address in the API list;

[0089] Based on the trained training model, determine the target API merging rule corresponding to the target API address;

[0090] Send the target API merge rules to the user for confirmation through the management service;

[0091] The target API merging rule confirmed by the user is received, and the confirmed target API merging rule is stored in the API merging rule library.

[0092] In a possible embodiment, determining a target API merging rule corresponding to a target API address based on a trained training model includes:

[0093] Preprocess the target API address to obtain the API merging rule corresponding to the target API address;

[0094] Based on the decision tree strategy, the usage frequency of the API merge rule is marked. If the usage frequency of the API merge rule reaches the preset threshold, the API merge rule is saved.

[0095] In a possible embodiment, the target API address is preprocessed to obtain an API merging rule corresponding to the target API address, including:

[0096] Split the target API address to obtain a string array;

[0097] Replace the last character in the string array with the preset character;

[0098] Merge the replaced string arrays to obtain the API merging rules.

[0099] like Figure 6 As shown in the figure, the specific training process of the training model is as follows:

[0100] Randomly select a target API address from the API list, such as: GET / api / users / 1;

[0101] Split the target API address into strings to get a string array, such as [GET,api,users,1];

[0102] Replace the last character of the string array with *, such as [GET,api,users,*];

[0103] Merge the replaced string array into a string, such as GET / api / users / *;

[0104] Assuming that the above string is an API merging rule, use the decision tree algorithm to count the number of tags in the API list using the API merging rule;

[0105] When the number of times the condition is met exceeds a certain threshold, such as 1000, it can be considered that the API merging rule meets the condition, and the API merging rule is saved in the second storage unit for the user to perform a second confirmation.

[0106] Specifically, the decision tree strategy is:

[0107] Step 1: Randomly select an API address from the API list. For example: target IP: 192.XXX.XX.XXX; target port: 80; request method: GET; request path: / api / users / 1;

[0108] Step 2: Split the API request path into a string array by pressing / , such as [api, users, 1];

[0109] Step 3: Replace the last character in the string array with *, such as [api,users,*];

[0110] Step 4: Merge the string array into a string, such as / api / users / *;

[0111] Step 5: Assume that the above string is an api merge rule, such as: target IP: 192.XXX.XX.XXX; target port: 80; request method: GET; then the regular expression is: / api / users / *;

[0112] Step 6: Traverse the data in the API list and mark the API list with the decision tree algorithm. Determine whether the target IP of the API is equal to 192.XXX.XX.XXX. If not, mark it as not a symbol and continue to the next API; determine whether the target port of the API is equal to 80. If not, mark it as not a symbol and continue to the next API; determine whether the request method of the API is GET. If not, mark it as not a symbol and continue to the next API; determine whether the request path of the API satisfies the regular expression [ / api / users / *]. If not, continue to the next API. If it does, mark it as: compliant;

[0113] Step 7: When the number of times the condition is met exceeds a certain threshold, such as 1000, it can be considered that the API merge rule meets the condition.

[0114] In this application, the switch traffic is mirrored to the traffic collection probe to collect API traffic data, which is then reported to Kafka by the traffic collection probe, forming an efficient and reliable transmission of the data stream; through the analysis engine service ETL, the final confirmed API merging rules are obtained and applied to the subsequent API traffic data processing, thereby optimizing resource utilization, simplifying API call logic, reducing server load, and improving data processing efficiency, thereby forming a set of intelligent and automated API merging processes and improving system performance and efficiency.

[0115] Figure 7 A schematic diagram of a structure of a flow-based API interface merging device provided by an embodiment of the present invention, such as Figure 7 As shown, the device comprises:

[0116] The first acquisition module 210 is used to acquire data application program interface traffic data reported by the traffic collection probe;

[0117] The second acquisition module 220 is used to determine the target data application program interface corresponding to the data application program interface flow data by using the analysis engine service, wherein the target data application program interface is the data application program interface to be merged;

[0118] The merging module 230 is used to merge each target data application program interface based on the merging rules; wherein the merging rules are: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, target port, request method and request path, when it is determined that each target data application program interface meets the merging rules, each target data application program interface is saved in the corresponding module.

[0119] In a possible embodiment, the merging module 230 is further configured to:

[0120] Get the merge rule list based on the target address, target port, request method and request path;

[0121] When it is determined that the merge rule list is not empty, traverse the merge rule list to obtain the current merge rule;

[0122] If the address of the target data application program interface does not conform to the current merge rule, when it is determined that there is no merge rule matching the address of the target data application program interface in the merge rule list, the target data application program interface is saved in the API list.

[0123] In a possible embodiment, the merging module 230 is further configured to:

[0124] When it is determined that each target data application program interface does not comply with the merging rule according to the target address, target port, request method and request path of each target data application program interface, each target data application program interface is saved in the API list.

[0125] In a possible embodiment, the merging module 230 is further configured to:

[0126] Get the target API address in the API list;

[0127] Based on the trained training model, determine the target API merging rule corresponding to the target API address;

[0128] Send the target API merge rules to the user for confirmation through the management service;

[0129] The target API merging rule confirmed by the user is received, and the confirmed target API merging rule is stored in the API merging rule library.

[0130] In a possible embodiment, the merging module 230 is further configured to:

[0131] Preprocess the target API address to obtain the API merging rule corresponding to the target API address;

[0132] Based on the decision tree strategy, the usage frequency of the API merge rule is marked. If the usage frequency of the API merge rule reaches the preset threshold, the API merge rule is saved.

[0133] In a possible embodiment, the merging module 230 is further configured to:

[0134] Split the target API address to obtain a string array;

[0135] Replace the last character in the string array with the preset character;

[0136] Merge the replaced string arrays to obtain the API merging rules.

[0137] The implementation principle and technical effects of the device provided in the embodiments of the present application are the same as those of the aforementioned method embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiments.

[0138] like Figure 8 As shown, a situational awareness device 600 provided in an embodiment of the present application includes: a processor 601, a memory 602 and a bus, the memory 602 stores machine-readable instructions executable by the processor 601, and when the electronic device is running, the processor 601 communicates with the memory 602 through the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the above-mentioned flow-based API interface merging method.

[0139] Specifically, the above-mentioned memory 602 and processor 601 can be general-purpose memory and processor, which are not specifically limited here. When the processor 601 runs the computer program stored in the memory 602, it can execute the above-mentioned traffic-based API interface merging method.

[0140] The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 601. The above processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.

[0141] Corresponding to the above-mentioned method for merging traffic-based API interfaces, an embodiment of the present application also provides a computer-readable storage medium, which stores machine-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the steps of the above-mentioned method for merging traffic-based API interfaces.

[0142] The merging device of the flow-based API interface provided in the embodiment of the present application can be specific hardware on the device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in the embodiment of the present application are the same as those of the aforementioned method embodiment. For the sake of brief description, for the parts not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment. Technical personnel in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the aforementioned method embodiment, and will not be repeated here.

[0143] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is only 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 communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0144] For another example, the flowchart and block diagram in the accompanying drawings show the possible architecture, functions and operations of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or 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 consecutive boxes 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 and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0145] 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 network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, each functional unit in the embodiments provided in 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.

[0147] If the function 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, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0148] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0149] Finally, it should be noted that the above embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application. They should all be covered within the protection scope of the present application.

Claims

1. A method for merging API interfaces based on traffic, characterized in that: include: Obtain data application program interface traffic data reported by traffic collection probes; Determine, by using an analysis engine service, a target data application program interface corresponding to the data application program interface flow data, wherein the target data application program interface is a data application program interface to be merged; Based on the merging rule, each of the target data application program interfaces is merged; wherein the merging rule is: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, the target port, the request method and the request path, when it is determined that each of the target data application program interfaces meets the merging rule, each of the target data application program interfaces is saved in a corresponding module, wherein, according to the target address, the target port, the request method and the request path of each of the target data application program interfaces, when it is determined that each of the target data application program interfaces does not meet the merging rule, each of the target data application program interfaces is saved in an API list; and obtaining the target address in the API list Mark the API address; determine the target API merge rule corresponding to the target API address based on the trained training model; send the target API merge rule to the user for confirmation through the management service; receive the target API merge rule after the user's confirmation, and store the confirmed target API merge rule in the API merge rule library, wherein, based on the trained training model, determine the target API merge rule corresponding to the target API address, including: preprocessing the target API address to obtain the API merge rule corresponding to the target API address; based on the decision tree strategy, mark the usage frequency of the API merge rule, if the usage frequency of the API merge rule reaches a preset threshold, save the API merge rule.

2. The merging method according to claim 1, characterized in that: The merging rules include: Based on the target address, the target port, the request mode and the request path, obtaining a merge rule list; When it is determined that the merge rule list is not empty, traverse the merge rule list to obtain the current merge rule; If the address of the target data application program interface does not conform to the current merge rule, when it is determined that there is no merge rule matching the address of the target data application program interface in the merge rule list, the target data application program interface is saved in the API list.

3. The merging method according to claim 1, characterized in that: Preprocessing the target API address to obtain an API merging rule corresponding to the target API address includes: Split the target API address to obtain a string array; Replace the last character in the string array with a preset character; The replaced string arrays are merged to obtain API merging rules.

4. A flow-based API interface merging device, characterized in that: include: A first acquisition module is used to acquire data application program interface flow data reported by the flow collection probe; A second acquisition module is used to determine the target data application program interface corresponding to the data application program interface flow data by using the analysis engine service, wherein the target data application program interface is the data application program interface that needs to be merged; A merging module is used to merge each of the target data application program interfaces based on a merging rule; wherein the merging rule is: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, the target port, the request method and the request path, when it is determined that each of the target data application program interfaces meets the merging rule, saving each of the target data application program interfaces into a corresponding module, wherein, according to the target address, the target port, the request method and the request path of each of the target data application program interfaces, when it is determined that each of the target data application program interfaces does not meet the merging rule, saving each of the target data application program interfaces into an API list; and obtaining the API list The target API address in the list; based on the trained training model, determining the target API merge rule corresponding to the target API address; sending the target API merge rule to the user for confirmation through the management service; receiving the target API merge rule after the user's confirmation, and storing the confirmed target API merge rule in the API merge rule library, wherein, based on the trained training model, determining the target API merge rule corresponding to the target API address, including: preprocessing the target API address to obtain the API merge rule corresponding to the target API address; based on the decision tree strategy, marking the usage frequency of the API merge rule, if the usage frequency of the API merge rule reaches a preset threshold, saving the API merge rule.

5. A traffic-based API interface merging system, characterized in that: include: A switch, a flow collection probe and a situation awareness device, wherein the switch is connected to the situation awareness device via the flow collection probe; The flow collection probe is used to send the mirror data application program interface API flow data on the switch to the situation awareness device; The situation awareness device is used to obtain data application program interface flow data reported by the flow collection probe by using the analysis engine service; and to determine the target data application program interface corresponding to the data application program interface flow data by using the analysis engine service, wherein the target data application program interface is the data application program interface to be merged; Based on the merging rule, each of the target data application program interfaces is merged; wherein the merging rule is: obtaining the target address, target port, request method and request path of the target data application program interface; based on the target address, the target port, the request method and the request path, when it is determined that each of the target data application program interfaces meets the merging rule, each of the target data application program interfaces is saved in a corresponding module, wherein, according to the target address, the target port, the request method and the request path of each of the target data application program interfaces, when it is determined that each of the target data application program interfaces does not meet the merging rule, each of the target data application program interfaces is saved in an API list; and obtaining the target address in the API list Mark the API address; determine the target API merge rule corresponding to the target API address based on the trained training model; send the target API merge rule to the user for confirmation through the management service; receive the target API merge rule after the user's confirmation, and store the confirmed target API merge rule in the API merge rule library, wherein, based on the trained training model, determine the target API merge rule corresponding to the target API address, including: preprocessing the target API address to obtain the API merge rule corresponding to the target API address; based on the decision tree strategy, mark the usage frequency of the API merge rule, if the usage frequency of the API merge rule reaches a preset threshold, save the API merge rule.

6. A situation awareness device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the merging method according to any one of claims 1 to 3 when executing the computer program.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the merging method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Data security monitoring method and device

    CN117527412A

  • API (Application Program Interface) calling anomaly detection method and device, computer equipment and storage medium

    CN118101423A