Method and device for generating interface document and electronic equipment

By using proxy forwarding devices and language processing models in the interface document generation device to automatically parse and generate interface documents, the problems of high manpower consumption and high error rate in the existing technology are solved, and efficient and accurate interface document generation is achieved, which is suitable for old systems and third-party systems.

CN120743340APending Publication Date: 2025-10-03NEW H3C TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510766178.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-09
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Existing technologies require a lot of human resources to generate interface documents, are inefficient and prone to errors, and are difficult to meet the requirements of large-scale distributed systems for accuracy, real-time and low-cost generation of interface documents. In particular, there are information gaps and document missing problems in old systems and third-party systems.

Method used

By connecting the proxy forwarding device between the interface document generation device and the client and server, request and response messages are collected in real time, and Nginx is used for traffic mirroring. In combination with language processing models and AI technology, the interface document is automatically parsed and generated, the required interface parameters are determined, and high-quality interface documents are automatically generated.

Benefits of technology

It reduces the consumption of human resources, improves the efficiency and accuracy of interface document generation, can quickly generate high-quality interface documents, shortens project development and maintenance time, and reduces costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743340A_ABST
    Figure CN120743340A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and particularly provides an interface document generation method and device and electronic equipment. The method comprises the following steps: obtaining interface information of an interface called by a request message, and obtaining response information carried by a response message; for each interface called by each request message in the set time period, determining whether necessary interface parameters exist in each interface parameter or not based on the number of the request messages calling the interface and the number of the request messages calling each interface parameter of the interface; determining interface paraphrasing information of each interface and parameter paraphrasing information of each interface parameter; and for each interface, generating an interface document based on the interface paraphrasing information and the interface information of the interface, the parameter paraphrasing information of the interface parameters, whether the interface parameters are required interface parameters or not, and the response information. Therefore, the cost can be reduced, and the interface document generation accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device and electronic device for generating an interface document. Background Art

[0002] With the rapid development of digital technology, modern software systems generally use interfaces for data interaction. For example, interfaces based on the Representational State Transfer (RESTful) architecture are usually used for data interaction.

[0003] Under related technologies, interface documents are usually generated and maintained by manually analyzing code logic line by line and extracting interface elements.

[0004] However, using this method, the workload of manually collecting information is large, which requires a lot of human resources, and the efficiency of interface document generation is low and prone to errors. Summary of the Invention

[0005] To solve the above technical problems, the embodiments of the present application provide a method, device and electronic device for generating an interface document.

[0006] In one aspect, an embodiment of the present application provides a method for generating an interface document. The method is applied to an interface document generating device. The interface document generating device is connected to a proxy forwarding device between a client and a server. The proxy forwarding device is used to forward messages between the client and the server and synchronize the forwarded messages to the interface document generating device. The method includes:

[0007] After receiving a response message synchronized by the proxy forwarding device each time within a set time period, based on a request message associated with the response message, obtain interface information of the interface called by the request message, and obtain response information carried by the response message; wherein the interface information includes at least interface parameters;

[0008] For each interface called by each request message within the set time period, based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface, determine whether there are mandatory interface parameters for the interface among the interface parameters of the interface;

[0009] Determine interface interpretation information of each interface called by each request message within a set time period, and determine parameter interpretation information of interface parameters of each interface called by each request message within a set time period;

[0010] For each interface called by each request message within a set time period, an interface document for the interface is generated based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned for the request message calling the interface.

[0011] In one embodiment, determining the interface interpretation information of each interface called by each request message within a set time period includes:

[0012] For each interface, perform the following steps:

[0013] Perform word segmentation on the interface name of the interface to obtain at least one word of the interface;

[0014] Obtain the corresponding definitions of at least one word;

[0015] Combining the definitions corresponding to at least one word to obtain initial interface definition information;

[0016] The initial interface interpretation information is input into a pre-trained language processing model to obtain adjusted interface interpretation information; wherein the language processing model is used to adjust the expression of the input information based on the semantic analysis of the input information.

[0017] In one embodiment, determining parameter interpretation information of interface parameters of each interface called by each request message within a set time period includes:

[0018] For each interface parameter, perform the following steps:

[0019] Perform word segmentation on the parameter name of the interface parameter to obtain at least one word of the interface parameter;

[0020] Obtaining the corresponding definitions of at least one word respectively;

[0021] Combining the definitions corresponding to at least one word to obtain initial parameter definition information;

[0022] The initial parameter interpretation information is input into a pre-trained language processing model to obtain adjusted parameter interpretation information; wherein the language processing model is used to adjust the representation of the input information according to the semantic analysis results of the input information.

[0023] In one embodiment, obtaining interface information of an interface called by the request message based on a request message associated with the response message, and obtaining response information carried by the response message, includes:

[0024] For each request message within a set time period, the request message is parsed according to the interface operation type of the request message and the data format of the request body in the request message to obtain the protocol information, network resource location information and interface information in the request message;

[0025] For each response message within the set time period, the response message is parsed according to the data format of the response information in the response message to obtain the response information.

[0026] In one embodiment, the interface information includes interface parameter information;

[0027] If the data format of the request body in the request message is not the set format, the interface parameter information includes the interface parameters and their corresponding parameter values ​​and parameter value types;

[0028] If the data format of the request body in the request message is the set format, the interface parameter information includes the structural relationship of multiple interface parameters, as well as each interface parameter and its corresponding parameter value and parameter value type;

[0029] If the data format of the response information in the response message is not the set format, the response information includes the attribute and its corresponding attribute value and attribute value type;

[0030] If the data format of the response information in the response message is the set format, the response information includes a structural relationship of multiple attributes, and each attribute and its corresponding attribute value and attribute value type.

[0031] In one embodiment, for each interface called by each request message within a set time period, determining whether a mandatory interface parameter of the interface exists among the interface parameters of the interface based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface includes:

[0032] For each interface called by a request message within a set time period, obtain the number of request messages that call the interface within the set time period, and the number of request messages that call each interface parameter of the interface;

