Interface parameter analysis method, system, device and computer program product

By constructing proxy objects for interface response parameters at the network service layer and reporting the interface path when accessing the front end, the statistical error problem caused by static code scanning is solved, and the accurate recording of interface parameter usage is achieved.

CN113377555BActive Publication Date: 2026-04-17WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEBANK (CHINA)
Filing Date
2021-06-28
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies rely on static code scanning to statistically analyze interface parameter usage, which leads to errors in the statistical results and fails to accurately reflect how the program uses the parameters during runtime.

Method used

The network service layer receives the interface path and request parameters from the front end, sends a call request to the backend server, and constructs a proxy object for the interface response parameters. When the front end accesses the server, it triggers a function to report the interface path and response parameters to the recording system, thus recording the actual interface usage.

Benefits of technology

It improves the accuracy of statistics on the usage of interface parameters, ensuring that the recording system can accurately record the actual usage of backend interfaces and parameters by the frontend.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113377555B_ABST
    Figure CN113377555B_ABST
Patent Text Reader

Abstract

This invention relates to the field of financial technology (Fintech) and discloses an interface parameter analysis method, system, device, and computer program product. The method includes: a network service layer receiving a backend interface path and interface request parameters from a frontend; sending an interface call network request to a backend server based on the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request; and sending a first reporting network request to a recording system based on the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters based on the first reporting network request. The interface parameter analysis method of this invention improves the statistical accuracy of interface parameter usage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial technology (Fintech), and in particular to interface parameter analysis methods, systems, devices, and computer program products. Background Technology

[0002] With the development of computer technology, more and more technologies (big data, distributed systems, blockchain, artificial intelligence, etc.) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher demands are being placed on interface parameter analysis technology.

[0003] In software development, front-end and back-end communication is an unavoidable topic. This communication occurs through network interfaces. In the early stages of development, developers need to define various network interfaces (back-end interfaces) and their corresponding parameters based on business needs. As business grows and changes, the interface parameters defined in the early stages may need to be changed later. For example, interfaces may be changed, parameters added, or parameters deleted. Changes in interface parameters may cause errors when the program calls the interface or passes parameters, potentially leading to system anomalies and unnecessary resource consumption. To mitigate this problem, it is necessary to statistically analyze the usage of each interface parameter to promptly clean up any invalid interface fields.

[0004] Existing technologies use static code scanning to count the interface parameters used in the code. However, since the scanned object is static code, not a real running software program, it is impossible to know the actual usage of parameters during program execution. That is, due to various reasons, the program may not reach the corresponding code logic branch during execution. Even if there are interface parameters used in this part of the code, they will not be used because the code cannot be executed, thus causing errors in the statistical results of interface parameter usage. Summary of the Invention

[0005] The main objective of this invention is to propose an interface parameter analysis method, system, device, and computer program product, aiming to solve the technical problem that the statistical results of existing methods for statistically analyzing interface parameter usage through static code scanning have errors.

[0006] To achieve the above objectives, the present invention provides an interface parameter analysis method, which is applied to the network service layer, and includes:

[0007] Receive the backend interface path and interface request parameters from the frontend;

[0008] The backend interface path and the interface request parameters are used to send an interface call network request to the backend server so that the backend server can respond to the interface call network request.

[0009] A first reporting network request is sent to the recording system according to the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters according to the first reporting network request;

[0010] Upon receiving the response information sent by the backend server for the network request to the interface, the response parameters of each interface in the response information are obtained.

[0011] Construct proxy objects for the response parameters of each interface, and build a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter, and write the backend interface path into the closure of the retrieval function;

[0012] The proxy object is returned to the front end so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request, so that the recording system can associate and record the backend interface path and the target response parameter according to the second reporting network request.

[0013] Optionally, the step of constructing a proxy object for each of the interface response parameters and building a retrieval function in the proxy object for proxying the retrieval operation of each of the interface response parameters includes:

[0014] Each of the interface response parameters is converted into a regular object, wherein each of the interface response parameters corresponds to a property in the regular object;

[0015] Construct a first-level proxy object for the ordinary object, and build a get function in the first-level proxy object to proxy the first-level attribute get operation in the ordinary object;

[0016] The first-level attribute is used as the current-level attribute. For complex attributes that contain sub-attributes in the current-level attribute, a next-level proxy object is constructed. In the next-level proxy object, a retrieval function for the retrieval operation of each sub-attribute of the complex attribute is constructed.

[0017] The process continues until the current layer no longer contains complex attributes. Each sub-attribute of the complex attribute is taken as the current layer attribute. The process then returns to the previous step of constructing a next-layer proxy object for the complex attribute containing sub-attributes, and constructing a retrieval function in the next-layer proxy object to proxy the retrieval operation of each sub-attribute of the complex attribute.

[0018] Optionally, the step of returning the proxy object to the front end to trigger the acquisition function to report the target response parameter and the backend interface path in the closure to the recording system via a second reporting network request when the front end accesses the target response parameter in each of the interface response parameters includes:

[0019] The proxy objects of each layer are returned to the front end so that when the front end accesses the target response parameters in the response parameters of each interface, the target acquisition function corresponding to the target response parameter is triggered to concatenate the target response parameter with the target prefix and report it to the recording system together with the backend interface path in the closure through the second reporting network request.

[0020] Wherein, the target prefix is ​​the prefix corresponding to the proxy object to which the target acquisition function belongs. The prefix of the first-level proxy object is set to empty, and the prefix of each intermediate-level proxy object is set to the concatenation result of the complex attribute to which it belongs and the prefix of the previous-level proxy object.

[0021] Optionally, the interface parameter analysis method further includes:

[0022] The first reported network request and / or the second reported network request are marked with a preset identifier;

[0023] When a response is received for a network request marked with the preset identifier, the response is ignored.

[0024] Optionally, the step of sending a first reporting network request to the recording system based on the backend interface path and the interface request parameters includes:

[0025] Check whether the interface request parameters corresponding to the backend interface path have been cached in the cache record;

[0026] If not cached, the interface request parameters are cached and added to the request parameter set corresponding to the backend interface path in the cache record;

[0027] When the cached record reaches the preset cache limit, the backend interface path in the cached record and the request parameter set corresponding to each backend interface path are sent to the record system through the first reporting network request.

[0028] Furthermore, to achieve the above objectives, the present invention also provides an interface parameter analysis method, which is applied to a recording system, and the interface parameter analysis method includes:

[0029] The system receives network requests for reporting, which include a first network request and a second network request. The first network request is a network request sent by the network service layer to the recording system after receiving the backend interface path and interface request parameters from the frontend. The network service layer sends an interface call network request to the backend server based on the backend interface path and interface request parameters. After receiving the response information sent by the backend server for the interface call network request, the system obtains each interface response parameter in the response information, constructs a proxy object for each interface response parameter, and builds a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter. The backend interface path is written into the closure of the retrieval function, and the proxy object is returned to the frontend. When the frontend accesses the target response parameter in each interface response parameter, the retrieval function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second network request.

[0030] The backend interface path and interface parameters carried in the reported network request are recorded, and the interface parameters are used as the backend interface path's parameters.

[0031] The parameter statistics of the backend interface path are obtained based on the used parameters of the recorded backend interface path, and the parameter statistics are output.

[0032] Optionally, the step of obtaining the parameter statistics result of the backend interface path based on the recorded used parameters of the backend interface path includes:

