Interface request example generation method and apparatus, electronic device, and storage medium
By displaying interface parameters and candidate request parameters in the operation interface, the target object can directly select them. Combined with historical interface request data processing, accurate interface request examples are generated, which solves the problems of low efficiency and high debugging failure rate in the existing technology, and simplifies the combination of interface request parameters and improves the debugging success rate.
Patent Information
- Application Number
- CN202111282591.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2041-11-01
AI Technical Summary
The existing technology for generating interface request examples is inefficient and has a high failure rate in debugging. This is mainly because the target object needs to read the interface documentation and manually write the interface request parameters, which is prone to errors.
By displaying the interface parameter names and their corresponding candidate interface request parameters in the operation interface, the target object can directly select the interface request parameters, generate a target interface request example, and use historical interface request data processing to generate an accurate interface request example.
It simplifies the process of combining interface request parameters, lowers the threshold for debugging and development, and improves the accuracy of interface request examples and the success rate of debugging.
Smart Images

Figure CN116069305B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating interface request examples. Background Technology
[0002] With the development of technology, various types of applications have emerged. To ensure the smooth operation of these applications, it is necessary for the front-end and back-end interfaces to be interconnected; therefore, interface testing is conducted during the application development process.
[0003] In practical applications, API testing scenarios require the generation of API request examples. Related technologies include using Curl to display API request examples and using Postman to generate API request examples.
[0004] When demonstrating interface request examples using Curl requests, the target object needs to read the interface documentation, combine the interface request parameters according to its understanding, and can only perceive the interface request example with the combination of interface request parameters during the actual call process. The overall efficiency is low and the debugging failure rate is too high.
[0005] When using Postman to generate API request examples, Postman provides a graphical interface that displays API request examples in a relatively intuitive way. However, the target object still needs to understand the API documentation and actively write API request parameters. Errors can occur during the process of writing API request parameters, which ultimately reduces the accuracy of API request examples and increases the debugging failure rate.
[0006] Therefore, how to generate simple and accurate API request examples to improve debugging success rate is a technical problem that needs to be solved. Summary of the Invention
[0007] This application provides a method, apparatus, electronic device, and storage medium for generating interface request examples, which can simply and accurately generate interface request examples to improve the debugging success rate.
[0008] In a first aspect, embodiments of this application provide a method for generating interface request examples, the method comprising:
[0009] In response to the function request command triggered by the target object for the target function, display at least one interface parameter name corresponding to the target function in the operation interface;
[0010] For at least one interface parameter name, perform the following operations respectively: respond to the display instruction for an interface parameter name, display each candidate interface request parameter corresponding to the interface parameter name in the operation interface, and respond to the interface request parameter selection instruction to select the target interface request parameter from each candidate interface request parameter.
[0011] Based on the obtained target interface request parameters, generate a target interface request example.
[0012] Secondly, embodiments of this application provide another method for generating interface request examples, the method comprising:
[0013] The system receives various target interface request parameters sent by the terminal device. Each target interface request parameter is selected from the candidate interface request parameters corresponding to the corresponding interface request parameter name based on the interface request parameter selection instruction.
[0014] Based on the request parameters of each target interface, in the historical request examples, filter the historical request examples that contain the request parameters of each target interface, and use the filtered historical request examples as the target interface request examples;
[0015] The target interface request example is returned to the terminal device so that the terminal device can display the target interface request example in the operation interface.
[0016] Thirdly, embodiments of this application provide an interface request example generation apparatus, the apparatus comprising:
[0017] The display unit is used to respond to the function request command triggered by the target object for the target function, and to display at least one interface parameter name corresponding to the target function in the operation interface.
[0018] The response unit is used to perform the following operations for at least one interface parameter name: respond to the display instruction for an interface parameter name, display each candidate interface request parameter corresponding to the interface parameter name in the operation interface, and respond to the interface request parameter selection instruction to select the target interface request parameter from each candidate interface request parameter.
[0019] The generation unit is used to generate target interface request examples based on the obtained target interface request parameters.
[0020] In one possible implementation, the display unit is specifically used for:
[0021] In response to a function request instruction, the system sends the target function corresponding to the function request instruction to the backend server. This enables the backend server to determine and return the target interface parameter information corresponding to the target function based on the correspondence between the function and the interface parameter information. The correspondence is obtained by the backend server based on historical interface request data.
[0022] Based on the first sub-correspondence between the target function and the interface parameter name contained in the received target interface parameter information, at least one interface parameter name corresponding to the target function is displayed in the operation interface.
[0023] In one possible implementation, the response unit is specifically used for:
[0024] If the target interface parameter information contains a second sub-correspondence between interface parameter name and interface request parameter, then based on the second sub-correspondence, the various candidate interface request parameters corresponding to an interface parameter name will be displayed in the operation interface.
[0025] If the target interface parameter information does not include interface request parameters, an interface parameter name is sent to the backend server to show the backend server's second-order correspondence between the interface parameter name and the interface request parameters, and the corresponding candidate interface request parameters are returned by the interface parameter name.
[0026] In one possible implementation, the response unit determines the candidate interface request parameters corresponding to an interface parameter name in the following way:
[0027] If it is determined that there are currently selected interface request parameters corresponding to other interface parameter names besides one interface parameter name, then based on the linkage relationship between the selected interface request parameters and the interface request parameters corresponding to one interface parameter name, among all the interface request parameters corresponding to one interface parameter name, the interface request parameters that have a linkage relationship with the selected interface request parameters are filtered out, and the filtered interface request parameters are used as candidate interface request parameters. The linkage relationship is obtained based on historical interface request data.
[0028] If it is determined that there is no currently selected interface request parameter corresponding to any interface parameter name other than one interface parameter name, then all interface request parameters corresponding to one interface parameter name will be used as candidate interface request parameters.
[0029] In one possible implementation, the response unit is specifically used for:
[0030] The interface displays the first type of interface request parameters carrying a candidate identifier and the second type of interface request parameters carrying a non-selectable identifier.
[0031] In one possible implementation, the generating unit is specifically used for:
[0032] The request parameters of each target interface and the target request Uniform Resource Locator (URL) corresponding to the target function are reported to the backend server so that the backend server can filter the historical request examples containing the request parameters of each target interface from all historical request examples corresponding to the target request URL, and use the filtered historical request examples as the target interface request examples.
[0033] Receive the target interface request example returned by the backend server and display the target interface request example in the operation interface.
[0034] In one possible implementation, the generating unit is also used for:
[0035] If multiple target interface request examples are received, they will be displayed in pages.
[0036] The object information in the target interface request example is encrypted.
[0037] Fourthly, embodiments of this application provide an interface request example generation apparatus, the apparatus comprising:
[0038] The receiving unit is used to receive various target interface request parameters sent by the terminal device. Each target interface request parameter is selected from the various candidate interface request parameters corresponding to the corresponding interface request parameter name based on the interface request parameter selection instruction.
[0039] The filtering unit is used to filter historical request examples that contain the request parameters of each target interface based on the request parameters of each target interface, and use the filtered historical request examples as target interface request examples.
[0040] The return unit is used to return a sample of the target interface request to the terminal device so that the terminal device can display the sample of the target interface request in the operation interface.
[0041] In one possible implementation, before receiving the various target interface request parameters sent by the terminal device, the receiving unit is further configured to:
[0042] The target function is received from the terminal device, where the target function is determined based on the function request instruction triggered by the target object in the operation interface;
[0043] Based on the target function, in the correspondence between function and interface parameter information, the target interface parameter information corresponding to the target function is determined, where the interface parameter information includes the first sub-correspondence between function and interface parameter name;
[0044] The relevant information of the target interface request parameters is returned to the terminal device, so that the terminal device can display at least one interface parameter name corresponding to the target function in the operation interface based on the first sub-correspondence between the function and the interface parameter name contained in the relevant information of the target interface request parameters.
[0045] In one possible implementation, the target interface request parameter information also includes at least one of the following: a second sub-correspondence between interface parameter names and interface request parameters, and a linkage relationship between interface request parameters under different interface parameter names.
[0046] In one possible implementation, the device further includes a data processing unit, the linkage being determined by the data processing unit in the following manner:
[0047] Retrieve at least one historical API request data;
[0048] For at least one historical interface request data, determine the historical request URL and the corresponding historical interface request example in one historical interface request data, wherein the historical interface request example contains the interface parameter name and the interface request parameter corresponding to the interface parameter name;
[0049] Based on the determined historical request URLs and corresponding historical interface request examples, the linkage relationship is determined.
[0050] In one possible implementation, the data processing unit is specifically used for:
[0051] Based on each historical request URL and the corresponding historical interface request example, determine all historical interface request examples corresponding to the same historical request URL.
[0052] For the same historical request URL, based on the interface parameter name and corresponding interface request parameter contained in each historical interface request example in all historical interface request examples, determine the frequency of the same interface request parameter corresponding to the same interface parameter name. When the frequency meets the first frequency range, determine at least one other interface request parameter corresponding to the same interface request parameter. The other interface request parameter is in the same historical interface request example as the same interface request parameter and its frequency meets the second frequency range, which is less than the first frequency range.
[0053] The linkage relationship is determined based on at least one other interface request parameter corresponding to the same interface request parameter.
[0054] In one possible implementation, the data processing unit is also used for:
[0055] After obtaining at least one historical interface request data, before determining the historical request URL and corresponding historical interface request example in one of the historical interface request data for the at least one historical interface request data, at least one of the target data and request body format used to characterize the request result in one of the historical interface request data for the at least one historical interface request data.
[0056] Based on at least one of the target data and request body format, filter out the historical interface request data that was successfully requested from at least one historical interface request data.
[0057] In one possible implementation, after the data processing unit obtains at least one historical interface request data, it is also used for:
[0058] For at least one historical interface request data, perform the following operations respectively: based on the correspondence between each object information and its sensitivity level defined in the configuration file, and the encryption processing rules corresponding to the sensitivity level, encrypt the object information contained in the historical request example in a historical interface request data.
[0059] Fifthly, embodiments of this application provide an electronic device, which includes a memory and a processor, wherein: the memory is used to store a computer program; and the processor is used to execute the computer program to implement the interface request example generation method provided in embodiments of this application.
[0060] Sixthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the interface request example generation method provided in embodiments of this application.
[0061] In a seventh aspect, embodiments of this application provide a computer program product, including computer instructions that, when executed by a processor, implement the interface request example generation method provided in embodiments of this application.
[0062] The beneficial effects of this application are as follows:
[0063] This application provides a method, apparatus, electronic device, and storage medium for generating interface request examples. In this application, after responding to a function request triggered by a target object for a target function, it is determined that a corresponding target interface request example needs to be generated for the target function interface. At this time, at least one interface parameter name corresponding to the target function is displayed in the operation interface. After responding to the target object's display instruction for an interface parameter name, each candidate interface request parameter corresponding to that interface parameter name is displayed in the operation interface. This allows the target object to directly select interface request parameters from the displayed candidate interface request parameters, facilitating simple combination of interface request parameters without requiring the target object to write code. This lowers the threshold for debugging and developing target function interface requests and avoids errors during the coding process, improving accuracy. Furthermore, since each candidate interface request parameter corresponding to an interface parameter name is adapted to the target function interface, the combination of interface request parameters determined based on the selected target interface request parameters is necessarily valid. There is no need to repeatedly adjust the combined interface request parameters to adapt to the target function interface during the combination process. This simplifies operation and accurately generates interface request examples, improving the debugging success rate.
[0064] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 This is a schematic diagram illustrating an example of determining an interface request based on debugging tools in related technologies;
[0067] Figure 2 This is a schematic diagram illustrating another example of determining interface requests based on debugging tools in related technologies;
[0068] Figure 3 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0069] Figure 4 A flowchart illustrating a method for generating an interface request example, provided in an embodiment of this application;
[0070] Figure 5A schematic diagram of an operation interface for displaying at least one interface parameter name is provided in an embodiment of this application;
[0071] Figure 6 A flowchart of a method for determining each candidate interface request parameter corresponding to an interface parameter name is provided in an embodiment of this application;
[0072] Figure 7 This is a schematic diagram illustrating the first method of displaying candidate interface request parameters in an operation interface, as provided in an embodiment of this application.
[0073] Figure 8 A schematic diagram illustrating a second method for displaying candidate interface request parameters in an operation interface, as provided in this application embodiment;
[0074] Figure 9 A schematic diagram illustrating a third method for displaying candidate interface request parameters in an operation interface, as provided in this application embodiment;
[0075] Figure 10 This application provides another schematic diagram of an operation interface for displaying at least one interface parameter name;
[0076] Figure 11 A schematic diagram illustrating the selection of target interface request parameters provided in an embodiment of this application;
[0077] Figure 12 A schematic diagram illustrating an example of a target interface request provided in an embodiment of this application;
[0078] Figure 13 A schematic diagram illustrating another example of a target interface request provided for an embodiment of this application;
[0079] Figure 14 A flowchart illustrating a method for generating an interface request example, provided in an embodiment of this application;
[0080] Figure 15 A flowchart illustrating a method for processing historical interface request data, provided in this application embodiment;
[0081] Figure 16 A flowchart illustrating a method for determining a linkage relationship provided in an embodiment of this application;
[0082] Figure 17 A schematic diagram illustrating the determination of a linkage relationship provided in an embodiment of this application;
[0083] Figure 18 A flowchart illustrating the overall method for generating an interface request example provided in this application embodiment;
[0084] Figure 19 A schematic diagram of the architecture of an example of generating an interface request provided in an embodiment of this application;
[0085] Figure 20 A structural diagram of an interface request example generation device provided in an embodiment of this application;
[0086] Figure 21 A structural diagram of another interface request example generation device provided in this application embodiment;
[0087] Figure 22 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0088] To make the objectives, technical solutions, and beneficial effects of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0089] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in sequences other than those illustrated or described herein.
[0090] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0091] Interface documentation: Used in the project development process; during project development, tasks related to interfaces will be encountered. Interfaces are defined by development engineers, so interface documentation needs to be written to facilitate project development based on the interface documentation; the interface documentation includes the interface name, a description of the interface function, URL, request method, request parameters, etc.
[0092] For example, the request parameters in a certain API documentation are as follows:
[0093]
[0094] Complex interfaces: These are request messages sent from the client to the server using protocols such as HTTP, including HTTP request headers and parameters. In this invention, complex interfaces include, but are not limited to, checks on interdependent request parameters, mandatory parameters, parameter content limitations, and parameter type detection.
[0095] Historical API request data: This reflects the actual data of historical requests made by APIs after they were published, including whether the requests were successful or failed. It can actually reflect the complexity of API calls.
[0096] Target object: The object that triggers various operation instructions; in this embodiment of the application, it can be the developers during the project development process.
[0097] The design concept of the embodiments of this application will be briefly introduced below.
[0098] This application embodiment relates to a scenario of generating interface request examples. During application development, interface testing is required, and in the interface testing scenario, it is necessary to generate interface request examples.
[0099] In related technologies, common methods for generating interface request examples are to use fixed Curl request examples or to assemble interface request parameters using debugging tools such as Postman, and then generate interface request examples based on the interface request parameters.
[0100] The example of a simple Curl request demonstrates the interface request, but the target user cannot perceive the effect of different parameter combinations in complex interfaces. They need to read the interface documentation, combine request parameters according to their understanding, and only perceive the effect of parameter combinations during actual calls. This results in low overall efficiency, a high failure rate in debugging, and the Curl request examples provided in the interface documentation are often relatively fixed and general, without providing comprehensive combinations of interface request parameters. For complex interfaces, this does not intuitively demonstrate the request method, thus raising the barrier to entry for interface access.
[0101] The following is an example of a Curl request:
[0102] Curl'https: / / api.e.qq.com / v1.2 / campaigns / add? access_token=<ACCESS_TOKEN> ×tamp= <timestamp>&nonce= <nonce>'\
[0103] -d'account_id=<ACCOUNT_ID> '\
[0104] -d'campaign_name=May Day Mega Promotion Plan'\
[0105] -d'campaign_type=CAMPAIGN_TYPE_NORMAL'\
[0106] -d'promoted_object_type=PROMOTED_OBJECT_TYPE_APP_IOS'\
[0107] -d'promoted_object_type=PROMOTED_OBJECT_TYPE_APP_IOS'\
[0108] -d'promoted_object_type=PROMOTED_OBJECT_TYPE_APP_IOS'\
[0109] The example is demonstrated and debugged using tools such as Postman. The target object first modifies the default JSON string parameters of the interface, and then sends a request by clicking the execute button on the interface.
[0110] These debugging tools all use a visual interface and form-based methods to fill in API request parameters. For example... Figure 1 As shown, it is a schematic diagram of the test interface, which is mainly divided into two parts: one part is the request part, and the other part is the interface response result.
[0111] Regarding the request section, it mainly involves the selection of the HTTP request method, such as the POST request method (or the GET request method). After the user enters the request URL, request header, and request body, they click... Figure 1 The "Send" button allows you to send a request to the API service to test the API. The "Response" section primarily displays the results returned by the request.
[0112] Although the API request examples generated by debugging tools offer a more intuitive user interface compared to Curl request examples, allowing for more intuitive use of the request examples, such as... Figure 2 As shown. However, the interface request examples generated by the debugging tool still need to be used in conjunction with the interface documentation definition. The target object still needs to understand the interface documentation and combine the interface request parameters. Moreover, the combined interface request parameters are actively written by the target object. Errors can occur during the writing of interface request parameters, and the combined interface request parameters often lack timeliness. Ultimately, this reduces the accuracy of the interface request examples and increases the debugging failure rate.
[0113] In view of this, embodiments of this application provide a method, apparatus, electronic device, and storage medium for generating interface request examples. Historical objects continuously request the system daily, generating a large amount of real historical interface request data. Considering the timeliness of interface request parameters, in this embodiment, the backend server obtains the historical interface request data of the actual requests made by historical objects; and processes the historical interface request data through data cleaning, data classification, data encryption, and other operations to obtain the request function corresponding to the historical interface request data, the interface parameter name corresponding to the request function, and the interface request parameters corresponding to the interface parameter name, etc., and stores these correspondences in a database; so that the terminal device can display the interface request parameters through the operation interface, facilitating the target object to select the target interface request parameter from the interface request parameters displayed in the operation interface, and generate a target interface request example based on the target interface request parameter, and display the generated target interface request example in the operation interface, allowing the target object to directly observe and debug the target interface request example. The obtained target interface request examples are all historical interface request examples from which historical objects have successfully requested, so the success rate of requests based on target interface request examples is high, and the generated target interface request examples are more accurate. Furthermore, the interface operation makes selecting the interface request operation method simpler and more convenient, the overall integration process is easy, and a comprehensive understanding of complex interfaces can be quickly gained, greatly reducing the threshold for development and integration and improving integration efficiency.
[0114] In short, a database can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.
[0115] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or Extensible Markup Language (XML); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as Structured Query Language (SQL) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.
[0116] In one possible implementation, in response to a function request instruction triggered by the target object for the target function, at least one interface parameter name corresponding to the target function is displayed in the operation interface; for at least one interface parameter name, the following operations are performed respectively: in response to a display instruction for an interface parameter name, each candidate interface request parameter corresponding to the interface parameter name is displayed in the operation interface, and in response to an interface request parameter selection instruction, the target interface request parameter is selected from each candidate interface request parameter; based on the obtained target interface request parameters, a target interface request example is generated.
[0117] In this embodiment, after responding to a function request triggered by a target object for a target function, it is determined that a corresponding target interface request example needs to be generated for the target function interface corresponding to the target function. At this time, at least one interface parameter name corresponding to the target function is displayed in the operation interface. After responding to the target object's display instruction for an interface parameter name, each candidate interface request parameter corresponding to that interface parameter name is displayed in the operation interface. This allows the target object to directly select interface request parameters from the displayed candidate interface request parameters, facilitating simple combination of interface request parameters without requiring the target object to write code. This lowers the threshold for debugging and developing target function interface requests and avoids errors during the coding process, improving accuracy. At the same time, since the candidate interface request parameters corresponding to each interface parameter name are adapted to the target function interface, the combination of interface request parameters determined based on the selected target interface request parameters is necessarily legal. There is no need to repeatedly adjust the interface request parameters in the combination to adapt to the target function interface during the combination process. The operation is simple and generates accurate interface request examples, improving the debugging success rate.
[0118] After introducing the design concept of the embodiments of this application, the following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of this application can be applied. It should be noted that the application scenarios described below are only for illustrating the embodiments of this application and are not intended to limit the scope. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.
[0119] Please refer to Figure 3 , Figure 3 An example application scenario provided by an embodiment of this application is provided, which includes a terminal device 10 and a server 20;
[0120] Among them, terminal device 10 is a software and website that can open various types of API websites, such as an advertising API website. It should be noted that the terminal device can be a personal computer, mobile phone, tablet computer, laptop, e-book reader, in-vehicle terminal, or other computer device.
[0121] Server 20 is the server corresponding to the API official website. Server 20 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0122] In one possible implementation, the terminal device 10 and the server 20 can communicate via a communication network, which can be a wired network or a wireless network. Therefore, the terminal device 10 and the server 20 can be directly or indirectly connected via wired or wireless communication. For example, the terminal device 10 can also be indirectly connected to the server 20 via a wireless access point 12, or the terminal device 10 can be directly connected to the server 20 via the Internet; this application does not impose any limitations on this.
[0123] In one possible application scenario, to reduce communication latency, servers 20 can be deployed in various regions, or for load balancing, different servers 20 can serve the regions corresponding to each publisher's terminal device 10. Multiple servers 20 can also share data through blockchain, thus forming a data-sharing system comprised of multiple servers 20.
[0124] Since each server 20 in the data sharing system has a node identifier corresponding to that server 20, each server 20 in the data sharing system can store the node identifiers of other servers 20 in the data sharing system, so that the generated blocks can be broadcast to other servers 20 in the data sharing system according to the node identifiers of other servers 20.
[0125] Based on the above application scenarios, the video type recognition method provided by the exemplary embodiments of this application will be described below with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way.
[0126] Please refer to Figure 4 , Figure 4 An exemplary flowchart of an interface request example generation method according to an embodiment of this application is provided, which is applied to a terminal device and includes the following steps:
[0127] Step S400: Respond to the function request instruction triggered by the target object for the target function, and display at least one interface parameter name corresponding to the target function in the operation interface.
[0128] To achieve the target functionality, it is necessary to connect to the target functionality's Application Programming Interface (API). Therefore, it is necessary to generate a target interface request example that connects to the target functionality's API. The target interface request example contains at least one interface parameter name, as well as an interface request parameter corresponding to each interface parameter name.
[0129] In this embodiment of the application, the target object can trigger a function request instruction for the target function in the client or website webpage for opening the API official website installed on the terminal device, so as to jump to the operation interface for generating interface request examples; therefore, after the terminal device responds to the function request instruction triggered by the target object for the target function, it will display at least one interface parameter name corresponding to the target function in the operation interface.
[0130] Taking a certain advertising API website as an example, the interface of the advertising API website contains a function navigation bar, which contains multiple functions, such as creating advertising creatives, updating advertising creatives, deleting advertising creatives, retrieving advertising creatives, etc.
[0131] At this point, the target object can trigger function request instructions for each function displayed in the operation interface corresponding to the official website of the advertising API. For example, the target object triggers a function request instruction for creating an advertising creative.
[0132] Correspondingly, the terminal device responds to the function request instruction triggered by the target object for creating an advertising creative, and displays at least one interface parameter name corresponding to creating an advertising creative in the operation interface corresponding to the official website of the advertising API.
[0133] The interface parameter names corresponding to ad creation include, but are not limited to: ad placement set (site_set), creative format ID (adcreative_template_id), promotion target ID (promoted_object_type), landing page type (page_type), text link redirection type (link_page_type), and link name type (link_name_type); please refer to... Figure 5 , Figure 5 An exemplary embodiment of this application provides a schematic diagram of an operation interface displaying at least one interface parameter name.
[0134] In this embodiment of the application, after the terminal device responds to the function request instruction triggered for the target function, it sends the target function corresponding to the function request instruction to the backend server corresponding to the official website of the advertising API, so as to obtain at least one interface parameter name corresponding to the target function, and displays the obtained at least one interface parameter name in the operation interface.
[0135] Correspondingly, after receiving the target function, the backend server determines the target interface parameter information corresponding to the target function based on the correspondence between the function and the interface parameter information, and returns the determined target interface parameter information to the terminal device.
[0136] Among them, the target interface parameter information contains the first sub-correspondence between the target function and the interface parameter name. Therefore, the terminal device can obtain the interface parameter name corresponding to the target function based on the first sub-correspondence and display the interface parameter name in the operation interface.
[0137] In one possible implementation, after the terminal device responds to the function request instruction triggered for the target function, it determines the corresponding target request URL and sends the target request URL to the backend server corresponding to the official website of the advertising API to obtain at least one interface parameter name corresponding to the target request URL, and displays the obtained at least one interface parameter name in the operation interface.
[0138] Accordingly, after receiving the target request URL, the backend server determines the interface parameter name corresponding to the target request URL based on the third sub-correspondence between the request URL and the interface parameter name, and returns the determined interface parameter name to the terminal device so that the terminal device can display the received interface parameter name in the operation interface.
[0139] It should be noted that the correspondence between functions and target interface parameters and related information, the first sub-correspondence between target functions and interface parameter names, and the third sub-correspondence between request URLs and interface parameter names are obtained by the backend server based on historical interface request data. For details, please refer to the implementation content of the backend server side in the embodiments of this application.
[0140] Step S401: For at least one interface parameter name, perform the following operations respectively: In response to the display instruction for an interface parameter name, display each candidate interface request parameter corresponding to the interface parameter name in the operation interface, and in response to the interface request parameter selection instruction, select the target interface request parameter from each candidate interface request parameter.
[0141] from Figure 5 As can be seen, each interface parameter name displayed in the operation interface corresponds to an interface request parameter display control. When the target object clicks on the interface request parameter display control corresponding to an interface parameter name in the operation interface, the display instruction of the interface parameter name is triggered for that interface parameter name.
[0142] The terminal device responds to a display command for an interface parameter name and displays the request parameters of each candidate interface corresponding to the interface parameter name in the operation interface.
[0143] For example, in response to the target object's instruction to display the interface parameter name triggered by site_set, the operation interface will display the list of candidate interface request parameters corresponding to site_set.
[0144] In this embodiment of the application, after the terminal device responds to the display instruction for an interface parameter name, it determines whether there is a second sub-correspondence between the interface parameter name and the interface request parameter stored locally, and determines the method of obtaining the interface request parameter based on the determination result;
[0145] In one possible implementation, it is determined whether a second sub-correspondence between interface parameter names and interface request parameters is stored locally, that is, whether the target interface parameter information obtained based on the function request instruction contains a second sub-correspondence between interface parameter names and interface request parameters.
[0146] It should be noted that the second sub-correspondence between the interface parameter name and the interface request parameter is obtained by the backend server based on historical interface request data. For details, please refer to the implementation content of the backend server side in the embodiments of this application.
[0147] Scenario 1: The system stores a second sub-correspondence between interface parameter names and interface request parameters:
[0148] If it is determined that there is a second sub-correspondence between interface parameter names and interface request parameters, then based on the second sub-correspondence, determine all interface request parameters corresponding to an interface parameter name, and among all interface request parameters, determine each candidate interface request parameter corresponding to an interface parameter name, and display the determined candidate interface request parameters in the operation interface.
[0149] For example, in response to a display command triggered by the target object for site_set, after confirming that the interface request parameters corresponding to site_set are stored, the candidate interface request parameters corresponding to site_set are directly displayed in the operation interface.
[0150] Scenario 2: The system stores a second sub-correspondence between interface parameter names and interface request parameters:
[0151] If it is determined that there is no second sub-correspondence between interface parameter names and interface request parameters stored, the terminal device sends an interface parameter name to the backend server so that the backend server can determine all interface request parameters corresponding to an interface parameter name based on the second sub-correspondence between interface parameter names and interface request parameters and return them.
[0152] The terminal device receives all interface request parameters corresponding to an interface parameter name returned by the backend server, and determines each candidate interface request parameter corresponding to an interface parameter name from all the interface request parameters, and displays the determined candidate interface request parameters in the operation interface.
[0153] For example, when responding to a display command triggered by the target object for site_set, after determining that no interface request parameters corresponding to site_set are stored, site_set is sent to the backend server to receive all interface request parameters corresponding to site_set returned by the backend server. After receiving all interface request parameters corresponding to site_set, the candidate interface request parameters corresponding to site_set are displayed in the operation interface.
[0154] In this embodiment of the application, the candidate interface request parameters corresponding to an interface parameter name displayed in the operation interface are determined in the following way:
[0155] Please refer to Figure 6 , Figure 6 An exemplary flowchart of a method for determining candidate interface request parameters corresponding to interface parameter names is provided in this application, including the following steps:
[0156] Step S600: Respond to the display instruction triggered by the target object for an interface parameter name, and determine the interface parameter name.
[0157] Step S601: Determine whether there are selected interface request parameters for other interface parameter names besides one. If yes, proceed to step S602; otherwise, proceed to step S603.
[0158] Since this target function corresponds to multiple interface parameter names, and the interface request parameters corresponding to each interface parameter name often have a linkage relationship, for example, the selected interface request parameter corresponding to the interface parameter name site_set is site_set_kandian, and the candidate interface request parameters corresponding to the interface parameter name adcreative_template_id only include 711, 712, 713, and 714. That is to say, it can only be selected from 711, 712, 713, and 714. After the selected interface request parameters of adcreative_template_id are determined, the selected interface request parameters of adcreative_template_id will also affect the candidate interface request parameters of the interface parameter name promoted_object_type. It can be said that a change in one part affects the whole.
[0159] Therefore, it is necessary to determine whether there is a selected interface request parameter under at least one interface parameter name corresponding to the target function displayed in the operation interface.
[0160] Step S602: Based on the linkage relationship between the selected interface request parameters and the interface request parameters corresponding to an interface parameter name, filter the interface request parameters that have a linkage relationship with the selected interface request parameters from all the interface request parameters corresponding to an interface parameter name, and use the filtered interface request parameters as candidate interface request parameters.
[0161] For example, if the interface parameter name corresponding to the display command is `adcreative_template_id`, and the interface parameter name `site_set` corresponds to the selected interface request parameter `site_set_kandian`, then based on the linkage relationship between the selected interface request parameter corresponding to `site_set` and the interface request parameter corresponding to `adcreative_template_id`, among all the interface request parameters corresponding to `adcreative_template_id`, interface request parameters 711, 712, 713, and 714 that have a linkage relationship with the selected interface request parameter corresponding to `site_set` will be determined, and these selected interface request parameters will be displayed as candidate interface request parameters; please refer to [reference needed]. Figure 7 , Figure 7 An exemplary diagram is provided in this application embodiment illustrating the first method of displaying candidate interface request parameters in an operation interface.
[0162] In one possible implementation, when displaying the candidate interface request parameters corresponding to an interface request name, all interface request parameters corresponding to that interface request parameter name can also be displayed in the operation interface. In order to accurately determine the candidate interface request parameters, a mark is added to distinguish between the candidate interface and the request parameters and the non-selectable interface request parameters.
[0163] Therefore, when displaying the corresponding interface request parameters for an interface request name in the operation interface, the first type of interface request parameters carrying a candidate identifier and the second type of interface request parameters carrying a non-selectable identifier are displayed.
[0164] For example, graying out unselectable interface request parameters is an example; please refer to [reference needed]. Figure 8 , Figure 8 An exemplary diagram illustrating the second method of displaying candidate interface request parameters in an operation interface is provided in this application embodiment.
[0165] It should be noted that graying is only one possible way to distinguish between interfaces. In this embodiment, an "×" can be added to the request parameters of unselectable interfaces to indicate that the request parameter is not selectable; or an "*" can be added to the request parameters of candidate interfaces to indicate that the request parameter is a candidate interface request parameter, etc.
[0166] Furthermore, the linkage relationship is obtained by the backend server based on historical interface request data. For details, please refer to the implementation content of the backend server side in the embodiments of this application.
[0167] Step S603: Select all interface request parameters corresponding to an interface parameter name as candidate interface request parameters;
[0168] For example, if the interface parameter name corresponding to the display command is `adcreative_template_id`, and none of the interface parameter names displayed in the operation interface have selected interface request parameters, then all interface request parameters corresponding to `adcreative_template_id` will be used as candidate interface request parameters; please refer to... Figure 9 , Figure 9 An exemplary diagram illustrating a third method for displaying candidate interface request parameters in an operation interface is provided in this application embodiment.
[0169] In one possible implementation, if it is determined that a certain interface parameter name currently corresponds to a selected interface request parameter, and it is determined based on the linkage relationship that at least one interface parameter name does not have a candidate interface request parameter, an unselectable flag is added to the corresponding interface parameter name that does not have a candidate interface request parameter.
[0170] For example, if the interface parameter name "site_set" corresponds to a selected interface request parameter "site_set_kandian", but neither the interface parameter names "link_page_type" nor "link_name_type" have any candidate interface request parameters, then the interface parameter names "link_page_type" and "link_name_type" will be grayed out. Please refer to [reference needed]. Figure 10 , Figure 10 An exemplary diagram illustrating another display interface parameter name is provided in an embodiment of this application.
[0171] After displaying the various candidate interface request parameters corresponding to an interface parameter name in the operation interface, the target object can select any one of the candidate interface request parameters. When the target object clicks on one of the candidate interface request parameters, it is determined that the target object has triggered the interface request parameter selection instruction.
[0172] The terminal device responds to the interface request parameter selection instruction, selects the target interface request parameter clicked from the various candidate interface request parameters, and treats the clicked candidate interface request parameter as a target interface request parameter corresponding to an interface parameter name, or as a selected interface request parameter; and adds the target interface request parameter to an input box corresponding to an interface parameter name.
[0173] For example, the target object is Figure 7 Based on the displayed candidate API request parameters for `adcreative_template_id`, clicking on one of the candidate API request parameters will automatically add the number of clicked candidate API request requests to the `adcreative_template_id` input box; please refer to... Figure 11 , Figure 11 An exemplary diagram illustrating the selection of target interface request parameters is provided in an embodiment of this application.
[0174] Step S402: Generate an interface request example based on the obtained target interface request parameters.
[0175] In this embodiment of the application, after determining the request parameters of each target interface, the terminal device reports the determined request parameters of each target interface and the target request URL corresponding to the target function to the backend server.
[0176] In one possible implementation, the terminal device can use Ajax requests to send the request parameters and URLs of the target interfaces to the backend server.
[0177] Correspondingly, after receiving the target request URL and the request parameters of each target interface reported by the terminal device, the backend server filters out the historical request examples containing the request parameters of each target interface from all historical request examples corresponding to the target request URL, and returns the filtered historical request examples as target interface request examples to the terminal device.
[0178] In one possible implementation, after receiving the target request URL and target interface request parameters, the backend server filters different interface request parameters, matches the target interface request example that matches the request, and returns it to the terminal device.
[0179] It should be noted that the matching process is also based on historical request examples, and the matched interface request examples contain at least one basic interface request parameter. The number of target interface request examples can be determined based on the number of basic interface request parameters. For example, if there is a first type of target interface request example containing one basic interface request parameter and a second type of target interface request example containing two basic interface request parameters, then it is determined that two target interface request examples will be returned, that is, one target interface request example is selected from the first type of target interface request example and one target interface request example is selected from the second type of target interface request example.
[0180] The terminal device receives a sample target interface request returned by the backend server and displays the sample target interface request in the operation interface.
[0181] In one possible implementation, the terminal device may receive multiple target interface request examples returned by the backend server. After the terminal device receives the multiple target interface request examples returned by the backend server, it will display the multiple target interface request examples in pages, and the object information displayed in the target interface request examples is encrypted by the backend server.
[0182] Please refer to Figure 12 , Figure 12 This application provides an exemplary schematic diagram illustrating a target interface request example from an embodiment of the present application; from Figure 12 As can be seen, the interface displaying the target interface request example includes a pagination control. The target user can click the pagination control to browse other target interface request examples returned by the backend server; please refer to... Figure 13 , Figure 13 The present application provides an exemplary schematic diagram illustrating another example of a target interface request in its embodiments. Figure 13 Example of a target API request for browsing other pages for the target object.
[0183] It should be noted that when displaying the target interface request example, the terminal device is not limited to its own display interface. It can also display the target interface request example as a Curl request example, and it can also be adapted to all HTTP request tools.
[0184] In this embodiment, the target object can select and combine interface request parameters in the operation interface, which is simple and convenient, reducing the debugging and development threshold of interface requests. Moreover, the interface request parameters displayed in the operation interface are all determined based on historical request parameters. Therefore, the interface request parameters displayed in the operation interface are real and safe, that is, they are adapted to the functional interface. Thus, the combined interface request parameter combination is legal. There is no need to repeatedly adjust the interface request parameters in the interface request parameter combination to adapt to the requirements of the functional interface. This facilitates intuitive development and debugging of interface functions and ensures the timeliness and success rate of the generated interface request examples.
[0185] Please refer to Figure 14 , Figure 14 An exemplary flowchart of an interface request example generation method is provided in this application embodiment, applied to a backend server, including the following steps:
[0186] Step S1400: Receive the request parameters for each target interface sent by the terminal device;
[0187] Each target interface request parameter is selected from the candidate interface request parameters corresponding to the corresponding interface request parameter name based on the interface request parameter selection instruction.
[0188] For specific selection methods, please refer to the implementation methods on the terminal device side, which will not be elaborated here.
[0189] In one possible implementation, the backend server may receive the target request URL sent by the terminal device, while also receiving the various target interface request parameters sent by the terminal device. The target request URL is determined by the terminal device when the target object triggers a function request instruction for the target function.
[0190] In this embodiment, before receiving the target interface request parameters sent by the terminal device, the terminal device also receives the target function sent by the terminal device. The target function is determined based on the function request instruction triggered by the target object in the operation interface. For details, please refer to the implementation method on the terminal device side, which will not be repeated here.
[0191] After receiving the target function sent by the terminal device, the backend server determines the target interface parameter information corresponding to the target function based on the correspondence between the function and the interface parameter information. The interface parameter information includes the first sub-correspondence between the function and the interface parameter name.
[0192] The backend server returns the target interface request parameter information to the terminal device, so that the terminal device can display at least one interface parameter name corresponding to the target function in the operation interface based on the first sub-correspondence between the function and the interface parameter name contained in the target interface request parameter information.
[0193] In this embodiment of the application, before receiving the various target interface request parameters sent by the terminal device, the terminal device may also receive the target request URL sent by the terminal device.
[0194] After receiving the target request URL sent by the terminal device, the backend server determines the interface parameter name corresponding to the target request URL based on the target request URL and the third sub-correspondence between the target request URL and the interface parameter name.
[0195] The backend server returns the interface parameter name to the terminal device so that the terminal device can display at least one interface parameter name corresponding to the target function in the operation interface.
[0196] In one possible implementation, the target interface request parameter information also includes at least one of the following: a second sub-correspondence between interface parameter names and interface request parameters, and a linkage relationship between interface request parameters under different interface parameter names.
[0197] In this embodiment, the first sub-correspondence between function and interface parameter name, the second sub-correspondence between interface parameter name and interface request parameter, and the linkage relationship between interface request parameters under different interface parameter names are all obtained by the backend server based on historical interface request data, and the obtained relationships are stored in the storage database; at the same time, the backend server also stores the correspondence between historical request URLs, historical request parameters, historical request examples, etc.
[0198] In this embodiment, the various stored correspondences are determined by the backend server based on the actual historical interface request data of the historical objects; please refer to... Figure 15 , Figure 15 An exemplary flowchart of a method for processing historical interface request data is provided in this application embodiment, including the following steps:
[0199] Step S1500: Obtain at least one historical interface request data;
[0200] In this embodiment, the backend server stores the historical interface request data of the historical object in a log file; or in a big data retrieval, analysis, and storage engine, such as ElasticSearch; or in a storage system such as DB or ES.
[0201] It should be noted that the historical interface request data is not limited to log files, storage engines, storage systems, etc. As long as it is a real API call, this application embodiment can be adapted, and all external API interfaces need to be covered when obtaining historical interface data.
[0202] In this embodiment of the application, when the backend server obtains historical interface request data, it determines the strategy for obtaining historical interface request data according to the storage method of historical interface request data, and obtains historical interface request data based on the determined strategy.
[0203] For example, if Elasticsearch is present in the historical API request data, the example code can be used to retrieve the data from Elasticsearch:
[0204]
[0205] The historical interface request data includes, but is not limited to: the historical request URL of the historical object, historical request examples, the return example of the current request, and whether it was successful.
[0206] In one possible implementation, in order to ensure the accuracy of the determined correspondence, further ensure the accuracy of the generated target interface request example, and improve the success rate of the target interface request example calling the interface, after obtaining at least one historical interface request data, the obtained historical interface request data will be cleaned to filter out the historical interface request data used to represent the success of the request.
[0207] Generally speaking, the historical interface request data obtained contains many distracting elements, and data cleaning is the first step in processing historical interface request data.
[0208] The purpose of data cleaning is to remove noisy historical interface request data, such as historical interface request data with return codes of 40X, 50X, etc., and leave only valid historical interface request data, so as to reduce the amount of data that needs to be monitored and improve efficiency.
[0209] In other words, the output of data cleaning is historical API request data that was successfully requested, such as historical API request data with a return code of 200 or an error_code of 0; and historical API request data whose request body format strictly conforms to the API specification, such as historical API request data that meets the API specification Content-Type: application / json.
[0210] It should be noted that the definition of successful historical interface request data needs to be customized by each system.
[0211] Step S1501: For at least one historical interface request data, determine the historical request URL and the corresponding historical interface request example in one historical interface request data respectively;
[0212] The historical interface request examples include the interface parameter names and the corresponding interface request parameters.
[0213] Therefore, based on the interface parameter names contained in the historical interface request examples, and the corresponding interface request parameters, the second sub-correspondence between the interface parameter names and the interface request parameters can be directly determined.
[0214] It should be noted that the historical request URLs correspond to the functions. Since the historical interface request examples contain interface parameter names, the third sub-correspondence between the request URL and the interface parameter name, as well as the first sub-correspondence between the function and the interface parameter name, can be directly determined.
[0215] Step S1502: Based on the determined historical request URLs and corresponding historical interface request examples, determine the linkage relationship.
[0216] In this embodiment, the backend server categorizes historical interface request examples based on the historical request URLs and corresponding historical interface request examples of each historical interface request data. Historical interface request examples corresponding to the same historical request URL are grouped into one category, and all historical interface request examples corresponding to the same historical interface request example are analyzed to determine the linkage relationship.
[0217] Please refer to Figure 16 , Figure 16 A flowchart of a method for determining a linkage relationship is provided in an embodiment of this application. The method includes:
[0218] Step S1600: Based on each historical request URL and the corresponding historical interface request example, determine the same historical request URL and all corresponding historical interface request examples.
[0219] Since one functional interface corresponds to one request URL, in this embodiment of the application, the request URL can be used to construct interface buckets, and one interface bucket corresponds to all historical interface request examples of the corresponding interface.
[0220] In one possible implementation, interface buckets can be constructed based on the request PATH, and for each bucket, the linkage relationships can be determined based on historical interface request examples. These linkage relationships consist of primary dependent interface request parameters corresponding to multiple secondary dependent interface request parameters. Please refer to [reference needed]. Figure 17 , Figure 17 An exemplary schematic diagram of determining a linkage relationship is provided in an embodiment of this application.
[0221] Step S1601: For each historical interface request example corresponding to the same historical request URL, determine the interface parameter name and the corresponding interface request parameter contained in the historical interface request example, and count the frequency of the same interface parameter name corresponding to the same interface request parameter.
[0222] Step S1602: When the frequency of the same interface request parameter corresponding to the same interface parameter name meets the first frequency range, determine at least one other interface request parameter corresponding to the same interface request parameter.
[0223] Among them, other interface request parameters are those that appear in the same historical interface request example as the same interface request parameter, and whose frequency in all historical interface request examples meets the second frequency range, which is less than the first frequency range.
[0224] In one possible implementation, interface request parameters that satisfy the first frequency range are defined as primary dependent interface request parameters, and interface request parameters that satisfy the second frequency range are defined as secondary dependent interface request parameters.
[0225] It should be noted that this application embodiment also provides a basic interface request parameter. The basic interface request parameter has no range limitation. Therefore, the interface request parameter with a frequency of occurrence in the range of [custom basic parameter lower limit frequency, ∞] is used as the basic interface request parameter.
[0226] Step S1603: Determine the linkage relationship based on at least one other interface request parameter corresponding to the same interface request parameter.
[0227] In one possible implementation, after obtaining at least one historical interface request data, the following operations are performed on each of the at least one historical interface request data: based on the correspondence between each object information and the sensitivity level defined in the configuration file, and the encryption processing rules corresponding to the sensitivity level, the object information contained in the historical request example in a historical interface request data is encrypted.
[0228] In this embodiment of the application, since all the historical interface request examples contained in the historical interface request data are from real historical objects, and each historical interface request example contains object information of different objects, the object information is sensitive and private information for the corresponding objects, so it is necessary to encrypt it when displaying it to the outside world.
[0229] In this embodiment of the application, when encrypting object information: the sensitivity of each object information contained in the historical interface request example is determined by the defined configuration file, and the object information is encrypted based on the sensitivity.
[0230] For example, in this application embodiment, the sensitivity is divided into 3 categories:
[0231] High sensitivity: Contains object-specific information, such as passwords, tokens, signatures, etc. Therefore, highly sensitive object information needs to be completely desensitized and replaced with asterisks (*).
[0232] Medium sensitivity: Although it is object information, it has little impact on the object, such as the time period of the advertisement and the concept description. Therefore, object information with medium sensitivity can be replaced with a uniform default value or displayed directly.
[0233] Low sensitivity: Object information with low sensitivity does not need to be encrypted at all and can be directly displayed in historical interface request examples;
[0234] The encrypted output represents a real historical request example of a historical object, but the specific interface request parameters have been encrypted. The following diagram shows a sample data structure:
[0235]
[0236] Step S1401: Based on the request parameters of each target interface, filter the historical request examples that contain the request parameters of each target interface from the historical request examples, and use the filtered historical request examples as target interface request examples.
[0237] Step S1402: Return the target interface request example to the terminal device so that the terminal device can display the target interface request example in the operation interface.
[0238] In this embodiment, the backend server processes the historical interface request data of historical objects. After system data request and data classification, it displays real and secure interface request parameters, so that the target object can efficiently obtain the calling method of the complex interface by matching different interface request parameters on the terminal device. Since it is a historical object calling scenario, it is very referential and can be directly used by the target object in its own interface scenario, greatly shortening the interface access time.
[0239] Please refer to Figure 18 , Figure 18 An exemplary overall schematic diagram of an example of generating an interface request is provided in this application embodiment.
[0240] Step S1800: The backend server obtains at least one historical interface request data.
[0241] Step S1801: The backend server filters out the historical interface request data that was successfully requested from at least one historical interface request data, based on at least one of the target data and request body format used to characterize the request result in at least one historical interface request data.
[0242] Step S1802: For each historical interface request data that was successfully requested, the backend server determines the historical request URL and the corresponding historical interface request example in the historical interface request data.
[0243] Step S1803: The backend server determines the same historical request URL and all corresponding historical interface request examples based on each historical request URL and the corresponding historical interface request examples.
[0244] Step S1804: For each historical interface request example corresponding to the same historical request URL, the backend server determines the interface parameter name and the corresponding interface request parameter contained in the historical interface request example, determines the first sub-correspondence between the function corresponding to the historical request URL and the interface request parameter name, and the second sub-correspondence between the interface parameter name and the interface request parameter, and counts the frequency of the same interface request parameter corresponding to the same interface parameter name.
[0245] Step S1805: When the backend server determines that the frequency of the same interface request parameter corresponding to the same interface parameter name meets the first frequency range, it determines at least one other interface request parameter corresponding to the same interface request parameter.
[0246] Step S1806: The backend server determines the linkage relationship based on at least one other interface request parameter corresponding to the same interface request parameter.
[0247] In step S1807, the backend server stores the linkage relationship, the first sub-correspondence relationship, and the second sub-correspondence relationship in the database;
[0248] Step S1808: The terminal device responds to the function request instruction triggered by the target object for the target function;
[0249] Step S1809: The terminal device sends the target function corresponding to the function request instruction to the backend server;
[0250] Step S1810: The backend server determines the interface parameter name corresponding to the target function based on the first sub-correspondence between the function and the interface parameter name.
[0251] Step S1811: The backend server returns the determined interface parameter name to the terminal device;
[0252] Step S1812: Based on the received interface parameter name, the terminal device displays at least one interface parameter name corresponding to the target function in the operation interface.
[0253] Step S1813: The terminal device responds to the display instruction for an interface parameter name and displays the request parameters of each candidate interface corresponding to the interface parameter name in the operation interface.
[0254] Step S1814: The terminal device responds to the interface request parameter selection instruction and selects the target interface request parameter from the various candidate interface request parameters;
[0255] In step S1815, the terminal device reports the request parameters of each target interface and the target request URL corresponding to the target function to the backend server.
[0256] Step S1816: The backend server filters out historical request examples containing the request parameters of each target interface from all historical request examples corresponding to the target request URL, and uses the filtered historical request examples as target interface request examples.
[0257] In step S1817, the backend server returns the determined target interface request example to the terminal device.
[0258] In step S1818, the terminal device receives the target interface request example returned by the backend server and displays the target interface request example in the operation interface.
[0259] It should be noted that Figure 18 This is just one possible implementation method in the embodiments of this application. Since there are many possible implementation methods, they will not be listed one by one here.
[0260] Please refer to Figure 19 , Figure 19 This application provides an exemplary architectural diagram illustrating an example of generating an interface request in its embodiments. Figure 18 Corresponding to the overall method flowchart, the specific process begins with collecting historical interface request data. Then, the historical interface request data is processed through data cleaning, data classification, and data encryption. Finally, the processed data is stored. When an instruction from the target object is received, the corresponding information is retrieved from the stored data and returned, enabling the target object to perform corresponding operations based on the information displayed in the operation interface.
[0261] This application provides a method, apparatus, electronic device, and storage medium for generating interface request examples. In this application, the backend server determines various correspondences when generating interface request examples based on the actual historical interface request data of historical objects. The candidate interface request parameters corresponding to each interface parameter name are adapted to the target function interface. Bypassing the limitation of complex interfaces requiring detailed documentation, this approach presents interface request parameters directly to the target user. Upon receiving a request from the target user for a specific interface parameter name, the interface displays various candidate interface request parameters corresponding to that parameter name. This allows the target user to directly select parameters from the displayed options, facilitating simple and convenient parameter combinations without requiring them to write code. This lowers the barrier to entry for debugging and developing target functionality interfaces, avoids errors during code development, and improves accuracy. Furthermore, since each candidate parameter name is adapted to the target functionality interface, the resulting combination of interface request parameters is guaranteed to be valid. There's no need to repeatedly adjust parameters during parameter combinations, resulting in simple and accurate generation of interface request examples, increasing debugging success rates, significantly improving the target user's understanding of complex interface parameter limitations, and greatly lowering the barrier to entry for users.
[0262] The embodiments of this application greatly help improve the efficiency of complex interface access. Taking the creation of advertising creatives on the official website of the advertising API as an example, the embodiments of this application significantly reduce the number of consultation work orders for complex interfaces, from more than 10 per day to about 0-1 per day, and reduce the number of errors in complex interface calls on the existing network by 9%.
[0263] Based on the same inventive concept, embodiments of this application provide an interface request example generation apparatus 2000, please refer to... Figure 20 , Figure 20 An interface request example generation apparatus 2000 is provided as an example in an embodiment of this application. The apparatus includes:
[0264] Display unit 2001 is used to respond to the function request instruction triggered by the target object for the target function, and to display at least one interface parameter name corresponding to the target function in the operation interface;
[0265] The response unit 2002 is configured to perform the following operations for at least one interface parameter name: respond to a display instruction for an interface parameter name, display each candidate interface request parameter corresponding to the interface parameter name in the operation interface, and respond to an interface request parameter selection instruction to select the target interface request parameter from each candidate interface request parameter.
[0266] The generation unit 2003 is used to generate target interface request examples based on the obtained target interface request parameters.
[0267] In one possible implementation, the display unit 2001 is specifically used for:
[0268] In response to a function request instruction, the system sends the target function corresponding to the function request instruction to the backend server. This enables the backend server to determine and return the target interface parameter information corresponding to the target function based on the correspondence between the function and the interface parameter information. The correspondence is obtained by the backend server based on historical interface request data.
[0269] Based on the first sub-correspondence between the target function and the interface parameter name contained in the received target interface parameter information, at least one interface parameter name corresponding to the target function is displayed in the operation interface.
[0270] In one possible implementation, the corresponding unit 2002 is specifically used for:
[0271] If the target interface parameter information contains a second sub-correspondence between interface parameter name and interface request parameter, then based on the second sub-correspondence, the various candidate interface request parameters corresponding to an interface parameter name will be displayed in the operation interface.
[0272] If the target interface parameter information does not include interface request parameters, an interface parameter name is sent to the backend server to show the backend server's second-order correspondence between the interface parameter name and the interface request parameters, and the corresponding candidate interface request parameters are returned by the interface parameter name.
[0273] In one possible implementation, the corresponding unit 2002 determines the various candidate interface request parameters corresponding to an interface parameter name in the following manner:
[0274] If it is determined that there are currently selected interface request parameters corresponding to other interface parameter names besides one interface parameter name, then based on the linkage relationship between the selected interface request parameters and the interface request parameters corresponding to one interface parameter name, among all the interface request parameters corresponding to one interface parameter name, the interface request parameters that have a linkage relationship with the selected interface request parameters are filtered out, and the filtered interface request parameters are used as candidate interface request parameters. The linkage relationship is obtained based on historical interface request data.
[0275] If it is determined that there is no currently selected interface request parameter corresponding to any interface parameter name other than one interface parameter name, then all interface request parameters corresponding to one interface parameter name will be used as candidate interface request parameters.
[0276] In one possible implementation, the corresponding unit 2002 is specifically used for:
[0277] The interface displays the first type of interface request parameters carrying a candidate identifier and the second type of interface request parameters carrying a non-selectable identifier.
[0278] In one possible implementation, the generating unit 2003 is specifically used for:
[0279] The request parameters of each target interface and the target request Uniform Resource Locator URL corresponding to the target function are reported to the backend server so that the backend server can filter the historical request examples containing the request parameters of each target interface from all historical request examples corresponding to the target request URL, and use the filtered historical request examples as the target interface request examples.
[0280] Receive the target interface request example returned by the backend server and display the target interface request example in the operation interface.
[0281] In one possible implementation, the generating unit 2003 is further configured to:
[0282] If multiple target interface request examples are received, they will be displayed in pages.
[0283] The object information in the target interface request example is encrypted.
[0284] Based on the same inventive concept, this application provides an interface request example generation device 2100, please refer to... Figure 21 , Figure 21 An interface request example generation apparatus 2100 is provided as an example in this application embodiment. The apparatus includes:
[0285] The receiving unit 2101 is used to receive various target interface request parameters sent by the terminal device, wherein each target interface request parameter is selected from various candidate interface request parameters corresponding to the corresponding interface request parameter name based on the interface request parameter selection instruction.
[0286] The filtering unit 2102 is used to filter historical request examples containing the request parameters of each target interface based on the request parameters of each target interface, and use the filtered historical request examples as target interface request examples.
[0287] The return unit 2103 is used to return the target interface request example to the terminal device so that the terminal device can display the target interface request example in the operation interface.
[0288] In one possible implementation, before receiving the various target interface request parameters sent by the terminal device, the receiving unit 2101 is further configured to:
[0289] The target function is received from the terminal device, where the target function is determined based on the function request instruction triggered by the target object in the operation interface;
[0290] Based on the target function, in the correspondence between function and interface parameter information, the target interface parameter information corresponding to the target function is determined, where the interface parameter information includes the first sub-correspondence between function and interface parameter name;
[0291] The relevant information of the target interface request parameters is returned to the terminal device, so that the terminal device can display at least one interface parameter name corresponding to the target function in the operation interface based on the first sub-correspondence between the function and the interface parameter name contained in the relevant information of the target interface request parameters.
[0292] In one possible implementation, the target interface request parameter information also includes at least one of the following: a second sub-correspondence between interface parameter names and interface request parameters, and a linkage relationship between interface request parameters under different interface parameter names.
[0293] In one possible implementation, the device further includes a data processing unit 2104, the linkage being determined by the data processing unit 2104 in the following manner:
[0294] Retrieve at least one historical API request data;
[0295] For at least one historical interface request data, determine the historical request URL and the corresponding historical interface request example in one historical interface request data, wherein the historical interface request example contains the interface parameter name and the interface request parameter corresponding to the interface parameter name;
[0296] Based on the determined historical request URLs and corresponding historical interface request examples, the linkage relationship is determined.
[0297] In one possible implementation, the data processing unit 2104 is specifically used for:
[0298] Based on each historical request URL and the corresponding historical interface request example, determine all historical interface request examples corresponding to the same historical request URL.
[0299] For the same historical request URL, based on the interface parameter name and corresponding interface request parameter contained in each historical interface request example in all historical interface request examples, determine the frequency of the same interface request parameter corresponding to the same interface parameter name. When the frequency meets the first frequency range, determine at least one other interface request parameter corresponding to the same interface request parameter. The other interface request parameter is in the same historical interface request example as the same interface request parameter and its frequency meets the second frequency range, which is less than the first frequency range.
[0300] The linkage relationship is determined based on at least one other interface request parameter corresponding to the same interface request parameter.
[0301] In one possible implementation, the data processing unit 2104 is further configured to:
[0302] After obtaining at least one historical interface request data, before determining the historical request URL and corresponding historical interface request example in one of the historical interface request data for the at least one historical interface request data, at least one of the target data and request body format used to characterize the request result in one of the historical interface request data for the at least one historical interface request data.
[0303] Based on at least one of the target data and request body format, filter out the historical interface request data that was successfully requested from at least one historical interface request data.
[0304] In one possible implementation, after the data processing unit 2104 obtains at least one historical interface request data, it is further used for:
[0305] For at least one historical interface request data, perform the following operations respectively: based on the correspondence between each object information and its sensitivity level defined in the configuration file, and the encryption processing rules corresponding to the sensitivity level, encrypt the object information contained in the historical request example in a historical interface request data.
[0306] For ease of description, the above sub-models are divided into units (or modules) according to their functions and described separately. Of course, in implementing this application, the functions of each unit (or module) can be implemented in one or more software or hardware components.
[0307] After introducing the interface request example generation method and apparatus of the exemplary embodiments of this application, the electronic device of another exemplary embodiment of this application will be introduced next.
[0308] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented as: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."
[0309] In one possible implementation, the electronic device provided in this application embodiment may include at least a processor and a memory. The memory stores program code that, when executed by the processor, causes the processor to perform each step of the interface request example generation method of various exemplary embodiments in this application.
[0310] The following reference Figure 22 To describe an electronic device 2200 according to this embodiment of the present application. For example... Figure 22 The electronic device 2200 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0311] like Figure 22 As shown, the electronic device 2200 may include, but is not limited to: at least each of the processors 2201 and at least each of the memories 2202, and a bus 2203 connecting different system sub-models (including memories 2202 and processors 2201).
[0312] Bus 2203 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or local bus using any of the multiple bus structures.
[0313] The memory 2202 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 22021 and / or cache memory 22022, and may further include read-only memory (ROM) 22023.
[0314] The memory 2202 may also include a program / utility 22025 having a set (at least each) of program modules 22024, such program modules 22024 including but not limited to: an operating system, each or more application programs, other program modules, and program data, and each or some combination of these examples may include an implementation of a network environment.
[0315] Electronic device 2200 can also communicate with each or more external devices 2204 (e.g., keyboard, pointing device, etc.), and with each or more devices that enable a user to interact with electronic device 2200, and / or with any device that enables electronic device 2200 to communicate with each or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (V / O) interface 2205. Furthermore, electronic device 2200 can also communicate with each or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 2206. Figure 22 As shown, network adapter 2206 communicates with other modules for electronic device 2200 via bus 2203. It should be understood that, although... Figure 22 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 2200, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAVD systems, tape drives, and data backup storage systems.
[0316] In some possible implementations, various aspects of the interface request example generation method provided in this application can also be implemented as a program product, which includes program code that, when the program product is run on an electronic device, causes the electronic device to perform the steps in the interface request example generation method according to various exemplary embodiments of this application described above.
[0317] The program product may employ any combination of one or more readable media. A readable media may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0318] The program product generated by the interface request example of the implementation of this application can be a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a computing device.
[0319] A readable signal medium may include a data signal propagated in baseband or as a carrier-submodel, carrying readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.
[0320] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0321] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as "C" or similar programming languages.
[0322] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to the embodiments of this application, the feature vectors and functions of the two or more units described above can be embodied in each unit. Conversely, the feature vectors and functions of each unit described above can be further divided and embodied by multiple units.
[0323] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into a single step, and / or each step may be broken down into multiple steps.
[0324] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.< / nonce> < / timestamp>
Claims
1. An interface request example generation method characterized by, The method comprises: presenting an application programming interface (API) website interface, the API website interface comprising a function navigation bar, the function navigation bar comprising a plurality of functions; in response to a function request instruction triggered by a target object for a target function in the function navigation bar, displaying at least one interface parameter name corresponding to the target function in an operation interface, wherein the at least one interface parameter name is obtained by a background server based on historical interface request data; for the at least one interface parameter name, the following operations are respectively performed: in response to a display instruction for an interface parameter name, displaying each candidate interface request parameter corresponding to the interface parameter name in the operation interface, and in response to an interface request parameter selection instruction, selecting a target interface request parameter from the each candidate interface request parameter; based on the obtained each target interface request parameter, generating a target interface request example, wherein the target interface request example is used to interface the target function API; wherein the each candidate interface request parameter corresponding to the interface parameter name is determined in the following manner: if it is determined that other interface parameter names except the interface parameter name currently correspond to selected interface request parameters, based on a linkage relationship between the selected interface request parameters and the interface request parameters corresponding to the interface parameter name, filtering the interface request parameters having the linkage relationship with the selected interface request parameters from all the interface request parameters corresponding to the interface parameter name, and taking the filtered interface request parameters as the candidate interface request parameters, wherein the linkage relationship is obtained based on historical interface request data; if it is determined that other interface parameter names except the interface parameter name currently do not correspond to selected interface request parameters, taking all the interface request parameters corresponding to the interface parameter name as the candidate interface request parameters.
2. The method of claim 1, wherein, The response to the function request instruction triggered by the target object for the target function, displaying at least one interface parameter name corresponding to the target function in the operation interface, comprises: in response to the function request instruction, sending the target function corresponding to the function request instruction to a background server, so that the background server determines target interface parameter related information corresponding to the target function based on a corresponding relationship between functions and interface parameters and returns, wherein the corresponding relationship is obtained by the background server based on historical interface request data; based on a first sub-corresponding relationship between the target function and the interface parameter name included in the received target interface parameter related information, displaying at least one interface parameter name corresponding to the target function in the operation interface.
3. The method of claim 2, wherein, The response to the display instruction for an interface parameter name, displaying each candidate interface request parameter corresponding to the interface parameter name in the operation interface, comprises: if the target interface parameter related information contains a second sub-correspondence relationship between an interface parameter name and an interface request parameter, the operation interface displays each candidate interface request parameter corresponding to the interface parameter name based on the second sub-correspondence relationship; if the target interface parameter related information does not contain an interface request parameter, the operation interface sends the interface parameter name to the background server to display each candidate interface request parameter corresponding to the interface parameter name returned by the background server based on a second sub-correspondence relationship between an interface parameter name and an interface request parameter.
4. The method according to any one of claims 1 to 3, characterized in that The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays a first type of interface request parameter carrying a candidate identifier and a second type of interface request parameter carrying a non-selectable identifier.
5. The method of claim 1, wherein, The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including:
6. The method of claim 1, wherein, The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including:
7. An interface request example generation method characterized by, The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding to the interface parameter name, including: The operation interface displays each candidate interface request parameter corresponding receive each target interface request parameter sent by the terminal device, wherein each target interface request parameter is selected from each candidate interface request parameter corresponding to a corresponding interface parameter name based on an interface request parameter selection instruction; the interface parameter name is obtained by the terminal device from a background server and is obtained by the background server based on historical interface request data; the interface the corresponding interface parameter name corresponding to each candidate interface request parameter is determined by the terminal device in the following manner: if it is determined that other interface parameter names except the interface parameter name currently correspond to selected interface request parameters, based on the linkage relationship between the selected interface request parameters and the interface request parameters corresponding to the interface parameter name, in all interface request parameters corresponding to the interface parameter name, the interface request parameters having a linkage relationship with the selected interface request parameters are screened out, and the screened interface request parameters are taken as the candidate interface request parameters, wherein the linkage relationship is obtained based on historical interface request data; if it is determined that other interface parameter names except the interface parameter name currently do not correspond to selected interface request parameters, all interface request parameters corresponding to the interface parameter name are taken as the candidate interface request parameters; based on the each target interface request parameter, in the historical request example, the historical request example containing the each target interface request parameter is screened out, and the screened historical request example is taken as a target interface request example; return the target interface request example to the terminal device, so that the terminal device displays the target interface request example in an operation interface; wherein the target interface request example is used to interface the API of the target function.
8. The method of claim 7, wherein, After receiving the target function sent by the terminal device, before receiving each target interface request parameter sent by the terminal device, it further includes: based on the target function, in the corresponding relationship between function and interface parameter information, determine the target interface parameter information corresponding to the target function, wherein the interface parameter information includes the first sub-corresponding relationship between function and interface parameter name; return the target interface request parameter information to the terminal device, so that the terminal device displays at least one interface parameter name corresponding to the target function in an operation interface based on the first sub-corresponding relationship between function and interface parameter name contained in the target interface request parameter information.
9. The method of claim 8, wherein, The target interface request parameter information further includes at least one of the second sub-corresponding relationship between the interface parameter name and the interface request parameter, and the linkage relationship between the interface request parameters under different interface parameter names.
10. The method of claim 9, wherein, The linkage relationship is determined in the following manner: obtain at least one historical interface request data; for the at least one historical interface request data, respectively determine the historical request URL and the corresponding historical interface request example in one historical interface request data, wherein the historical interface request example contains the interface parameter name and the interface request parameter corresponding to the interface parameter name; Determine the linkage relationship based on the determined respective historical request URLs and corresponding historical interface request examples.
11. The method of claim 10, wherein, The determining of the linkage relationship based on the determined respective historical request URLs and corresponding historical interface request examples comprises: Determine all historical interface request examples corresponding to a same historical request URL based on the respective historical request URLs and corresponding historical interface request examples; For the same historical request URL, determine a same interface parameter name corresponding same interface request parameter based on an interface parameter name contained in each of the historical interface request examples in the all historical interface request examples and corresponding interface request parameters, and determine at least one other interface request parameter corresponding to the same interface request parameter when a frequency of the same interface request parameter satisfies a first frequency range, wherein the other interface request parameter is in a same historical interface request example as the same interface request parameter and has a frequency satisfying a second frequency range, and the second frequency range is smaller than the first frequency range; Determine the linkage relationship based on the at least one other interface request parameter corresponding to the same interface request parameter.
12. The method of claim 10, wherein, After the at least one historical interface request data is obtained, the method further comprises, for the at least one historical interface request data, respectively determining at least one of a target data used for representing a request result and a request body format in a historical interface request data. After the at least one historical interface request data is obtained, the method further comprises, for the at least one historical interface request data, respectively determining at least one of a target data used for representing a request result and a request body format in a historical interface request data. After the at least one historical interface request data is obtained, the method further comprises, for the at least one historical interface request data, respectively determining at least one of a target data used for representing a request result and a request body format in a historical interface request data.
13. The method of claim 10, wherein, After the at least one historical interface request data is obtained, the method further comprises, for the at least one historical interface request data, respectively determining at least one of a target data used for representing a request result and a request body format in a historical interface request data. The apparatus comprises:
14. An interface request example generation apparatus characterized by comprising: A presentation unit configured to present an application programming interface (API) official website interface, wherein the API official website interface comprises a function navigation bar, and the function navigation bar comprises a plurality of functions. A display unit configured to display at least one interface parameter name corresponding to a target function in an operation interface in response to a function request instruction triggered by a target object for a target function in the function navigation bar, wherein the at least one interface parameter name is obtained by a background server based on historical interface request data. A response unit configured to, for the at least one interface parameter name, respectively perform the following operations: in response to a display instruction for an interface parameter name, display respective candidate interface request parameters corresponding to the interface parameter name in the operation interface, and in response to an interface request parameter selection instruction, select a target interface request parameter from the respective candidate interface request parameters. The generating unit is configured to generate a target interface request example based on the obtained target interface request parameters, wherein the target interface request example is configured to interface with the API of the target function; The one interface parameter name corresponds to each candidate interface request parameter in the following manner: If it is determined that, except for the one interface parameter name, other interface parameter names currently correspond to selected interface request parameters, then, based on a linkage relationship between the selected interface request parameters and the interface request parameters corresponding to the one interface parameter name, the interface request parameters having the linkage relationship with the selected interface request parameters are filtered from all the interface request parameters corresponding to the one interface parameter name, and the filtered interface request parameters are taken as the candidate interface request parameters, wherein the linkage relationship is obtained based on historical interface request data; If it is determined that, except for the one interface parameter name, other interface parameter names currently do not correspond to selected interface request parameters, then all the interface request parameters corresponding to the one interface parameter name are taken as the candidate interface request parameters.
15. An interface request example generation apparatus characterized by comprising: The device comprises: The receiving unit is configured to receive a target function sent by a terminal device, wherein the target function is determined based on a function request instruction triggered by a target object for a plurality of function navigation bars included in an API official website interface; and receive each target interface request parameter sent by the terminal device, wherein each target interface request parameter in the target interface request parameters is selected from each candidate interface request parameter corresponding to a corresponding interface parameter name based on an interface request parameter selection instruction; the interface parameter name is obtained by the terminal device from a background server and is obtained by the background server based on historical interface request data; and the interface the corresponding interface parameter name corresponds to each candidate interface request parameter is determined by the terminal device in the following manner: if it is determined that, except for the interface parameter name, other interface parameter names currently correspond to selected interface request parameters, then, based on a linkage relationship between the selected interface request parameters and the interface request parameters corresponding to the interface parameter name, the interface request parameters having the linkage relationship with the selected interface request parameters are filtered from all the interface request parameters corresponding to the interface parameter name, and the filtered interface request parameters are taken as the candidate interface request parameters, wherein the linkage relationship is obtained based on historical interface request data; if it is determined that, except for the interface parameter name, other interface parameter names currently do not correspond to selected interface request parameters, then all the interface request parameters corresponding to the interface parameter name are taken as the candidate interface request parameters; The filtering unit is configured to filter, based on the target interface request parameters, historical request examples containing the target interface request parameters from historical request examples, and take the filtered historical request examples as target interface request examples; The returning unit is configured to return the target interface request examples to the terminal device, so that the terminal device displays the target interface request examples in an operation interface.
16. An electronic device, comprising: The electronic device comprises a memory and a processor, wherein: The memory is configured to store a computer program. The processor is configured to execute the computer program to implement the method steps of any one of claims 1-13.
17. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed by the processor, the method steps of any one of claims 1-13 are implemented.
18. A computer program product, characterised in that, The computer readable storage medium stores a computer program, and when the computer program is executed by the processor, the method steps of any one of claims 1-13 are implemented. The computer readable storage medium stores a computer program, and when the computer program is executed by the processor, the method steps of any one of claims 1-13 are implemented.
Citation Information
Patent Citations
Interface testing method and device
CN110196809A
Interface test case generation method and device, storage medium and electronic equipment
CN111625473A
MOCK system and data testing method based on MOCK system
CN113297078A