[0033] For each interface parameter of the interface, if the number of request messages calling the interface within the set time period is the same as the number of request messages calling the interface parameter, then the interface parameter is determined to be a mandatory interface parameter of the interface; otherwise, it is determined that the interface parameter is not a mandatory interface parameter of the interface.

[0034] In one embodiment, for each interface called by a request message within a set time period, obtaining the number of request messages that call the interface within the set time period includes:

[0035] For each interface called by a request message within a set time period, count the number of all request messages that have the same message type as the request message and call the interface within the set time period;

[0036] The counted number is determined as the number of request messages that call the interface within the set time period.

[0037] In one implementation, the message type is characterized by the following parameters: protocol information and network resource location information.

[0038] In one aspect, an embodiment of the present application provides an apparatus for generating an interface document. The apparatus is applied to an interface document generating device. The interface document generating device is connected to a proxy forwarding device between a client and a server. The proxy forwarding device is used to forward messages between the client and the server and synchronize the forwarded messages to the interface document generating device. The apparatus includes:

[0039] an obtaining unit configured to obtain, each time within a set time period, after receiving a response message synchronized by the proxy forwarding device, interface information of the interface called by the request message based on the request message associated with the response message, and response information carried by the response message; wherein the interface information includes at least interface parameters;

[0040] a statistical unit for determining, for each interface called by each request message within a set time period, whether a mandatory interface parameter of the interface exists among the interface parameters of the interface based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface;

[0041] a determining unit, configured to determine interface interpretation information of each interface called by each request message within a set time period, and parameter interpretation information of interface parameters of each interface called by each request message within a set time period;

[0042] A generation unit is used to generate an interface document for each interface called by each request message within a set time period based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned by the request message calling the interface.

[0043] In one embodiment, the determining unit is configured to:

[0044] For each interface, perform the following steps:

[0045] Perform word segmentation on the interface name of the interface to obtain at least one word of the interface;

[0046] Obtain the corresponding definitions of at least one word;

[0047] Combining the definitions corresponding to at least one word to obtain initial interface definition information;

[0048] The initial interface interpretation information is input into a pre-trained language processing model to obtain adjusted interface interpretation information; wherein the language processing model is used to adjust the expression of the input information based on the semantic analysis of the input information.

[0049] In one embodiment, the determining unit is configured to:

[0050] For each interface parameter, perform the following steps:

[0051] Perform word segmentation on the parameter name of the interface parameter to obtain at least one word of the interface parameter;

[0052] Obtaining the corresponding definitions of at least one word respectively;

[0053] Combining the definitions corresponding to at least one word to obtain initial parameter definition information;

[0054] The initial parameter interpretation information is input into a pre-trained language processing model to obtain adjusted parameter interpretation information; wherein the language processing model is used to adjust the representation of the input information according to the semantic analysis results of the input information.

[0055] In one embodiment, obtaining interface information of an interface called by the request message based on a request message associated with the response message, and obtaining response information carried by the response message, includes:

[0056] For each request message within a set time period, the request message is parsed according to the interface operation type of the request message and the data format of the request body in the request message to obtain the protocol information, network resource location information and interface information in the request message;

[0057] For each response message within the set time period, the response message is parsed according to the data format of the response information in the response message to obtain the response information.

[0058] In one embodiment, the interface information includes interface parameter information;

[0059] If the data format of the request body in the request message is not the set format, the interface parameter information includes the interface parameters and their corresponding parameter values ​​and parameter value types;

[0060] If the data format of the request body in the request message is the set format, the interface parameter information includes the structural relationship of multiple interface parameters, as well as each interface parameter and its corresponding parameter value and parameter value type;

[0061] If the data format of the response information in the response message is not the set format, the response information includes the attribute and its corresponding attribute value and attribute value type;

[0062] If the data format of the response information in the response message is the set format, the response information includes a structural relationship of multiple attributes, and each attribute and its corresponding attribute value and attribute value type.

[0063] In one embodiment, the statistical unit is used to:

[0064] For each interface called by a request message within a set time period, obtain the number of request messages that call the interface within the set time period, and the number of request messages that call each interface parameter of the interface;

[0065] For each interface parameter of the interface, if the number of request messages calling the interface within the set time period is the same as the number of request messages calling the interface parameter, then the interface parameter is determined to be a mandatory interface parameter of the interface; otherwise, it is determined that the interface parameter is not a mandatory interface parameter of the interface.

[0066] In one embodiment, the statistical unit is used to:

[0067] For each interface called by a request message within a set time period, count the number of all request messages that have the same message type as the request message and call the interface within the set time period;

[0068] The counted number is determined as the number of request messages that call the interface within the set time period.

[0069] In one implementation, the message type is characterized by the following parameters: protocol information and network resource location information.

[0070] In one aspect, an embodiment of the present application provides an electronic device, including:

[0071] processor; and

[0072] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the steps of the method provided in any of the various optional implementations of generating any of the above-mentioned interface documents.

[0073] On the one hand, an embodiment of the present application provides a computer-readable storage medium storing computer instructions, which are used to enable a computer to execute the steps of the method provided in various optional implementation methods of generating any of the above-mentioned interface documents.

[0074] On the one hand, an embodiment of the present application provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the steps of the method provided in various optional implementation methods of generating any of the above-mentioned interface documents.

[0075] The method for generating an interface document in an embodiment of the present application includes, after each response message synchronized by a proxy forwarding device is received within a set time period, obtaining, based on a request message associated with the response message, interface information of the interface called by the request message, and obtaining response information carried by the response message; wherein the interface information includes at least interface parameters; respectively, for each interface called by each request message within the set time period, based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface, determining whether there are mandatory interface parameters for the interface in each interface parameter of the interface; determining interface interpretation information for each interface called by each request message within the set time period, and determining parameter interpretation information for the interface parameters of each interface called by each request message within the set time period; for each interface called by each request message within the set time period, generating an interface document for the interface based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned by the request message calling the interface. In this way, interface documents can be automatically generated through automatic parsing, translation and statistics, without the need for manual document organization, reducing human resources and time costs, and improving the accuracy of interface document generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] Figure 1 This is a schematic diagram of the architecture of an interface document generation system in an embodiment of the present application.