[0033] The parameter utilization rate of the backend interface path is calculated based on the recorded used parameters of the backend interface path and the preset all parameters corresponding to the backend interface path.

[0034] When the usage rate of the parameter is less than a preset threshold, the backend interface path is used as the parameter statistics result, or the unused parameters of the backend interface path are determined based on the used parameters of the backend interface path and all parameters, and the backend interface path and the unused parameters are used as the parameter statistics result.

[0035] In addition, to achieve the above objectives, the present invention also provides an interface parameter analysis system, which includes a network service layer and a recording system;

[0036] The network service layer is used to receive the backend interface path and interface request parameters passed from the frontend; send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request; and send a first reporting network request to the recording system according to the backend interface path and the interface request parameters.

[0037] The network service layer is further configured to, upon receiving response information from the backend server regarding the network request for the interface call, obtain each interface response parameter in the response information; construct a proxy object for each interface response parameter, and construct a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter, and write the backend interface path into the closure of the retrieval function; return the proxy object to the frontend, so that when the frontend accesses the target response parameter in each interface response parameter, the retrieval function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through a second reporting network request;

[0038] The recording system is used to receive network reporting requests, which include a first network reporting request and a second network reporting request; record the backend interface path and interface parameters carried in the network reporting request, and use the interface parameters as the used parameters of the backend interface path; obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

[0039] Furthermore, to achieve the above objectives, the present invention also provides an interface parameter analysis device, which is deployed at the network service layer, and includes:

[0040] The first receiving module is used to receive the backend interface path and interface request parameters passed from the frontend;

[0041] The first sending module is used to send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request.

[0042] The second sending module is used to send a first reporting network request to the recording system according to the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters according to the first reporting network request;

[0043] The acquisition module is used to acquire the response parameters of each interface in the response information after receiving the response information sent by the backend server for the network request to the interface call.

[0044] A construction module is used to construct proxy objects for the response parameters of each interface, and to build a retrieval function in the proxy object for proxying the retrieval operation of the response parameters of each interface, and to write the backend interface path into the closure of the retrieval function;

[0045] The return module is used to return the proxy object to the front end, so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request, so that the recording system can associate and record the backend interface path and the target response parameter according to the second reporting network request.

[0046] Furthermore, to achieve the above objectives, the present invention also provides an interface parameter analysis device, which is deployed in a recording system, and the interface parameter analysis device includes:

[0047] The second receiving module is used to receive network reporting requests, wherein the network reporting requests include a first network reporting request and a second network reporting request. The first network reporting request is a network request sent by the network service layer to the recording system after receiving the backend interface path and interface request parameters from the frontend. The network service layer sends an interface call network request to the backend server according to the backend interface path and the interface request parameters. After receiving the response information sent by the backend server for the interface call network request, the module obtains each interface response parameter in the response information, constructs a proxy object for each interface response parameter, and builds a getter function in the proxy object to proxy the getter operation of each interface response parameter. The backend interface path is written into the closure of the getter function, and the proxy object is returned to the frontend. When the frontend accesses the target response parameter in each interface response parameter, the getter function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second network reporting request.

[0048] The recording module is used to record the backend interface path and interface parameters carried in the reported network request, and to use the interface parameters as the used parameters of the backend interface path.

[0049] The output module is used to obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

[0050] In addition, to achieve the above objectives, the present invention also provides an interface parameter analysis device, the interface parameter analysis device comprising: a memory, a processor, and an interface parameter analysis program stored in the memory and executable on the processor, wherein the interface parameter analysis program, when executed by the processor, implements the steps of the interface parameter analysis method as described above.

[0051] In addition, to achieve the above objectives, the present invention also provides a computer storage medium storing an interface parameter analysis program, which, when executed by a processor, implements the steps of the interface parameter analysis method as described above.

[0052] In addition, to achieve the above objectives, the present invention also provides a computer program product, the computer program product including an interface parameter analysis program, which, when executed by a processor, implements the steps of the interface parameter analysis method as described above.

[0053] In this invention, after receiving the backend interface path and interface request parameters from the frontend, the network service layer sends an interface call network request to the backend server based on the backend interface path and interface request parameters, so that the backend server can respond to the interface call network request. It also sends a first reporting network request to the recording system based on the backend interface path and interface request parameters, so that the recording system can associate and record the backend interface path and interface request parameters according to the first reporting network request. This invention utilizes the characteristic of the network service layer as an intermediary proxy for frontend-backend communication. The network service layer reports the backend interface path called by the frontend and the interface request parameters used to the recording system through network requests. By recording the actual interface and interface request parameter usage during the frontend code execution, compared to methods that statistically analyze interface request parameter usage through static code scanning, the interface parameter analysis method of this invention improves the statistical accuracy of interface request parameter usage. This invention constructs proxy objects for each interface response parameter and includes a retrieval function within these proxy objects to handle the retrieval of these parameters. Leveraging the characteristic that frontend access to interface response parameters triggers this retrieval function, the function reports the target response parameter accessed by the frontend and its corresponding backend interface path to a recording system via a network request. This allows the recording system to track the actual usage of the interface response parameters returned by the backend server from the frontend. Upon receiving a second reported network request, the recording system can associate and record the backend interface path and target response parameter carried in the second reported network request. Compared to methods that statistically analyze interface response parameter usage through static code scanning, this invention's interface parameter analysis method improves the accuracy of statistical analysis of interface response parameter usage. Attached Figure Description

[0054] Figure 1 This is a schematic diagram of the interface parameter analysis device structure for the hardware operating environment involved in the embodiments of the present invention.

[0055] Figure 2 This is a flowchart illustrating the first embodiment of the interface parameter analysis method of the present invention;

[0056] Figure 3 This is a schematic diagram of a network service layer architecture according to an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of a proxy object according to an embodiment of the present invention;

[0058] Figure 5 This is a schematic diagram of an interface request parameter reporting process based on a network service layer architecture according to an embodiment of the present invention;

[0059] Figure 6 This is a schematic diagram of an interface response parameter reporting process based on a network service layer architecture according to an embodiment of the present invention;

[0060] Figure 7 This is a schematic diagram of a parameter reporting process based on a network service layer architecture with cached records, according to an embodiment of the present invention.

[0061] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0062] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0063] like Figure 1 As shown, Figure 1 This is a schematic diagram of the interface parameter analysis device structure of the hardware operating environment involved in the embodiments of the present invention.

[0064] The interface parameter analysis device in this embodiment of the invention can be a PC or a server device, on which a virtual machine runs.

[0065] like Figure 1As shown, the interface parameter analysis device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or stable non-volatile memory, such as a disk storage device. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0066] Those skilled in the art will understand that Figure 1 The interface parameters shown in the diagram do not constitute a limitation on the device structure and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0067] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an interface parameter analysis program.

[0068] exist Figure 1 In the interface parameter analysis device shown, the network interface 1004 is mainly used to connect to the backend server and communicate with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and communicate with the client; and the processor 1001 can be used to call the interface parameter analysis program stored in the memory 1005 and execute the operations in the interface parameter analysis method described below.

[0069] Based on the above hardware structure, various embodiments of the interface parameter analysis method of the present invention are proposed.

[0070] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.

[0071] Interface parameters: Front-end and back-end communication requires an agreement on a specific network interface. The front-end submits parameters to the back-end by sending a request, and the back-end processes the business logic and then responds with the result parameters to the front-end. The parameter data structure submitted by the front-end and the parameter data structure returned by the back-end are respectively called the request parameters and response parameters of the interface. In other words, interface parameters include interface request parameters and interface response parameters.