[0077] Figure 2 This is a flowchart of a method for generating an interface document in an embodiment of the present application.

[0078] Figure 3 This is a structural block diagram of a device for generating an interface document in an embodiment of the present application.

[0079] Figure 4 It is a structural diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0080] The technical solutions of the present application will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. In addition, the technical features involved in the different embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.

[0081] With the rapid development of digital technology, modern software systems generally use interfaces for data interaction. However, in the scenarios of traditional enterprise system transformation and third-party service docking, the lack, distortion and delayed maintenance of interface documents seriously restrict the collaborative efficiency between systems.

[0082] For legacy systems with long lifecycles (such as early manufacturing production management systems), their interface documentation often suffers from severe information gaps due to missing technical specifications during development, changes in development teams, or multiple iterative upgrades. For example, original documents may be lost due to damaged storage media or mismanagement. Parameter definitions and functional logic in existing documents may deviate from actual interface implementations. Especially after multiple rounds of technical upgrades, key information such as interface return value structures and exception handling mechanisms may lack synchronous updates. This can lead to extensive reverse engineering analysis required for system maintenance and secondary integration, significantly increasing development costs and project cycle risks.

[0083] When integrating with third-party systems, some vendors, driven by concerns about technical confidentiality or maintenance costs, often provide documentation with ambiguous parameter semantics, missing value ranges, and incomplete descriptions of nested data structures. This forces developers to infer interface behavior through black-box testing. This manual reverse engineering approach not only significantly reduces integration efficiency but also increases the risk of systemic risks such as data transmission anomalies and business logic errors due to misunderstandings.

[0084] Under related technologies, interface documents are usually generated and maintained by manually analyzing code logic line by line and extracting interface elements.

[0085] However, this approach requires a large number of developers to conduct code analysis, extract interface elements, and manually track code changes. The labor cost is high, the efficiency of interface document generation is low, and it is difficult to ensure real-time synchronization of interface documents. In addition, the manual transcription process is prone to problems such as mislabeling of parameter types or errors in the description of return value levels. Therefore, the accuracy of interface documents is low.

[0086] In summary, relevant technologies cannot meet the requirements of large-scale distributed systems for the accuracy, real-time performance, and low-cost generation and maintenance of interface documents, which will seriously hinder the digital transformation process of enterprises.

[0087] Based on the defects of the above-mentioned related technologies, a method, device and electronic device for generating an interface document are provided in the embodiments of the present application, aiming to reduce the labor cost of generating interface documents and improve the efficiency and accuracy of generating interface documents.

[0088] An embodiment of the present application provides a method for generating an interface document. The method can be applied to an interface document generating device. The interface document generating device can be any type of electronic device, such as a server, etc., and this application will not elaborate on this.

[0089] See Figure 1 The figure shows an architecture diagram of an interface document generation system. The interface document generation system includes an interface document generation device and a business system. The business system includes a terminal device with a client, a server, and a proxy forwarding device.

[0090] The proxy forwarding device is connected to the client, server, and interface document generation device respectively. As a traffic collection node, the proxy forwarding device forwards messages between the client and server and synchronizes the forwarded messages to the interface document generation device.

[0091] That is, when the client sends a request message, the proxy forwarding device receives the request message, forwards it to the server, and sends a copy of the request message to the interface document generation device. Then, when the server returns a response message based on the request message, the proxy forwarding device receives the response message, forwards it to the client, and sends a copy of the response message to the interface document generation device.

[0092] The following describes the deployment of a proxy forwarding device. The proxy forwarding device can utilize Nginx. Nginx is a high-performance World Wide Web (Web) server and reverse proxy server with powerful forwarding and traffic control capabilities, and is widely used for load balancing, static resource services, and reverse proxying. In the embodiments of the present application, reasonable configuration of forwarding rules in the Nginx configuration allows for accurate and real-time acquisition of request and response messages from the business system without interfering with the normal operation of the business system.

[0093] Specifically, while completing regular message forwarding, Nginx also copies the client's request message and its corresponding response message, and transmits the copied messages to the interface document generation device in real time, thereby ensuring the integrity and timeliness of the data required for interface document generation. This solution, based on mature middleware, not only ensures the stability of the business system but also meets the needs of automated interface document collection.

[0094] The following example illustrates the deployment and configuration of a proxy forwarding device. First, install Nginx software on a server (i.e., the proxy forwarding device) that is compatible with the business system's network environment and has sufficient performance. Then, add specific forwarding rules to the Nginx configuration file (e.g., nginx.conf or the relevant configuration files in the sites-available directory) to enable real-time collection of request and response packets.

[0095] Assuming the server address of the business system is backend.example.com and the listening port is 8080, the following configuration can be performed:

[0096]

[0097]

[0098] In the above configuration, the proxy_pass directive forwards the request message to the server in the business system. It also logs the request message and error information by setting access_log and error_log. It also uses custom request headers (such as X-Autogen-Doc-Request) to pass the request message to the interface document generator. For the response message, the sub_filter directive injects a JavaScript script into the response body, sending the response message along with the request message to the interface document generator.

[0099] The following example illustrates the construction of an interface document generation device. You can use Python's Flask framework to build a simple Web service (i.e., the service of the interface document generation device) to receive messages synchronized by the proxy forwarding device. The following code can be used to build it:

[0100]

[0101] The interface document generation device can run the above code, so that it can receive the message synchronized by the proxy forwarding device through the Flask framework, and call the process_and_store_data function to perform subsequent processing and storage on the received message for use in interface document generation.

[0102] See Figure 2 The figure is a flow chart of a method for generating an interface document in an embodiment of the present application, which is applied to Figure 1 The interface document generation device in the following is combined with Figure 1 and Figure 2 The method is described below. The specific implementation process of the method is as follows:

[0103] Step 201: After receiving a response message synchronized by the proxy forwarding device each time within a set time period, obtain the interface information of the interface called by the request message based on the request message associated with the response message, and obtain the response information carried by the response message; wherein the interface information includes at least interface parameters.

[0104] The response message is used to respond to the request message sent by the client to the server. The interface can be a RESTful architecture interface. RESTful is a software architecture style based on the Hypertext Transport Protocol (HTTP) protocol, which uses standard HTTP methods (such as GET, POST, PUT, and DELETE) to implement resource operations. The associated request message and response message can be determined based on the message identifier of the request message and the message identifier of the response message.

[0105] In one embodiment, when executing step 201, the following steps may be performed:

[0106] S2011: For each request message within the set time period, the request message is parsed according to the interface operation type of the request message and the data format of the request body in the request message to obtain the protocol information, network resource location information and interface information in the request message.

[0107] Among them, the interface information includes interface parameter information; if the data format of the request body in the request message is not the set format, the interface parameter information includes interface parameters and their corresponding parameter values ​​and parameter value types; if the data format of the request body in the request message is the set format, the interface parameter information includes the structural relationship of multiple interface parameters, as well as each interface parameter and its corresponding parameter value and parameter value type.

[0108] Optionally, the format may be JavaScript Object Notation (JSON) and / or Extensible Markup Language (XML). In practical applications, the format may be customized based on the actual application scenario and is not limited here. The interface document device may include a parsing module to parse the message.

[0109] For example, the request message may be an HTTP request message, and the interface operation type may be determined based on the request method of the HTTP request message. The request method may include at least one of the following: GET, POST, PUT, and DELETE.

[0110] If the request method is GET, the following method can be used to extract the interface parameter information: parse the interface parameter information from the Uniform Resource Identifier (URI) in the request message. Optionally, you can use regular expressions (RegEx) or a specialized parsing library to separate the parameter key-value pairs in the request message to obtain the interface parameters and parameter values, and also obtain the parameter value type.

[0111] If the request method is POST and the request body of the request message is in JSON format (that is, the request body data format is the set format), the interface parameter information can be extracted in the following way: through the JSON parsing library, the JSON format request body is converted into structured data that can be operated by the program (such as a dictionary, hash table), and the structural relationship of multiple interface parameters, as well as each interface parameter and its corresponding parameter value and parameter value type are extracted from the structured data.

[0112] For example, the JSON parsing library may be Python's JSON module.

[0113] S2012: For each response message within the set time period, the response message is parsed according to the data format of the response information in the response message to obtain response information.

[0114] The response information, which can also be referred to as a return value, includes attributes, their corresponding attribute values, and attribute value types if the data format of the response information in the response message is not the set format. If the data format of the response information in the response message is the set format, the response information includes the structural relationship of multiple attributes, as well as each attribute, its corresponding attribute value, and attribute value type.

[0115] In one embodiment, the data format of the response information in the response message is determined based on the specified field of the response header in the response message. If the response information is in JSON format, Python's JSON module can be used to convert it into structured data in a dictionary or list structure, and a recursive algorithm can be used to deeply traverse the structured data to automatically identify the structural relationship of multiple attributes in the structured data, as well as each attribute and its corresponding attribute value and attribute value type.

[0116] The structural relationship can also be called a nested structure. The attribute value is the example value. Since the data value type can include at least one of the following: string, number, Boolean, etc., when using a recursive algorithm to deeply traverse the structured data, the following method can be further adopted:

[0117] When the response information is a JSON object (object), that is, in JSON format, and all key-value pairs are extracted, the key (key) is determined as an attribute, and then the value (value), that is, the attribute value, can be further processed according to the data value type.

[0118] If the data value type is a basic type such as a string, numeric value, or Boolean value, you can directly record the data type and the specific attribute value. The attribute value can be used as an example.

[0119] If the data value type is an array, the type of the array element can be further determined. If the array element is an object, the object structure of the array element is recursively parsed again. Otherwise, the array is directly used as the attribute value.

[0120] For example, in the response information {"users":[{"name":"Alice","age":30},{"name":"Bob","age":25}]}, "users" is an array, and the array elements are objects. Then, the properties contained in the object can be further parsed, namely "name" (string type) and "age" (number type), and their corresponding property values.

[0121] In one embodiment, the data format of the response information in the response message is determined based on the specified field of the response header in the response message. If the response information is in XML format, Python's Element Tree library can be used to parse the XML data into a tree structure, and the nodes of the tree structure can be traversed to extract the structural relationship of multiple attributes, as well as each attribute and its corresponding attribute value and attribute value type, to ensure accurate parsing of complex XML data.

[0122] Step 202: For each interface called by each request message within the set time period, based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface, determine whether the interface parameters include the mandatory interface parameters of the interface.

[0123] In one embodiment, when executing step 202, the following steps may be performed:

[0124] S2021: For each interface called by a request message within a set time period, obtain the number of request messages that call the interface within the set time period, and the number of request messages that call each interface parameter of the interface.

[0125] In one embodiment, for each interface called by a request message within a set time period, the number of all request messages that have the same message type as the request message and call the interface within the set time period is counted; the counted number is determined as the number of request messages that call the interface within the set time period.

[0126] The message type is characterized by the following parameters: protocol information and network resource location information. For example, the protocol information may be HTTP, and the network resource location information may be the domain name and the path following the domain name.

[0127] S2022: For each interface parameter of the interface, if the number of request messages calling the interface within the set time period is the same as the number of request messages calling the interface parameter, then the interface parameter is determined to be a mandatory interface parameter of the interface; otherwise, it is determined that the interface parameter is not a mandatory interface parameter of the interface.

[0128] Furthermore, you can use the following methods to determine whether it is a mandatory interface parameter:

[0129] Determine the difference between the number of request messages that call the interface and the number of request messages that call the interface parameter within a set time period. If the difference is lower than the set threshold, determine that the interface parameter is a mandatory interface parameter of the interface; otherwise, determine that the interface parameter is not a mandatory interface parameter of the interface.