[0072] Interface parameter utilization rate: The parameter utilization rate of each interface can be defined as the ratio of the number of parameters used in the interface to the total number of parameters defined in the interface. (Number of parameters used / Total number of parameters).

[0073] JavaScript: A popular software programming language.

[0074] Proxy: A syntax feature provided by JavaScript that adds a layer of interception before manipulating data objects, allowing for the setting and retrieval of object properties.

[0075] XHR: XMLHTTPRequest, an object provided by the browser that allows JavaScript to communicate with a server over the network through its interface.

[0076] Axios: A network request library based on the XMLHTTPRequest object, providing more convenient methods and functions for sending network requests and receiving responses.

[0077] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the interface parameter analysis method of the present invention. The interface parameter analysis method is applied to the network service layer (Fetch Service), and includes:

[0078] Step S10: Receive the backend interface path and interface request parameters from the frontend;

[0079] Step S20: Send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request;

[0080] The front-end mainly consists of front-end business code modules and a network service layer that uniformly encapsulates these modules. In other words, the network service layer is deployed within the front-end code. For ease of description in the following embodiments, "front-end" refers specifically to the front-end business code modules, excluding the network service layer. The front-end business code modules must call the back-end interfaces of the back-end server through the network service layer. Specifically, when the front-end business code modules call a back-end interface, they uniformly call the interface (or method) provided by the network service layer, passing the back-end interface path (or back-end interface name; the back-end server provides various back-end interfaces, and the back-end interface name is used to uniquely identify each back-end interface) and interface request parameters to the network service layer. After receiving the back-end interface path and interface request parameters from the front-end, the network service layer sends a network request to the back-end server according to the agreed protocol format (hereinafter referred to as an interface call network request for distinction), communicates with the back-end server, receives the interface response parameters returned by the back-end server, and then returns the interface response parameters to the front-end. In some implementations, after receiving the backend interface path and interface request parameters from the frontend, the network service layer can first perform unified processing such as processing general parameters and parameter validation, and then send the interface call network request to the backend server based on the processing result.

[0081] Furthermore, in one embodiment, such as Figure 3 As shown, the network service layer is internally divided into three layers: the request processor, the network layer, and the response processor. When the frontend calls the interface provided by the network service layer, the interface request parameters and the backend interface path are first processed by the request processor, which then sends the processing result to the network layer. The network layer is responsible for calling Axios library methods to initiate HTTP or HTTPS network requests to the server and receiving the server's response data. Finally, the response data is processed by the response processor before being returned to the frontend business code module (i.e., the frontend code module in the diagram).

[0082] Step S30: Send a first reporting network request to the recording system according to the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters according to the first reporting network request.

[0083] After receiving the backend interface path and interface request parameters, the network service layer, in addition to sending an interface call network request to the backend server, can also send a network request (hereinafter referred to as the first reporting network request) to the recording system based on the backend interface path and interface request parameters. This is used to report the backend interface path and interface request parameters passed from the frontend to the recording system. The recording system is a pre-configured system for recording the usage of interface parameters and can operate independently of the frontend and backend servers.

[0084] Furthermore, in one embodiment, the request processing layer in the network service layer can uniformly process the backend interface path and interface request parameters, and then request the network layer to create two network requests: one is an interface call network request, and the other is a first reporting network request. After creating the interface call network request, the network layer sends it to the backend server, and after creating the first reporting network request, it sends it to the recording system.

[0085] For example, when a user logs in, the front end needs to call the login interface ( / customer / login). The login requires passing the username and password as interface request parameters to the back end. Only after the back end verifies the password can the login be successful. When the network service layer receives the back end interface path " / customer / login" and the two interface request parameters "username" and "password" from the front end, it will report the back end interface path and the two interface request parameters to the recording system.

[0086] Understandably, when the frontend sends the backend interface path and interface request parameters to the network service layer, it indicates that the frontend needs to call the backend interface corresponding to that path and uses those request parameters. Therefore, the network service layer can send an additional network request to report the interface path and request parameters used by the frontend to the recording system, which then records the frontend's usage of the backend interface. Upon receiving the first reported network request, the recording system can associate and record the backend interface path and request parameters carried in it. As the frontend business code module runs its various business functions, and the network service layer continuously reports interface usage to the recording system, the system can collect information on the frontend business code module's calls to the various backend interfaces provided by the backend server and the usage of their request parameters. This allows developers to understand the frontend's calls to backend interfaces and the use of request parameters based on the data recorded in the system—for example, which interfaces were called, which request parameters were used, and which were not.

[0087] In this embodiment, after receiving the backend interface path and interface request parameters from the frontend, the network service layer sends an interface call network request to the backend server based on the backend interface path and interface request parameters, so that the backend server can respond to the interface call network request. It also sends a first reporting network request to the recording system based on the backend interface path and interface request parameters, so that the recording system can associate and record the backend interface path and interface request parameters according to the first reporting network request. This embodiment of the invention utilizes the characteristic of the network service layer as an intermediary proxy for frontend-backend communication. The network service layer reports the backend interface path called by the frontend and the interface request parameters used to the recording system through network requests. By recording the actual interface and interface request parameter usage during the frontend code execution, compared to methods that statistically analyze interface request parameter usage through static code scanning, the interface parameter analysis method of this embodiment improves the statistical accuracy of interface request parameter usage.

[0088] Furthermore, based on the above embodiments, a second embodiment of the interface parameter analysis method of the present invention is proposed.

[0089] Following step S30 above, the following is also included:

[0090] Step S40: After receiving the response information sent by the backend server for the network request to the interface, obtain the response parameters of each interface in the response information;

[0091] After the network service layer sends the API call network request to the backend server, the backend server processes the request according to the called backend API path, such as retrieving data from the database. Based on the processing result, the backend server returns a response to the network service layer. The response includes at least one API response parameter and may also include other necessary communication information, which is not limited here. After receiving the response from the backend server for the API call network request, the network service layer retrieves the various API response parameters from the response.

[0092] Furthermore, in one embodiment, the network layer in the network service layer can receive the response information sent by the backend server, extract the interface response parameters from the response information and pass them to the response processing layer, which is responsible for returning the interface response parameters to the frontend business code module.

[0093] Step S50: Construct a proxy object for each of the interface response parameters, and build a retrieval function in the proxy object to proxy the retrieval operation of each of the interface response parameters, and write the backend interface path into the closure of the retrieval function;

[0094] Since the network service layer cannot perceive the usage of API response parameters by the front-end business logic module after the parameters are returned, it cannot directly statistically analyze their usage. To address this, the network service layer can construct proxy objects for each API response parameter before returning them to the front-end. These proxy objects should contain functions to handle the retrieval of each parameter, with the back-end API path included in the closure of these functions. Instead of directly returning the API response parameters, the network service layer can return the proxy objects to the front-end. These proxy objects can be constructed using JavaScript's syntax features. Due to the nature of proxy objects, the front-end can use their properties indistinguishably from using a regular object, thus avoiding intrusion into the front-end code (i.e., the front-end can directly use the API response parameters without any code modification). Constructing a getter function within the proxy object to handle the retrieval of interface response parameters means that this getter function proxies the retrieval of interface response parameters. Previously, when the interface response parameters were directly returned to the frontend, the frontend could directly access them. Now, with the proxy object returned to the frontend, the frontend accesses the interface response parameters through the getter function within the proxy object, which returns the parameters to the frontend. To ensure that the backend interface path corresponding to the interface response parameters is also reported when the frontend uses them, the backend interface path is written into the closure of the getter function. When the getter function is triggered, it reports the accessed interface response parameters and the backend interface path from the closure to the recording system via a network request (hereinafter referred to as the second reporting network request for clarity).

[0095] It should be noted that in other implementations, the proxy object can also be other objects with similar characteristics to the Proxy object. For example, it can be a custom function that simulates proxy behavior and returns a proxy function for the front end to use. This achieves the same effect as the Proxy object, but it loses the native support of Proxy syntax and may be intrusive to the front end code. For instance, when using API response parameters, the front end may need to change from simply accessing object properties to making function calls, which may degrade performance. If the way the proxy function is called is adjusted, the front end code will also need to be modified accordingly.

[0096] Step S60: Return the proxy object to the front end so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request, so that the recording system can associate and record the backend interface path and the target response parameter according to the second reporting network request.

[0097] After constructing the proxy objects for each interface response parameter, the network service layer returns the proxy objects to the front end. This allows the front end to access any interface response parameter (referred to as the target response parameter for clarity) and trigger the acquisition function to report the target response parameter and the backend interface path in the closure to the recording system via a second reporting network request.

[0098] It should be noted that, in one embodiment, when the retrieval function is triggered, the target response parameters and the backend interface path in the closure can be directly reported to the recording system via a network request. In another embodiment, when the retrieval function is triggered, the target response parameters and the backend interface path in the closure can first be passed to the network service layer, which then reports the target response parameters and the backend interface path to the recording system via a network request according to the communication protocol with the recording system; furthermore, when the retrieval function is triggered, the target response parameters and the backend interface path in the closure can first be passed to the network layer in the network service layer, which then reports the target response parameters and the backend interface path to the recording system via a network request.

[0099] For example, if the frontend successfully logs in via the login API ( / customer / login), the backend returns API response parameters including the user's nickname, gender, avatar, ID card number (idCard), and phone number (phoneNo). The frontend uses the nickname, avatar, and gender parameters to render these in the user interface. When the frontend page code is rendered, it references the nickname, avatar, and gender fields, triggering the getter function of the Proxy object constructed based on the API response parameters. This getter function appends the API name ( / customer / login) to the nickname, avatar, and gender fields and reports them to the logging system. The logging system then records that the frontend used the nickname, avatar, and gender parameters from the / customer / login API response.

[0100] It is understandable that after receiving a network request for an API call, the backend server returns various API response parameters for the frontend to use. The frontend may not ultimately use all of these parameters; their use is only confirmed when the frontend accesses them. Therefore, this embodiment constructs proxy objects for each API response parameter and includes a function within these proxy objects to handle the retrieval of these parameters. Leveraging the characteristic that frontend access to API response parameters triggers this function, the retrieval function reports the target response parameter accessed by the frontend and the corresponding backend API path to the recording system via a network request. This allows the recording system to record the actual usage of the API response parameters returned by the backend server. Upon receiving a second reported network request, the recording system can associate and record the backend API path and target response parameters carried in the second reported network request. After the front-end business code module runs various business functions, and the network service layer continuously reports interface usage to the recording system, the recording system can collect the usage of each interface response parameter of each backend interface path returned by the backend server during the operation of the front-end business code module. This allows developers to understand the front-end's usage of each interface response parameter for each backend interface based on the data recorded in the recording system. For example, they can see which interface response parameters were used and which were not. Compared to methods that statistically analyze interface response parameter usage through static code scanning, the interface parameter analysis method of this invention improves the statistical accuracy of interface response parameter usage.

[0101] Further, in one embodiment, step S50 includes:

[0102] Step S51: Convert each of the interface response parameters into a regular object, wherein each of the interface response parameters corresponds to a different attribute in the regular object;

[0103] After obtaining the various interface response parameters from the response information, the network service layer can convert each interface response parameter into a regular object. Each interface response parameter corresponds to a property within the regular object. A regular object is defined in contrast to a proxy object; that is, a regular object is a standard object data structure. The specific conversion can be performed according to the conversion rules between the data structure of interface response parameters and the data structure of regular objects, which will not be elaborated upon here.

[0104] Step S52: Construct the first-level proxy object of the ordinary object, and build a retrieval function in the first-level proxy object to proxy the first-level attribute retrieval operation of the ordinary object;

[0105] Because the data structures of the various API response parameters returned by the backend server may have nested levels, the properties in ordinary objects may also have nested levels. That is, a property includes sub-properties, and sub-properties may also include sub-properties. In order to track the usage of properties in nested levels on the front end, recursive processing can be used when constructing proxy objects. After constructing a proxy object for one level of property, corresponding proxy objects are also constructed for its sub-properties. For example, consider the following data structure of an ordinary object:

[0106]

[0107] If a proxy object is created only for the regular object, it can only proxy the username and otp fields. The value referenced by the otp field is just a regular object. Accessing otp.code will not go through the proxy object, and thus will not trigger a network request.

[0108] Specifically, a proxy object, called the first-level proxy object, is first constructed for the ordinary object obtained by converting the response parameters of each interface. A retrieval function for proxying the first-level property retrieval operation in the ordinary object is then constructed in the first-level proxy object. That is, when the front end accesses the first-level property, the retrieval function in the first-level proxy object will be triggered to return the accessed first-level property. The retrieval function will also be triggered to report the accessed first-level property and the backend interface path in the closure to the recording system as a second reporting network request.

[0109] Step S53: Take the first layer attribute as the current layer attribute, construct the next layer proxy object for the complex attribute containing sub-attributes in the current layer attribute, and construct the acquisition function in the next layer proxy object for the acquisition operation of each sub-attribute of the complex attribute.

[0110] The network service layer takes each first-level attribute as the current-level attribute and determines whether each current-level attribute is an attribute containing sub-attributes (attributes containing sub-attributes are called complex attributes). If a current-level attribute is a complex attribute, a proxy object is constructed for that complex attribute, which is called the next-level proxy object for distinction. In the next-level proxy object, a getter function is constructed to proxy the getter operations of each sub-attribute of the complex attribute. That is, when the front end accesses the sub-attribute of the complex attribute, the getter function in the next-level proxy object is triggered to return the accessed sub-attribute. The getter function is also triggered to report the accessed sub-attribute and the backend interface path in the closure to the recording system as a second reporting network request.

[0111] It is understandable that when there are multiple complex attributes in the current layer, the network service layer constructs a proxy object for each complex attribute in the next layer.

[0112] Step S54: Take each sub-attribute of the complex attribute as the current layer attribute, return to execute the step of constructing the next layer proxy object for the complex attribute containing sub-attributes in the current layer attribute, and constructing the acquisition function for proxying the acquisition operation of each sub-attribute of the complex attribute in the next layer proxy object, until the current layer attribute does not contain the complex attribute.

[0113] After constructing the next-level proxy object for the complex attribute in the current layer, each sub-attribute of the complex attribute is taken as the current layer attribute. Then, the process returns to construct the next-level proxy object for the complex attribute containing sub-attributes in the current layer attribute, and constructs the getter function in the next-level proxy object to proxy the getter operation of each sub-attribute of the complex attribute. That is, the proxy object of each layer attribute is constructed in an iterative loop, and the loop ends when the complex attribute is no longer present in the current layer attribute.