[0130] In actual applications, the threshold value can be set according to the actual application scenario, for example, it can be 5, which is not limited here.

[0131] This is because if an interface parameter always exists and its value is not empty in all request messages of the same message type and carrying the same interface, then the interface parameter is likely to be a required parameter. If an interface parameter only exists in some request messages, then the interface parameter is likely to be an optional parameter.

[0132] Optionally, a data storage structure (e.g., a list or database table) can be set up to record the message type, interface, and interface parameters of each request message. For example, the parsing module can parse the request message http: / / example.com / api / user?uid=123&name=John to obtain and record the message type, interface, and interface parameters of the request message, where the interface parameters include uid and name.

[0133] In one embodiment, each request message is divided into at least one message set according to the message type and the invoked interface, so that all request messages with the same message type and invoking the same interface are grouped into the same message set. Then, for each interface parameter in the interface of each request message in each message set, if the interface parameter is invoked by all request messages in the message set, the interface parameter is considered a mandatory interface parameter for the interface; otherwise, the interface parameter is determined not to be a mandatory interface parameter for the interface, and whether the interface parameter is a mandatory interface parameter for the interface is recorded in a data storage structure.

[0134] Furthermore, as the number of request messages continues to increase, the records of the data storage structure may be updated in real time, for example, whether the interface parameter is a mandatory interface parameter may be updated.

[0135] In this way, after obtaining the request message and the response message, the request message and the response message are analyzed in depth respectively. When parsing the request message, the differences in the interface parameters carried by each request message with the same message type and the same interface can be compared to determine whether the interface parameters are mandatory interface parameters.

[0136] Furthermore, the optional value range of the interface parameter may be determined based on the parameter values ​​of the same interface parameter, and optionally, may be further determined manually.

[0137] Step 203: Determine the interface interpretation information of each interface called by each request message within the set time period, and determine the parameter interpretation information of the interface parameter of each interface called by each request message within the set time period.

[0138] In an embodiment of the present application, a correspondence between word segmentation and interpretation may be pre-established, and the correspondence may also be referred to as a dictionary, so that interface interpretation information and / or parameter interpretation information may be generated through the correspondence.

[0139] Optionally, the above correspondence may be constructed based on explanations of some keywords and / or commonly used English-Chinese dictionary terms.

[0140] Specifically, the above correspondence can be constructed based on the abbreviation type keywords used in the current system and their corresponding interpretations. For example, the corresponding interpretation of PID is "Product ID" and the corresponding interpretation of CID is "Customer ID." The above correspondence can also be explained based on common English words in an English-Chinese dictionary and their corresponding Chinese words.

[0141] Optionally, the above correspondence can be stored in a database or file in the form of key-value pairs to facilitate rapid system queries. For example, the database can be a Structured Query Language (SQL) relational database, a distributed database (OceanBase, OB), a relational database management system (MySQL), or a remote dictionary server (Redis). The file can be a JSON file in the lightweight data exchange format.

[0142] In one embodiment, when determining the interface interpretation information of each interface called by each request message within a set time period, the following steps may be employed:

[0143] For each interface, perform the following steps:

[0144] The interface name of the interface is segmented to obtain at least one word of the interface; the interpretation corresponding to the at least one word is obtained; the interpretation corresponding to the at least one word is combined to obtain initial interface interpretation information; the initial interface interpretation information is input into a pre-trained language processing model to obtain adjusted interface interpretation information; wherein the language processing model is used to adjust the expression of the input information based on the semantic analysis of the input information.

[0145] In one embodiment, when determining the parameter interpretation information of the interface parameters of each interface called by each request message within a set time period, the following steps may be used:

[0146] For each interface parameter, perform the following steps:

[0147] The parameter name of the interface parameter is segmented to obtain at least one word of the interface parameter; the interpretation corresponding to the at least one word is obtained respectively; the interpretation corresponding to the at least one word is combined to obtain initial parameter interpretation information; the initial parameter interpretation information is input into a pre-trained language processing model to obtain adjusted parameter interpretation information; wherein the language processing model is used to adjust the expression of the input information according to the semantic analysis result of the input information.

[0148] The interface segmentation process involves segmenting the interface name. Similarly, the interface parameter segmentation process involves segmenting the interface parameter name. The following describes the segmentation process.

[0149] Alternatively, the interface or interface parameter can be decomposed into one or more words using word segmentation technology in natural language processing, and the meaning of each word can be searched in a dictionary. For example, the word segmentation technology can use Python's Chinese text segmentation library (jieba).

[0150] In this way, the interpretation information can be obtained by decomposing a complex description (ie, an interface or an interface parameter) into individual words (ie, word segmentation) and performing a dictionary query.

[0151] For example, after tokenizing the interface parameter "Retrieve product details by PID," the following words are generated: "Retrieve," "product," "details," "by," and "PID." A dictionary query only finds the definition for "PID," which is "Product ID," while no other definitions are found. Therefore, only "PID" is replaced with "Product ID," while the remaining original words are retained: "Retrieve," "product," "details," "by," and "Product ID." The definitions of each word can then be combined into a sentence, creating the initial parameter definition.

[0152] Furthermore, if the word has a corresponding explanation in the dictionary, it can be replaced with the explanation content; if not, the original word can be retained.

[0153] The language processing model is described below.

[0154] Language processing models can be used by invoking artificial intelligence (AI) services. For example, some AI services can be invoked to refine initial interface interpretation information and / or parameter interpretation information. The AI ​​services can be OpenAI's Generative Pre-trained Transformer (GPT) series application programming interfaces (APIs) or other natural language processing APIs.

[0155] As an example, the combined sentence (e.g., the initial parameter interpretation information) is input into the AI ​​service, and a clear request is made to generate a more accurate, clear, and idiomatic interpretation, so that output information (e.g., the adjusted parameter interpretation information) can be obtained. For example, after the combined sentence "retrieve product details through the product unique identifier (Product ID)" is input into the AI ​​service, the AI ​​service optimizes it and outputs the information "obtain detailed product information with the help of the product unique identifier", which is used as the final interpretation of the interface parameters (i.e., the adjusted parameter interpretation information). In this way, the readability and comprehensibility of the interface document can be improved.