[0114] Understandably, if all first-level attributes are simple data types, such as strings or numbers, it means that the data structure of the interface response parameters returned by the backend server does not have a nested hierarchy. In this case, the network service layer does not need to construct a second-level proxy object; it can directly return the first-level proxy object to the frontend. If there are complex attributes in the first-level attributes, then a second-level proxy object is constructed for the complex attributes. If the sub-attributes of the complex attribute are also complex, then a third-level proxy object is constructed for the sub-attributes. If the sub-attributes of the sub-attributes are also complex, then a fourth-level proxy object is constructed for the sub-attributes of the sub-attributes, and so on, constructing proxy objects for each level of attributes so that each level of attribute can be reported to the recording system when accessed.

[0115] Further, in one embodiment, step S60 includes:

[0116] Step S61: Return each layer of proxy objects to the front end so that when the front end accesses the target response parameters in each of the interface response parameters, the target acquisition function corresponding to the target response parameter is triggered to concatenate the target response parameter with the target prefix and report it to the recording system together with the backend interface path in the closure through the second reporting network request; wherein, the target prefix is ​​the prefix corresponding to the proxy object to which the target acquisition function belongs, the prefix of the first layer of proxy objects is set to empty, and the prefix of each intermediate layer of proxy objects is set to the concatenation result of the complex attribute to which it belongs and the prefix of the previous layer of proxy objects.

[0117] If the properties in a regular object have nested levels, when constructing the fetch functions in each layer of proxy objects, the fetch function can be configured to concatenate the target response parameter with the prefix corresponding to the proxy object to which the fetch function belongs, and then report it to the recording system via a second reporting network request along with the backend interface path in the closure, when reporting the accessed property (i.e., the target response parameter). The prefix of the first-layer proxy object is set to empty; that is, when the fetch function in the first-layer proxy object is triggered, it only reports the accessed first-layer property and the backend interface path. The prefix of each intermediate layer of proxy objects (referring to proxy objects other than the first-layer proxy object, such as the second-layer proxy object, the third-layer proxy object, etc.) is set to the concatenation result of the complex property to which that layer of proxy object belongs and the prefix of the previous layer of proxy object. It is understandable that each layer of proxy objects is constructed for complex attributes, and the complex attribute it targets is the complex attribute to which it belongs; for example, the complex attribute to which the second-layer proxy object 1 is constructed for the complex attribute 'a' in the first-layer attributes is the complex attribute 'a'; the complex attribute to which the second-layer proxy object 1 is constructed for the complex attribute 'b' in the first-layer attributes is the complex attribute 'b'.

[0118] After the network service layer returns the proxy objects of each layer to the front end, when the front end accesses the target interface parameters, it triggers the target acquisition function corresponding to the target response parameter. The target response parameter is concatenated with the target prefix and reported to the recording system along with the backend interface path in the closure through the second reporting network request. The target prefix is ​​the prefix corresponding to the proxy object to which the target acquisition function belongs.

[0119] It should be noted that the method of concatenating the target response parameters with the target prefix, and the method of concatenating complex attributes with the prefix of the upper-level proxy object, are not limited in this embodiment. For example, two fields can be concatenated with the "." symbol.

[0120] In this embodiment, by using this prefix concatenation method, the retrieval functions in each layer of proxy objects can correctly report the path of the interface response parameters when they report the interface response parameters accessed by the front end.

[0121] Taking the data structure of a regular object as an example again, such as Figure 4 As shown, this ordinary object has a corresponding proxy object Proxy1. When the otp.code field is accessed, the retrieval function of proxy Proxy1 is triggered to report the otp field. The value referenced by otp is another proxy object Proxy2, which proxies the code field and triggers the retrieval function to report the otp.code field. In this way, the system can record that the otp field of this data structure has been used, and the code field under the otp field has also been used.

[0122] Furthermore, based on the above embodiments, a third embodiment of the interface parameter analysis method of the present invention is proposed. The interface parameter analysis method further includes:

[0123] Step S70: Mark the first reported network request and / or the second reported network request with a preset identifier;

[0124] After a network request is sent to the recording system, the recording system will return response information, such as a response message indicating successful reporting. To prevent the network service layer from treating the response information returned by the recording system as the response information returned by the backend server and causing interference to the frontend business code module, in this embodiment, the network request sent to the recording system can be distinguished from the network request sent to the backend server by marking it.

[0125] Specifically, the network service layer can mark the first reported network request and / or the second reported network request with a preset identifier. The preset identifier can be set as needed, and is not limited in this embodiment. If both the first and second reported network requests are marked, the preset identifiers for the two reported network requests can be the same or different. Network requests sent to the backend server may not be marked, or may be marked with an identifier different from the preset identifier.

[0126] Step S80: When a response message for a network request marked with the preset identifier is received, the response message is ignored.

[0127] When the network service layer receives a response to a network request marked with a preset identifier, it can ignore the response to avoid interfering with the front-end business code module.

[0128] For example, in one implementation, when creating an interface call network request, the interface call network request can be marked with identifier "1"; when creating a first reporting network request, it can be marked with identifier "2"; and when creating a second reporting network request, it can be marked with identifier "3". When the network service layer receives response information for network requests marked with identifiers "2" and "3", it ignores the response information and does not process it. When it receives response information for a network request marked with identifier "1", it extracts the interface response parameters and returns the interface response parameters to the front end.

[0129] In one implementation, such as Figure 5As shown, the request processing layer in the network service layer requests the network layer to create an interface call network request marked "1" and send it to the backend server, and requests the network layer to create a first reporting network request marked "2" and send it to the recording system. The network layer only sends the response information for the network request marked "1" back to the response processing layer. The "api call" in the diagram refers to the frontend calling an interface provided by the network service layer (different from the backend interface) and passing the backend interface path (corresponding to "path" in the diagram) and interface request parameters (corresponding to "params" in the diagram) to the request processing layer in the network service layer.

[0130] In one implementation, such as Figure 6 As shown, it is Figure 5 Based on this, the response processing layer constructs a proxy object (Proxy in the diagram) for the interface response parameters (i.e., data in the diagram), and returns the proxy object to the front end. When the front end accesses the interface response parameters, it triggers the getter function (i.e., getter in the diagram) in the proxy object to request the network layer to create a second reporting network request marked "3". The network layer then sends the second reporting network request to the recording system. The key in the diagram refers to the attribute in the proxy object, which is the interface response parameter.

[0131] Further, in one embodiment, step S30 includes:

[0132] Step S31: Check whether the interface request parameters corresponding to the backend interface path have been cached in the cache record;

[0133] Since the network service layer needs to report the backend interface path and interface request parameters to the recording system every time the frontend calls the backend interface, sending a network request to the recording system with each call would consume too much network traffic on the client side. Therefore, in this embodiment, the network service layer can add a cache record to temporarily cache the backend interface path and interface request parameters called by the frontend. Specifically, after receiving the backend interface path and interface request parameters from the frontend, the network service layer can first check whether the corresponding interface request parameters for that backend interface path are already cached in the cache record.

[0134] Step S32: If not cached, cache the interface request parameters to add the interface request parameters to the request parameter set corresponding to the backend interface path in the cache record;

[0135] If the cache record does not contain the request parameters for the corresponding backend interface path, it indicates that this is the first time the frontend has used the request parameters for that backend interface path. In this case, the network service layer can cache the request parameters to add them to the request parameter set for that backend interface path in the cache record. The network service layer can pre-set the request parameter sets for each backend interface path provided by the backend server, initially empty; or, if the network service layer has not pre-set the request parameter sets for each backend interface path, when it detects that the cache record does not yet contain the request parameter set for that backend interface path passed in by the frontend, it can create a new request parameter set for that backend interface path in the cache record and add the request parameters for that backend interface path passed in by the frontend to the newly created request parameter set.

[0136] If the cache record already caches the request parameters corresponding to the backend interface path, that is, the request parameter set of the backend interface path already contains the request parameters of the interface, it means that the frontend has already used the request parameters corresponding to the backend interface path. In this case, the network service layer does not need to cache them again, or the network service layer can count the number of times the request parameters of the interface are used in the request parameter set.

[0137] Step S33: When the cached record reaches the preset cache limit, the backend interface path in the cached record and the request parameter set corresponding to each backend interface path are sent to the record system through the first reporting network request.

[0138] When the network service layer detects that the cached records have reached the preset cache limit, it sends the backend interface paths in the cached records and the corresponding request parameter sets to the recording system via a first reporting network request. In other words, multiple frontend calls are reported to the recording system as a single network request, thereby reducing network traffic consumption on the client. The preset cache limit can be set as needed, for example, it can be set to reach the limit when the storage size reaches 512KB, or when the number of stored records exceeds 30.

[0139] Furthermore, each time the frontend accesses the interface response parameters, it needs to report to the recording system. If a network request is sent to the recording system every time, it will consume too much network traffic on the client side. To address this, in one implementation, when constructing the retrieval function in the proxy object, the retrieval function can be set to first pass the target response parameters to be accessed and the backend interface path in the closure to the network service layer when it is triggered. The network service layer checks whether the interface response parameters corresponding to the backend interface path are already cached in the cache record. If not, the interface response parameters are cached and added to the set of response parameters corresponding to the backend interface path in the cache record. When the cache record reaches a preset cache limit, each backend interface path and the set of response parameters corresponding to each backend interface path in the cache record are sent to the recording system via a second reporting network request. The specific implementation details of the interface response parameter caching process are similar to those of the interface request parameter caching process, and will not be elaborated here.

[0140] In this embodiment, by introducing cached records, the usage records of interface request parameters and interface response parameters can be merged and deduplicated before being reported. Even if the same interface or parameter is used multiple times, it will not result in multiple reports. By reasonably setting preset cache limits to control the frequency of sending network requests for reporting to the recording system, network resource overhead can be greatly optimized.

[0141] Furthermore, based on the above embodiments, a fourth embodiment of the interface parameter analysis method of the present invention is proposed. In this embodiment, the interface parameter analysis method is applied to a recording system, and the interface parameter analysis method includes:

[0142] Step A10: Receive a network reporting request, wherein the network reporting request includes a first network reporting request and a second network reporting request. The first network reporting request is a network request sent by the network service layer to the recording system after receiving the backend interface path and interface request parameters from the frontend. The network service layer sends an interface call network request to the backend server based on the backend interface path and interface request parameters. After receiving the response information sent by the backend server for the interface call network request, the network service layer obtains each interface response parameter in the response information, constructs a proxy object for each interface response parameter, and builds a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter. The backend interface path is written into the closure of the retrieval function, and the proxy object is returned to the frontend. When the frontend accesses the target response parameter in each interface response parameter, the retrieval function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second network reporting request.

[0143] Step A20: Record the backend interface path and interface parameters carried in the reported network request, and use the interface parameters as the used parameters of the backend interface path;

[0144] The recording system receives network reporting requests sent by the network service layer. These requests include a first network reporting request and a second network reporting request, corresponding to the first and second network reporting requests in the above embodiments, respectively. The recording system records the backend interface path and interface parameters carried in the network reporting requests, and uses the interface parameters as the used parameters of that backend interface path. The interface parameters include interface request parameters and interface response parameters. Specifically, if the received request is a first network reporting request, the system records the backend interface path and interface request parameters carried in the first network reporting request, and uses the interface request parameters as the used request parameters of that backend interface path. Similarly, if the received request is a first network reporting request, the system records the backend interface path and interface response parameters carried in the first network reporting request, and uses the interface response parameters as the used response parameters of that backend interface path.

[0145] Step A30: Obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

[0146] The recording system obtains and outputs the parameter statistics of the backend interface path based on the used parameters recorded for that backend interface path. Specifically, if the received request is the first reported network request, the system obtains the request parameter statistics based on the used request parameters; if the received request is the second reported network request, the system obtains the response parameter statistics based on the used response parameters. Specifically, the recording system can obtain and output a parameter statistics result each time a reported network request is received, based on the used parameters of the recorded backend interface path; alternatively, it can summarize the used parameters of the backend interface path from multiple reported network requests and output a single parameter statistics result. The recording system can output the used parameters of the backend interface path directly as the parameter statistics result, or it can determine the unused parameters based on the used parameters and output the unused parameters as the parameter statistics result. The recording system can output the parameter statistics result for display or as audio output; the specific output format is not limited. The recording system can output the parameter statistics result only upon receiving a user-triggered output command, or it can output the parameter statistics result periodically.

[0147] Further, in one embodiment, step A30, which involves obtaining the parameter statistics result of the backend interface path based on the recorded used parameters of the backend interface path, includes:

[0148] Step A31: Calculate the parameter utilization rate of the backend interface path based on the recorded used parameters of the backend interface path and the preset all parameters corresponding to the backend interface path.

[0149] The recording system can calculate the parameter utilization rate of a backend interface path based on the recorded used parameters and the preset total parameters corresponding to that backend interface path. Specifically, if the received request is the first network request, the request parameter utilization rate is calculated based on the recorded used request parameters and the preset total parameters corresponding to that backend interface path; if the received request is the second network request, the response parameter utilization rate is calculated based on the recorded used response parameters and the preset total response parameters corresponding to that backend interface path. The recording system pre-sets all parameters corresponding to each backend interface path, including all request parameters and all response parameters, typically stored in the backend interface documentation. Specifically, the request parameter utilization rate is obtained by dividing the number of used request parameters by the total number of parameters in the total request parameters, and the response parameter utilization rate is obtained by dividing the number of used response parameters by the total number of parameters in the total response parameters. For example, when a user logs in, the frontend needs to call the login interface ( / customer / login). Login requires passing the username and password as interface request parameters to the backend. Only after the backend verifies the password is the login successful. The network service layer reports the backend interface path " / customer / login" and the two interface request parameters "username" and "password" to the logging system. If the backend interface documentation in the logging system defines all request parameters for the backend interface path " / customer / login," including "username" and "password," then the usage rate of this interface's request parameters is 100%. However, if the backend interface documentation defines all request parameters for this interface, including "username," "password," and "verifyCode" (assuming login requires a verification code in addition to the password), then the usage rate of this interface's request parameters is 66.7%, meaning the frontend missed sending the parameter "verifyCode."

[0150] Step A32: When the parameter usage rate is less than a preset threshold, the backend interface path is used as the parameter statistics result, or the unused parameters of the backend interface path are determined based on the used parameters of the backend interface path and all parameters, and the backend interface path and the unused parameters are used as the parameter statistics result.