[0156] For another example, after segmenting the interface "GetOrderDetailsByOID", the following words "Get", "Order", "Details", "By" and "OID" are obtained. Then, based on the dictionary query results, "OID" can be replaced with "Order Unique Identifier (Order ID)", thus obtaining the following content: "Get", "Order", "Details", "By" and "Order Unique Identifier (Order ID)". Further, the above content is combined into a sentence, namely the initial interface interpretation information, and the AI ​​service is called to process and polish the sentence to generate an interface explanation that is accurate, clear and in line with language habits, namely the adjusted interface interpretation information. For example, the initial interface interpretation information is "Get order details through the order unique identifier (Order ID)", and the adjusted interface interpretation information is "Get detailed order information through the order unique identifier".

[0157] Step 204: For each interface called by each request message within the set time period, an interface document for the interface is generated based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned for the request message calling the interface.

[0158] Under related technologies, manual code analysis, manual annotation, and organization of interface documents are usually performed. However, this consumes a lot of human resources and time costs, and has a high error rate. Furthermore, the interface documents of old systems and third-party systems are often missing or incomplete.

[0159] In the embodiment of the present application, in terms of technical architecture, based on Nginx kernel-level traffic mirroring technology, lossless collection and precise association of request and response messages are achieved, which can ensure the real-time and integrity of message acquisition. Secondly, through statistical analysis of request messages of the same message type and carrying the same interface and interface parameters, the necessity of interface parameters can be automatically determined, greatly improving the accuracy of interface parameter description. And through dictionary interpretation determination and AI semantic analysis, high-quality document descriptions that conform to natural language habits can be automatically generated.

[0160] In terms of efficiency, the efficiency of interface document generation is greatly improved. There is no need to manually write interface documents line by line. For old systems or third-party systems that lack detailed interface documents, interface documents can also be quickly generated in a short time. In a complex business system with a large number of interfaces, traditional manual document writing may require a lot of manpower and take weeks or even months. The method of the embodiment of the present application can be completed in a few hours or even less time, which greatly shortens the time for interface document generation during project development and maintenance, allowing developers to quickly devote themselves to core tasks such as system integration and function development, and speed up the overall progress of the project.

[0161] At the quality level, it can not only accurately and clearly explain the interface and interface parameters through pre-set dictionaries and AI technology, but also has powerful response message parsing capabilities, and can correctly handle various complex data value types and nested structures, reducing omissions and errors that may occur in the manual document writing process, and ensuring the consistency of the interface document with the actual interface. This enables developers to fully and accurately understand the interface functions, interface parameter requirements and response information structure when reading the interface document. Compared with the problems of inaccurate parsing or vague interpretation of complex response messages that may exist in traditional manually written documents, the interface document generated by the method of the embodiment of the present application can provide developers with a more reliable reference, reduce the development risks caused by misunderstanding of the interface, improve the quality and stability of system development, and help developers better perform data processing and business logic design.

[0162] In terms of compatibility, it has wide applicability and compatibility. Regardless of the type of old system or third-party system provided by different suppliers, as long as the request message and response message can be obtained through nginx, the method of the embodiment of the present application can be applied to generate the interface document. This makes the present application have extremely high application value in different industries, enterprises and projects of different sizes, and can provide strong support for the development, maintenance and integration of various systems, help enterprises better integrate various system resources, and promote the in-depth development of enterprise digital transformation and information construction.

[0163] Based on the same inventive concept, an interface document generation device is also provided in an embodiment of the present application. Since the principle of solving the problem by the above-mentioned device and equipment is similar to a method for generating an interface document, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated. The device can be applied to electronic devices. This application does not limit the type of electronic device. It can be any type of device suitable for implementation, such as terminal devices and servers, etc. This application will not go into details. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the electronic device in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory for execution.

[0164] See Figure 3 , which is a block diagram of a device for generating an interface document in an embodiment of the present application. In some embodiments, the device for generating an interface document in the example of the present application includes:

[0165] The obtaining unit 301 is configured to obtain, each time within a set time period, after receiving a response message synchronized by the proxy forwarding device, interface information of the interface called by the request message based on the request message associated with the response message, and response information carried in the response message; wherein the interface information includes at least interface parameters;

[0166] A counting unit 302 is configured to determine, for each interface called by each request message within a set time period, whether a mandatory interface parameter of the interface is present in each interface parameter of the interface based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface;

[0167] The determining unit 303 is configured to determine interface interpretation information of each interface called by each request message within a set time period, and parameter interpretation information of interface parameters of each interface called by each request message within a set time period;

[0168] The generation unit 304 is used to generate an interface document for each interface called by each request message within a set time period based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned for the request message calling the interface.

[0169] In one implementation, the determining unit 303 is configured to:

[0170] For each interface, perform the following steps:

[0171] Perform word segmentation on the interface name of the interface to obtain at least one word of the interface;

[0172] Obtain the corresponding definitions of at least one word;

[0173] Combining the definitions corresponding to at least one word to obtain initial interface definition information;

[0174] The initial interface interpretation information is input into a pre-trained language processing model to obtain adjusted interface interpretation information; wherein the language processing model is used to adjust the expression of the input information based on the semantic analysis of the input information.

[0175] In one implementation, the determining unit 303 is configured to:

[0176] For each interface parameter, perform the following steps:

[0177] Perform word segmentation on the parameter name of the interface parameter to obtain at least one word of the interface parameter;

[0178] Obtaining the corresponding definitions of at least one word respectively;

[0179] Combining the definitions corresponding to at least one word to obtain initial parameter definition information;

[0180] The initial parameter interpretation information is input into a pre-trained language processing model to obtain adjusted parameter interpretation information; wherein the language processing model is used to adjust the representation of the input information according to the semantic analysis results of the input information.