[0151] When the parameter usage rate of a backend interface path is less than a preset threshold, the recording system can use that backend interface path as a parameter statistics result. Specifically, when the request parameter usage rate of a backend interface path is less than the preset threshold, the recording system can use that backend interface path as a request parameter statistics result; when the response parameter usage rate of a backend interface path is less than the preset threshold, the recording system can use that backend interface path as a response parameter statistics result. The preset threshold can be set as needed, for example, to 100%. This means that if even one parameter of a backend interface path is not used by the frontend, the recording system will output that backend interface path, allowing developers to understand that the interface parameters defined for that backend interface path are not fully used, thus enabling them to review and modify the code. Alternatively, when the parameter usage rate of a backend interface path is less than a preset threshold, the recording system can determine the unused parameters of the backend interface path based on the used parameters and all parameters. That is, parameters included in all parameters but not included in the used parameters are recorded as unused parameters. The recording system uses the backend interface path and the unused parameter of the backend interface path as the parameter statistics result, so that developers can more intuitively understand which interface parameters of the backend interface path are not used, and then conduct targeted checks and modifications to the code.

[0152] Furthermore, such as Figure 7 As shown, in Figure 6 Based on this, the request processing layer first sends the backend interface path and interface request parameters to the cache record (corresponding to the param store in the image). The retrieval function is also set to send the backend interface path and interface response parameters to the cache record first when triggered. When the cache record reaches a certain cache limit, it will report to the record system in a unified manner.

[0153] In one implementation, all business function branches of the front-end can be run in a test environment. The recording system will then collect all parameter usage records generated during the execution of the front-end business code modules. Within the recording system, based on the back-end interface definition documents and collected reporting records, we can analyze the usage rate of interface request and response parameters for each back-end interface. Interface names with usage rates below 100% and the names of unused parameters for those interfaces are compiled into a report. Based on this report, developers can quickly identify which interface requests have omitted parameters or which responses have provided extra parameters, allowing for a practical analysis to determine if any fields need to be added or deleted.

[0154] The present invention also provides an interface parameter analysis system, which includes a network service layer and a recording system;

[0155] The network service layer is used to receive the backend interface path and interface request parameters passed from the frontend; send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request; and send a first reporting network request to the recording system according to the backend interface path and the interface request parameters.

[0156] The network service layer is further configured to, upon receiving response information from the backend server regarding the network request for the interface call, obtain each interface response parameter in the response information; construct a proxy object for each interface response parameter, and construct a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter, and write the backend interface path into the closure of the retrieval function; return the proxy object to the frontend, so that when the frontend accesses the target response parameter in each interface response parameter, the retrieval function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through a second reporting network request;

[0157] The recording system is used to receive network reporting requests, which include a first network reporting request and a second network reporting request; record the backend interface path and interface parameters carried in the network reporting request, and use the interface parameters as the used parameters of the backend interface path; obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

[0158] The extended content of the specific implementation of the interface parameter analysis system of the present invention is basically the same as the various embodiments of the interface parameter analysis method described above, and will not be repeated here.

[0159] The present invention also provides an interface parameter analysis device, which is deployed at the network service layer, and the interface parameter analysis device includes:

[0160] The first receiving module is used to receive the backend interface path and interface request parameters passed from the frontend;

[0161] The first sending module is used to send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request.

[0162] The second sending module is used to send a first reporting network request to the recording system according to the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters according to the first reporting network request;

[0163] The acquisition module is used to acquire the response parameters of each interface in the response information after receiving the response information sent by the backend server for the network request to the interface call.

[0164] A construction module is used to construct proxy objects for the response parameters of each interface, and to build a retrieval function in the proxy object for proxying the retrieval operation of the response parameters of each interface, and to write the backend interface path into the closure of the retrieval function;

[0165] The return module is used to return the proxy object to the front end, so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request, so that the recording system can associate and record the backend interface path and the target response parameter according to the second reporting network request.

[0166] Furthermore, the construction module is also used for:

[0167] Each of the interface response parameters is converted into a regular object, wherein each of the interface response parameters corresponds to a property in the regular object;

[0168] Construct a first-level proxy object for the ordinary object, and build a get function in the first-level proxy object to proxy the first-level attribute get operation in the ordinary object;

[0169] The first-level attribute is used as the current-level attribute. For complex attributes that contain sub-attributes in the current-level attribute, a next-level proxy object is constructed. In the next-level proxy object, a retrieval function for the retrieval operation of each sub-attribute of the complex attribute is constructed.

[0170] The process continues until the current layer no longer contains complex attributes. Each sub-attribute of the complex attribute is taken as the current layer attribute. The process then returns to the previous step of constructing a next-layer proxy object for the complex attribute containing sub-attributes, and constructing a retrieval function in the next-layer proxy object to proxy the retrieval operation of each sub-attribute of the complex attribute.

[0171] Furthermore, the return module is also used for:

[0172] The proxy objects of each layer are returned to the front end so that when the front end accesses the target response parameters in the response parameters of each interface, the target acquisition function corresponding to the target response parameter is triggered to concatenate the target response parameter with the target prefix and report it to the recording system together with the backend interface path in the closure through the second reporting network request.

[0173] Wherein, the target prefix is ​​the prefix corresponding to the proxy object to which the target acquisition function belongs. The prefix of the first-level proxy object is set to empty, and the prefix of each intermediate-level proxy object is set to the concatenation result of the complex attribute to which it belongs and the prefix of the previous-level proxy object.

[0174] Furthermore, the device also includes:

[0175] The tagging module is used to tag the first reported network request and / or the second reported network request with a preset identifier;

[0176] The ignore module is used to ignore the response information when a response information for a network request marked with the preset identifier is received.

[0177] Furthermore, the second sending module is also used for:

[0178] Check whether the interface request parameters corresponding to the backend interface path have been cached in the cache record;

[0179] If not cached, the interface request parameters are cached and added to the request parameter set corresponding to the backend interface path in the cache record;

[0180] When the cached record reaches the preset cache limit, the backend interface path in the cached record and the request parameter set corresponding to each backend interface path are sent to the record system through the first reporting network request.

[0181] Furthermore, to achieve the above objectives, the present invention also provides an interface parameter analysis device, which is deployed in a recording system, and the interface parameter analysis device includes:

[0182] The second receiving module is used to receive network reporting requests, wherein the network reporting requests include a first network reporting request and a second network reporting request. The first network reporting request is a network request sent by the network service layer to the recording system after receiving the backend interface path and interface request parameters from the frontend. The network service layer sends an interface call network request to the backend server according to the backend interface path and the interface request parameters. After receiving the response information sent by the backend server for the interface call network request, the module obtains each interface response parameter in the response information, constructs a proxy object for each interface response parameter, and builds a getter function in the proxy object to proxy the getter operation of each interface response parameter. The backend interface path is written into the closure of the getter function, and the proxy object is returned to the frontend. When the frontend accesses the target response parameter in each interface response parameter, the getter function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second network reporting request.

[0183] The recording module is used to record the backend interface path and interface parameters carried in the reported network request, and to use the interface parameters as the used parameters of the backend interface path.

[0184] The output module is used to obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

[0185] Furthermore, the output module is also used for:

[0186] The parameter utilization rate of the backend interface path is calculated based on the recorded used parameters of the backend interface path and the preset all parameters corresponding to the backend interface path.

[0187] When the usage rate of the parameter is less than a preset threshold, the backend interface path is used as the parameter statistics result, or the unused parameters of the backend interface path are determined based on the used parameters of the backend interface path and all parameters, and the backend interface path and the unused parameters are used as the parameter statistics result.

[0188] The methods executed by the above-mentioned program units can be referred to in the various embodiments of the interface parameter analysis method of the present invention, and will not be repeated here.

[0189] The present invention also provides an interface parameter analysis device, which includes a memory, a processor, and an interface parameter analysis program stored in the memory and executable on the processor. The method implemented by the interface parameter analysis program when executed by the processor can be referred to in various embodiments of the interface parameter analysis method of the present invention, and will not be repeated here.

[0190] The present invention also provides a computer storage medium.

[0191] The present invention stores an interface parameter analysis program on a computer storage medium, and when the interface parameter analysis program is executed by a processor, it implements the steps of the interface parameter analysis method described above.

[0192] The method implemented when the interface parameter analysis program running on the processor is executed can be referred to in various embodiments of the interface parameter analysis method of the present invention, and will not be repeated here.

[0193] The present invention also provides a computer program product.

[0194] The computer program product of the present invention includes an interface parameter analysis program, which, when executed by a processor, implements the steps of the interface parameter analysis method as described above.

[0195] The method implemented when the interface parameter analysis program running on the processor is executed can be referred to in various embodiments of the interface parameter analysis method of the present invention, and will not be repeated here.

[0196] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0197] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0198] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0199] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method of interface parameter analysis, characterized by, The interface parameter analysis method is applied to the network service layer, and the interface parameter analysis method includes: Receive the backend interface path and interface request parameters from the frontend; The system sends an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request. A first reporting network request is sent to the recording system according to the backend interface path and the interface request parameters, so that the recording system can associate and record the backend interface path and the interface request parameters according to the first reporting network request; Upon receiving the response information sent by the backend server for the network request to the interface, the response parameters of each interface in the response information are obtained. Construct proxy objects for the response parameters of each interface, and build a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter, and write the backend interface path into the closure of the retrieval function; The proxy object is returned to the front end so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request, so that the recording system can associate and record the backend interface path and the target response parameter according to the second reporting network request.

2. The interface parameter analysis method as described in claim 1, characterized in that, The step of constructing a proxy object for each of the interface response parameters, and building a retrieval function in the proxy object for proxying the retrieval operation of each of the interface response parameters, includes: Each of the interface response parameters is converted into a regular object, wherein each of the interface response parameters corresponds to a property in the regular object; Construct a first-level proxy object for the ordinary object, and build a get function in the first-level proxy object to proxy the first-level attribute get operation in the ordinary object; The first-level attribute is used as the current-level attribute. For complex attributes that contain sub-attributes in the current-level attribute, a next-level proxy object is constructed. In the next-level proxy object, a retrieval function for the retrieval operation of each sub-attribute of the complex attribute is constructed. The process continues until the current layer no longer contains complex attributes. Each sub-attribute of the complex attribute is taken as the current layer attribute. The process then returns to the previous step of constructing a next-layer proxy object for the complex attribute containing sub-attributes, and constructing a retrieval function in the next-layer proxy object to proxy the retrieval operation of each sub-attribute of the complex attribute.

3. The interface parameter analysis method as described in claim 2, characterized in that, The step of returning the proxy object to the front end, so that when the front end accesses the target response parameter in each of the interface response parameters, triggering the acquisition function to report the target response parameter and the backend interface path in the closure to the recording system through a second reporting network request, includes: The proxy objects of each layer are returned to the front end so that when the front end accesses the target response parameters in the response parameters of each interface, the target acquisition function corresponding to the target response parameter is triggered to concatenate the target response parameter with the target prefix and report it to the recording system together with the backend interface path in the closure through the second reporting network request. Wherein, the target prefix is ​​the prefix corresponding to the proxy object to which the target acquisition function belongs. The prefix of the first-level proxy object is set to empty, and the prefix of each intermediate-level proxy object is set to the concatenation result of the complex attribute to which it belongs and the prefix of the previous-level proxy object.

4. The interface parameter analysis method as described in claim 1, characterized in that, The interface parameter analysis method also includes: The first reported network request and / or the second reported network request are marked with a preset identifier; When a response is received for a network request marked with the preset identifier, the response is ignored.

5. The interface parameter analysis method according to any one of claims 1 to 4, characterized in that, The step of sending the first reporting network request to the recording system according to the backend interface path and the interface request parameters includes: Check whether the interface request parameters corresponding to the backend interface path have been cached in the cache record; If not cached, the interface request parameters are cached and added to the request parameter set corresponding to the backend interface path in the cache record; When the cached record reaches the preset cache limit, the backend interface path in the cached record and the request parameter set corresponding to each backend interface path are sent to the record system through the first reporting network request.

6. A method for analyzing interface parameters, characterized in that, The interface parameter analysis method is applied to a recording system, and the interface parameter analysis method includes: The system receives network requests for reporting, which include a first network request and a second network request. The first network request is a network request sent by the network service layer to the recording system after receiving the backend interface path and interface request parameters from the frontend. The network service layer sends an interface call network request to the backend server based on the backend interface path and interface request parameters. After receiving the response information sent by the backend server for the interface call network request, the system obtains each interface response parameter in the response information, constructs a proxy object for each interface response parameter, and builds a retrieval function in the proxy object to proxy the retrieval operation of each interface response parameter. The backend interface path is written into the closure of the retrieval function, and the proxy object is returned to the frontend. When the frontend accesses the target response parameter in each interface response parameter, the retrieval function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second network request. The backend interface path and interface parameters carried in the reported network request are recorded, and the interface parameters are used as the backend interface path parameters. The parameter statistics of the backend interface path are obtained based on the recorded used parameters of the backend interface path, and the parameter statistics are output.

7. The interface parameter analysis method as described in claim 6, characterized in that, The step of obtaining the parameter statistics result of the backend interface path based on the recorded used parameters of the backend interface path includes: The parameter utilization rate of the backend interface path is calculated based on the recorded used parameters of the backend interface path and the preset all parameters corresponding to the backend interface path. When the usage rate of the parameter is less than a preset threshold, the backend interface path is used as the parameter statistics result, or the unused parameters of the backend interface path are determined based on the used parameters of the backend interface path and all parameters, and the backend interface path and the unused parameters are used as the parameter statistics result.

8. An interface parameter analysis system, characterized in that, The interface parameter analysis system includes a network service layer and a recording system; The network service layer is used to receive the backend interface path and interface request parameters passed from the frontend; send an interface call network request to the backend server according to the backend interface path and the interface request parameters, so that the backend server can respond to the interface call network request; and send a first reporting network request to the recording system according to the backend interface path and the interface request parameters. The network service layer is further configured to, upon receiving the response information sent by the backend server for the network request to call the interface, obtain the response parameters of each interface in the response information; construct a proxy object for each of the interface response parameters, and construct a retrieval function in the proxy object for proxying the retrieval operation of each of the interface response parameters, and write the backend interface path into the closure of the retrieval function; The proxy object is returned to the front end so that when the front end accesses the target response parameter in each of the interface response parameters, the acquisition function is triggered to report the target response parameter and the backend interface path in the closure to the recording system through the second reporting network request. The recording system is used to receive network reporting requests, which include a first network reporting request and a second network reporting request; record the backend interface path and interface parameters carried in the network reporting request, and use the interface parameters as the used parameters of the backend interface path; obtain the parameter statistics of the backend interface path based on the recorded used parameters of the backend interface path, and output the parameter statistics.

9. An interface parameter analysis device, characterized in that, The interface parameter analysis device includes: a memory, a processor, and an interface parameter analysis program stored in the memory and executable on the processor. When the interface parameter analysis program is executed by the processor, it implements the steps of the interface parameter analysis method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the interface parameter analysis method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Interface test script generation method and device, computer equipment and medium

    CN112817867A

  • Joint debugging method and device based on front and back ends of network, and storage medium

    CN112882844A