[0181] In one embodiment, obtaining interface information of an interface called by the request message based on a request message associated with the response message, and obtaining response information carried by the response message, includes:

[0182] For each request message within a set time period, the request message is parsed according to the interface operation type of the request message and the data format of the request body in the request message to obtain the protocol information, network resource location information and interface information in the request message;

[0183] For each response message within the set time period, the response message is parsed according to the data format of the response information in the response message to obtain the response information.

[0184] In one embodiment, the interface information includes interface parameter information;

[0185] If the data format of the request body in the request message is not the set format, the interface parameter information includes the interface parameters and their corresponding parameter values ​​and parameter value types;

[0186] If the data format of the request body in the request message is the set format, the interface parameter information includes the structural relationship of multiple interface parameters, as well as each interface parameter and its corresponding parameter value and parameter value type;

[0187] If the data format of the response information in the response message is not the set format, the response information includes the attribute and its corresponding attribute value and attribute value type;

[0188] If the data format of the response information in the response message is the set format, the response information includes a structural relationship of multiple attributes, and each attribute and its corresponding attribute value and attribute value type.

[0189] In one implementation, the statistics unit 302 is configured to:

[0190] For each interface called by a request message within a set time period, obtain the number of request messages that call the interface within the set time period, and the number of request messages that call each interface parameter of the interface;

[0191] For each interface parameter of the interface, if the number of request messages calling the interface within the set time period is the same as the number of request messages calling the interface parameter, then the interface parameter is determined to be a mandatory interface parameter of the interface; otherwise, it is determined that the interface parameter is not a mandatory interface parameter of the interface.

[0192] In one implementation, the statistics unit 302 is configured to:

[0193] For each interface called by a request message within a set time period, count the number of all request messages that have the same message type as the request message and call the interface within the set time period;

[0194] The counted number is determined as the number of request messages that call the interface within the set time period.

[0195] In one implementation, the message type is characterized by the following parameters: protocol information and network resource location information.

[0196] In one aspect, an embodiment of the present application provides an electronic device, including:

[0197] processor; and

[0198] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the steps of the method provided in any of the various optional implementations of generating any of the above-mentioned interface documents.

[0199] On the one hand, an embodiment of the present application provides a computer-readable storage medium storing computer instructions, which are used to enable a computer to execute the steps of the method provided in various optional implementation methods of generating any of the above-mentioned interface documents.

[0200] On the one hand, an embodiment of the present application provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the steps of the method provided in various optional implementation methods of generating any of the above-mentioned interface documents.

[0201] The method for generating an interface document in an embodiment of the present application includes, after each response message synchronized by a proxy forwarding device is received within a set time period, obtaining, based on a request message associated with the response message, interface information of the interface called by the request message, and obtaining response information carried by the response message; wherein the interface information includes at least interface parameters; respectively, for each interface called by each request message within the set time period, based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface, determining whether there are mandatory interface parameters for the interface in each interface parameter of the interface; determining interface interpretation information for each interface called by each request message within the set time period, and determining parameter interpretation information for the interface parameters of each interface called by each request message within the set time period; for each interface called by each request message within the set time period, generating an interface document for the interface based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned by the request message calling the interface. In this way, interface documents can be automatically generated through automatic parsing, translation and statistics, without the need for manual document organization, reducing human resources and time costs, and improving the accuracy of interface document generation.

[0202] In an embodiment of the present application, an electronic device is further provided, including:

[0203] processor; and

[0204] The memory stores computer instructions, where the computer instructions are used to enable the processor to execute the method of any of the above embodiments.

[0205] In an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a computer to execute the method of any of the above-mentioned embodiments.

[0206] An embodiment of the present application also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device implements any of the above-mentioned methods.

[0207] Figure 4 FIG. 4 shows a schematic structural diagram of an electronic device 4000. Figure 4 As shown, the electronic device 4000 includes: a processor 4010 and a memory 4020, and optionally, may also include a power supply 4030, a display unit 4040, and an input unit 4050.

[0208] The processor 4010 is the control center of the electronic device 4000. It uses various interfaces and lines to connect various components, and performs various functions of the electronic device 4000 by running or executing software programs and / or data stored in the memory 4020, thereby monitoring the electronic device 4000 as a whole.

[0209] In the embodiment of the present application, the processor 4010 executes the various steps in the above embodiment when calling the computer program stored in the memory 4020.

[0210] Optionally, processor 4010 may include one or more processing units. Preferably, processor 4010 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and applications, and the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into processor 4010. In some embodiments, the processor and memory may be implemented on a single chip. In some embodiments, they may also be implemented on separate chips.

[0211] The memory 4020 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, various applications, etc., and the data storage area may store data created based on the use of the electronic device 4000. In addition, the memory 4020 may include a high-speed random access memory and a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0212] The electronic device 4000 also includes a power supply 4030 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 4010 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0213] The display unit 4040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 4000. In the embodiment of the present application, it is mainly used to display the display interface of each application in the electronic device 4000 and objects such as text and pictures displayed on the display interface. The display unit 4040 may include a display panel 4041. The display panel 4041 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.

[0214] The input unit 4050 can be used to receive information such as numbers or characters input by the user. The input unit 4050 may include a touch panel 4051 and other input devices 4052. The touch panel 4051, also known as a touch screen, can receive user touch operations on or near it (for example, operations performed by the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 4051).

[0215] Specifically, the touch panel 4051 can detect user touch operations and the signals generated by the touch operations, convert these signals into touch point coordinates, send them to the processor 4010, and receive and execute commands sent by the processor 4010. In addition, the touch panel 4051 can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 4052 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, a joystick, etc.

[0216] Of course, the touch panel 4051 can cover the display panel 4041. When the touch panel 4051 detects a touch operation on or near it, it transmits it to the processor 4010 to determine the type of touch event. Then the processor 4010 provides corresponding visual output on the display panel 4041 according to the type of touch event. Figure 4 In the embodiment, the touch panel 4051 and the display panel 4041 are two independent components to realize the input and output functions of the electronic device 4000, but in some embodiments, the touch panel 4051 and the display panel 4041 can be integrated to realize the input and output functions of the electronic device 4000.

[0217] The electronic device 4000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 4000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of this application, Figure 4It is not shown and will not be described in detail.

[0218] Those skilled in the art will understand that Figure 4 The electronic device is merely an example and does not limit the electronic device. The electronic device may include more or fewer components than shown in the figure, or may include a combination of certain components or different components.

[0219] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

Claims

1. A method for generating an interface document, characterized in that: The method is applied to an interface document generation device, the interface document generation device is connected to a proxy forwarding device between a client and a server, the proxy forwarding device is used to forward messages between the client and the server, and synchronize the forwarded messages to the interface document generation device, the method comprising: After receiving a response message synchronized by the proxy forwarding device each time within a set time period, based on a request message associated with the response message, obtain interface information of an interface called by the request message, and obtain response information carried by the response message; wherein the interface information includes at least interface parameters; Determining, for each interface called by each request message within the set time period, whether a mandatory interface parameter of the interface exists among the interface parameters of the interface based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface; Determining interface interpretation information of each interface called by each request message within the set time period, and determining parameter interpretation information of interface parameters of each interface called by each request message within the set time period; For each interface called by each request message within the set time period, an interface document for the interface is generated based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned for the request message calling the interface.

2. The method according to claim 1, characterized in that The determining of the interface interpretation information of each interface called by each request message within the set time period includes: For each interface, perform the following steps: Perform word segmentation on the interface name of the interface to obtain at least one word of the interface; Obtaining definitions corresponding to the at least one word; Combining the definitions corresponding to the at least one word to obtain initial interface definition information; The initial interface interpretation information is input into a pre-trained language processing model to obtain adjusted interface interpretation information; wherein the language processing model is used to adjust the expression of the input information based on semantic analysis of the input information.

3. The method according to claim 1, characterized in that The parameter interpretation information of the interface parameters of each interface called by each request message within the set time period is determined, including: For each interface parameter, perform the following steps: Perform word segmentation on the parameter name of the interface parameter to obtain at least one word of the interface parameter; Obtaining definitions corresponding to the at least one word respectively; Combining the definitions corresponding to the at least one word to obtain initial parameter definition information; The initial parameter interpretation information is input into a pre-trained language processing model to obtain adjusted parameter interpretation information; wherein the language processing model is used to adjust the expression of the input information according to the semantic analysis result of the input information.

4. The method according to any one of claims 1 to 3, characterized in that The obtaining, based on the request message associated with the response message, interface information of the interface called by the request message, and obtaining response information carried by the response message, includes: Parsing each request message within the set time period according to the interface operation type of the request message and the data format of the request body in the request message to obtain protocol information, network resource location information, and interface information in the request message; For each response message within the set time period, the response message is parsed according to the data format of the response information in the response message to obtain response information.

5. The method according to claim 4, characterized in that The interface information includes interface parameter information; If the data format of the request body in the request message is not the set format, the interface parameter information includes the interface parameters and their corresponding parameter values ​​and parameter value types; If the data format of the request body in the request message is a set format, the interface parameter information includes a structural relationship of multiple interface parameters, and each interface parameter and its corresponding parameter value and parameter value type; If the data format of the response information in the response message is not the set format, the response information includes the attribute and its corresponding attribute value and attribute value type; If the data format of the response information in the response message is the set format, the response information includes a structural relationship of multiple attributes, and each attribute and its corresponding attribute value and attribute value type.

6. The method according to any one of claims 1 to 3, characterized in that The determining, for each interface called by each request message within the set time period, whether there is a mandatory interface parameter for the interface among the interface parameters of the interface based on the number of request messages that call the interface within the set time period and the number of request messages that call each interface parameter of the interface, includes: For each interface called by a request message within the set time period, obtain the number of request messages that call the interface within the set time period, and the number of request messages that call each interface parameter of the interface; For each interface parameter of the interface, if the number of request messages calling the interface within the set time period is the same as the number of request messages calling the interface parameter, then the interface parameter is determined to be a mandatory interface parameter of the interface; otherwise, it is determined that the interface parameter is not a mandatory interface parameter of the interface.

7. The method according to claim 6, characterized in that The obtaining, for each interface called by the request message within the set time period, the number of request messages that call the interface within the set time period includes: For each interface called by the request message within the set time period, count the number of all request messages that have the same message type as the request message and call the interface within the set time period; The counted number is determined as the number of request messages that call the interface within the set time period.

8. The method according to claim 7, characterized in that The message type is characterized by the following parameters: protocol information and network resource location information.

9. A device for generating an interface document, characterized in that: The device is applied to an interface document generation device, the interface document generation device is connected to a proxy forwarding device between a client and a server, the proxy forwarding device is used to forward messages between the client and the server, and synchronize the forwarded messages to the interface document generation device, the device includes: an obtaining unit configured to obtain, each time within a set time period, after receiving a response message synchronized by the proxy forwarding device, interface information of the interface called by the request message based on the request message associated with the response message, and response information carried by the response message; wherein the interface information includes at least interface parameters; a statistical unit, configured to determine, for each interface called by each request message within the set time period, whether a mandatory interface parameter of the interface exists among the interface parameters of the interface based on the number of request messages calling the interface within the set time period and the number of request messages calling each interface parameter of the interface; a determining unit, configured to determine interface interpretation information of each interface called by each request message within the set time period, and to determine parameter interpretation information of interface parameters of each interface called by each request message within the set time period; A generation unit is used to generate an interface document for each interface called by each request message within the set time period based on the interface interpretation information of the interface, the interface information of the interface, the parameter interpretation information of the interface parameters in the interface information, the determination result of whether the interface parameters in the interface information are mandatory interface parameters of the interface, and the response information returned for the request message calling the interface.

10. An electronic device, characterized in that: include: processor; as well as A memory storing computer instructions, wherein the computer instructions are used to enable the processor to execute the method according to any one of claims 1 to 8.