Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides an interface call link generation method, an interface call link generation device, interface call link generation equipment and a readable storage medium. The interface calling link generation method can be applied to terminal equipment, and the terminal equipment can be electronic equipment such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating steps of a method for generating an interface call link according to an embodiment of the present application.
As shown in fig. 1, the interface call link generation method includes steps S101 to S105.
And step S101, acquiring a first interface information list.
The first interface information list is an interface information list formed by combining interface parameters of each interface, and an arrangement mode of the parameters in the first interface information list may be set according to an actual situation, which is not specifically limited in the present application.
In one embodiment, as shown in fig. 2, step S101 includes sub-step S1011 to sub-step S1013.
And a substep S1011, obtaining at least one data packet.
When the terminal equipment runs, the data packet called in the running process of the terminal equipment is obtained through a preset packet capturing tool, and at least one data packet is obtained. The preset bag-grabbing tool can be selected according to actual conditions, for example, the preset bag-grabbing tool can be a Fiddler bag-grabbing tool. The data packet in the operation process of the terminal equipment can be accurately obtained through the preset packet capturing tool.
Illustratively, when the computer downloads data, the data packets downloaded by the computer are extracted by a Fiddler packet-capturing tool, so as to obtain at least one data packet downloaded by the computer, wherein the number of the obtained data packets may be set according to actual conditions, only one data packet may be obtained, or a plurality of data packets may be obtained.
Substep S1012, parsing at least one of the data packets to obtain message information of at least one interface.
Converting the data packet into a text format to obtain a data packet text, and analyzing the data packet text to obtain message information of the interface, wherein the message information includes a request mode of the interface, a Uniform Resource Locator (URL), first header information, sender information, second header information, and return information.
It should be noted that the number of message messages for generating an interface is determined according to the number of interfaces in a data packet and the number of data packets. For example, if only one interface is included in one data packet, only the message information of one interface can be analyzed; if one data packet comprises two interfaces, analyzing message information of the two interfaces; and analyzing the message information of the four interfaces if each data packet comprises two interfaces.
And a substep S1013 of generating a first interface information list according to the message information of at least one interface.
Analyzing the message information of at least one interface to obtain a request mode, a URL (uniform resource locator), first header information, sending body information, second header information and returning body information of at least one interface; a first interface information list is generated based on a request mode, a URL, first header information, sending body information, second header information, and returning body information of at least one interface. The request mode, the URL, the first header information, the sending body information, the second header information and the returning body information of the interface can be accurately obtained by analyzing the message information, and a first interface information list can be generated according to the request mode, the URL, the first header information, the sending body information, the second header information and the returning body information of the interface.
In an embodiment, the method of analyzing the message information of the at least one interface to obtain the request mode, the URL, the first header information, the sender information, the second header information, and the return information of the at least one interface may be: the method comprises the steps of obtaining a request mode identification, a URL identification, a first head information identification, a sending body information identification, a second head information identification and a returning body information identification of an interface in message information, obtaining a mapping relation table between a preset request mode identification, the URL identification, the first head information identification, the sending body information identification, the second head information identification, the returning body information identification and the request mode, the URL, the first head information, the sending body information, the second head information identification and the returning body information, and obtaining the request mode, the URL, the first head information, the sending body information identification, the second head information identification and the returning body information of the interface according to the mapping relation table and the request mode identification, the URL identification, the first head information, the sending body information, the second head information and the returning body information of the interface in the message information. Wherein, the mapping relation table is established in advance. Through the mapping relation table and the request mode identification, the URL identification, the first head information identification, the sending body information identification, the second head information identification and the returning body information identification of the interface in the message information, the request mode, the URL, the first head information, the sending body information, the second head information and the returning body information of the interface included in the message information can be accurately determined.
In an embodiment, the manner of generating the first interface information list based on the request manner, the URL, the first header information, the sending body information, the second header information, and the returning body information of the at least one interface may be: converting the request mode, URL, first header information, sending body information, second header information and returning body information of the interface into a key-value pair form to obtain key-value pair information of the interface, analyzing the key-value pair information of the interface into a dictionary form and storing the dictionary form into an interface information list to obtain a first interface information list. The convenience of parameter storage is improved by carrying out format conversion on the parameters of the interface.
Step S102, inputting the first interface information list into a preset parameter type identification model to obtain the parameter type of each parameter in the first interface information list, wherein the parameter type identification model is a pre-trained neural network model.
The preset parameter type identification model can comprise neural network models such as a long-term and short-term memory artificial neural network, a convolutional neural network model and a cyclic convolutional neural network. The parameter categories include a first parameter category, a second parameter category and a third parameter category, the first parameter category is an instruction parameter, the second parameter category is a parameter that must be filled by a user, such as a user account and a password, and the third parameter category is an association parameter.
In one embodiment, the preset parameter category identification model comprises an input layer, a hidden layer and an output layer. The input layer includes a first preset number of neural networks, the hidden layer includes a second preset number of neural networks, and the output layer includes a third preset number of neural networks. The first preset number, the second preset number and the third preset number may be set according to actual conditions, and the present application is not specifically limited thereto, for example, the first preset number may be 2, the second preset number may be 3, and the third preset number may be 2, when the neural network is a long-short term memory artificial neural network, the input layer includes a double-layer long-short term memory artificial neural network, the hidden layer includes a three-layer long-short term memory artificial neural network, and the output layer includes a double-layer long-short term memory artificial neural network.
In one embodiment, a first interface information list is input to an input layer to obtain a first vector; inputting a first vector to the hidden layer to obtain a second vector; and inputting the second vector to the output layer to obtain the parameter category of each parameter in the first interface information list. The first interface information list is input into the preset parameter type identification model, and the parameter type of each parameter in the first interface information list can be accurately determined.
In an embodiment, the method for updating the parameters in the preset parameter type identification model may be as follows: inputting the first interface information list into an input layer to obtain a first vector, inputting the first vector into a hidden layer to obtain a second vector, inputting the second vector into an output layer to obtain the parameter type of each parameter in the first interface information list, determining a target loss value according to each parameter in the first interface information list and the parameter type of each parameter in the first interface information list, determining whether the preset parameter type identification model converges or not according to the target loss value, if the preset parameter type identification model does not converge, updating the parameter of the preset parameter type identification model, and continuing training the updated preset parameter type identification model until the convergence.
In an embodiment, according to each parameter in the first interface information list and the parameter category of each parameter in the first interface information list, the manner of determining the target loss value may be: inputting each parameter in the first interface information list into a softmax function to obtain a first parameter, taking a logarithm of the first parameter to obtain a second parameter, adding the parameter type of each parameter in the first interface information list and the second parameter to obtain a third parameter of each parameter, carrying out average calculation on the third parameter and taking an inverse number to obtain a target loss value.
In an embodiment, the manner of determining whether the predetermined parameter type identification model converges according to the target loss value may be: determining that the target loss value is smaller than a preset threshold value, and if the target loss value is smaller than the preset threshold value, determining that the preset parameter type identification model is converged; and if the target loss value is greater than or equal to the preset threshold value, determining that the preset parameter type identification model is not converged. The preset threshold may be set according to actual conditions, which is not specifically limited in this application, and for example, the preset threshold may be set to 0.25. By determining whether the target loss value is smaller than the preset threshold value, the convergence condition of the preset parameter type identification model can be determined, and the accuracy of model identification is improved.
Step S103, updating each parameter in the first interface information list based on the parameter category of each parameter to obtain a second interface information list.
After the parameter category of each parameter in the first interface information list is determined, a preset parameter updating rule is obtained, and each parameter in the first interface information list is updated based on the preset parameter updating rule, so that an updated second interface information list is obtained. Wherein, the preset parameter updating rule can be set according to the actual situation. Parameters in the first interface information list are updated through a preset parameter updating rule, and the accuracy of the subsequent generation of the interface link can be improved.
Illustratively, the preset parameter update rule is as follows: the parameters of the first parameter type are kept the original parameter values, the parameters of the second parameter type are updated to input _ remap, and the parameters of the third parameter type are updated to svrid. For example, each parameter in the first interface information list is { "page": 1, "remap": xxxx "," svrid ": 111111}, where page is a parameter of the first parameter class, remap is a parameter of the second parameter class, and svrid is a parameter of the third parameter class, and according to the preset parameter update rule, the parameter in the first interface information list is updated, and each parameter in the updated second interface information list is {" page ": 1," remap ": input _ remap," svrid ": svrid }.
And step S104, acquiring target interface information, and screening interface information associated with the target interface information from the second interface information list to obtain an associated interface information set.
The associated interface information set at least comprises first associated interface information and second associated interface information, the first associated interface information is associated with the target interface information, the second associated interface information is associated with the first associated interface information, the first associated interface information comprises associated parameters in the target interface information, and the second associated interface information comprises associated parameters in the first associated interface information.
In an embodiment, the manner of obtaining the target interface information may be: and finding the last piece of interface information from the second interface information list, and taking the last piece of interface information as target interface information. Or acquiring an interface calling link request, extracting interface information from the interface calling link request, and taking the extracted interface information as target interface information. Of course, other manners of obtaining the target interface information exist, which is not specifically limited in the embodiment of the present application, for example, the penultimate interface information may also be found from the second interface information list, and the penultimate interface information is used as the target interface information.
In an embodiment, the manner of screening the interface information associated with the target interface information from the second interface information list to obtain the associated interface information set may be: extracting the associated parameters in the sender information of the target interface information, and taking the associated parameters as target parameters; and screening the interface information associated with the target interface information from the second interface information list based on the target parameters to obtain an associated interface information set. The related interface information can be accurately found through the related parameters in the sender information of the target interface information.
In an embodiment, based on the target parameter, the interface information associated with the target interface information is screened from the second interface information list, and the manner of obtaining the associated interface information set may be: screening interface information with target parameters in the returned body information from the second interface information list, and adding the selected interface information into a relevant interface information set to update the relevant interface information set; extracting the associated parameters in the sender information of the selected interface information, and taking the associated parameters as updated target parameters; and screening interface information with the updated target parameter in the returned body information from the second interface information list based on the updated target parameter, adding the selected interface information into the associated interface information set to update the associated interface information set, traversing all the interface information in the second interface information list until the same associated parameter does not exist, and finishing updating the associated interface information set. Through the level-to-level recursion of the associated parameters of the target interface information, the interface information associated with the target interface information can be found, and an associated interface information set is obtained.
Illustratively, the second interface information list includes interface information 1, interface information 2, interface information 3, interface information 4, interface information 5, interface information 6, interface information 7, interface information 8, interface information 9, and interface information 10, where interface information 2 is target interface information, an associated parameter in sending body information of interface information 2 is associated parameter 2, it is found that the return body information of interface information 7 includes associated parameter 2, interface information 7 is associated interface information, interface information 7 is added into the associated interface information set, the associated parameter in sending body information of interface information 7 is associated parameter 7, it is found that the return body information of interface information 5 includes associated parameter 7, interface information 5 is associated interface information, interface information 5 is added into the associated interface information set, the associated parameter in sending body information of interface information 5 is associated parameter 5, if the return body information without the interface information in the second interface information list includes the association parameter 5, the associated interface information set is updated, and the associated interface information set includes the interface information 7 and the interface information 5.
And step S105, generating a target interface calling link according to the target interface information and each interface information in the associated interface information set.
After the associated interface information set is obtained, determining the splicing sequence of the target interface information and each interface information in the associated interface information set; and splicing the target interface information and each interface information in the associated interface information set according to the splicing sequence to obtain a target interface calling link. By splicing the target interface information and each interface information in the associated interface information set, the target interface calling link can be accurately obtained.
In an embodiment, the manner of determining the splicing order of each interface information in the target interface information and the associated interface information set may be: acquiring the associated parameters of the sender information of the target interface; acquiring the association parameters of the sending body information and the association parameters of the returning body information of each interface in the association interface information set; and determining the splicing sequence of the target interface information and each interface information in the associated interface information set according to the associated parameters of the transmitting body information of the target interface, the associated parameters of the transmitting body information of each interface in the associated interface information set and the associated parameters of the returning body information.
Illustratively, the associated interface information set includes interface information 7 and interface information 5, the target interface information is interface information 2, the sending entity information of the interface information 2 includes associated parameters 2, the sending entity information of the interface information 7 includes associated parameters 7, the returning entity information includes associated parameters 2, and the returning information of the interface information 5 includes 7, so that the splicing sequence of the interface information is interface information 5, interface information 7, and interface information 2 in sequence.
In an embodiment, after the target interface calling link is obtained, a target interface operation detection parameter is generated according to the target interface calling link, a target interface information operation log is obtained, whether an error occurs in the target interface operation process is determined according to the target interface information operation log and the target interface operation detection parameter, and if the error occurs in the operation process, an interface calling error early warning is generated to remind a user of the occurrence of the error in the interface information calling. And the target interface calls the link to detect the operation of the interface, so that the accuracy and the safety of data transmission are improved.
In an embodiment, the method for determining whether an error occurs in the operation process of the target interface according to the target interface information operation log and the target interface operation detection parameter may be: and determining whether the operation parameters in the target interface information operation log are the same as the target interface operation detection parameters, if so, determining that no error occurs in the target interface operation process, and if not, determining that an error occurs in the target interface operation process.
The method for generating the interface call link according to the embodiment includes obtaining the first interface information list, inputting the first interface information list to the preset parameter category identification model, obtaining the parameter category of each parameter in the first interface information list accurately, updating each parameter in the first interface information list based on the parameter category of each parameter, obtaining the second interface information list with distinct parameter categories, obtaining the target interface information, screening the interface information associated with the target interface information from the second interface information list, obtaining the associated interface information set accurately, and generating the target interface call link accurately according to the target interface information and each interface information in the associated interface information set. By the scheme, the efficiency and the accuracy of generating the interface calling link can be improved.
Referring to fig. 3, fig. 3 is a schematic block diagram of an interface call link generation apparatus according to an embodiment of the present disclosure.
As shown in fig. 3, the interface call link generation apparatus 200 includes: an obtaining module 210, a generating module 220, an updating module 230, and a screening module 240, wherein:
the obtaining module 210 is configured to obtain a first interface information list;
the generating module 220 is configured to input the first interface information list to a preset parameter category identification model, so as to obtain a parameter category of each parameter in the first interface information list;
the updating module 230 is configured to update each parameter in the first interface information list based on a parameter category of each parameter, so as to obtain a second interface information list;
the obtaining module 210 is further configured to obtain target interface information;
the screening module 240 is configured to screen the interface information associated with the target interface information from the second interface information list to obtain an associated interface information set;
the generating module 220 is further configured to generate a target interface call link according to the target interface information and each interface information in the associated interface information set.
In an embodiment, as shown in fig. 4, the obtaining module 210 further includes a obtaining sub-module 211, a parsing module 212, and a generating sub-module 213, where:
the obtaining sub-module 211 is configured to obtain at least one data packet;
the parsing module 212 is configured to parse at least one data packet to obtain message information of at least one interface;
the generating submodule 213 is configured to generate a first interface information list according to the message information of at least one interface.
In an embodiment, the generating module 220 is further configured to:
analyzing the message information of at least one interface to obtain a request mode, a Uniform Resource Locator (URL), first header information, sending body information, second header information and returning body information of at least one interface;
and generating a first interface information list based on the request mode, the URL, the first header information, the sending body information, the second header information and the return body information of at least one interface.
In an embodiment, the set of associated interface information at least includes first associated interface information and second associated interface information, the first associated interface information is associated with the target interface information, the second associated interface information is associated with the first associated interface information, the first associated interface information includes associated parameters in the target interface information, and the second associated interface information includes associated parameters in the first associated interface information.
In an embodiment, the generating module 220 is further configured to:
determining the splicing sequence of each interface information in the target interface information and the associated interface information set;
and splicing the target interface information and each interface information in the associated interface information set according to the splicing sequence to obtain the target interface calling link.
In an embodiment, the generating module 220 is further configured to:
acquiring the associated parameters of the sender information of the target interface;
acquiring the association parameters of the sending body information and the association parameters of the returning body information of each interface in the association interface information set;
and determining the splicing sequence of the target interface information and each interface information in the associated interface information set according to the associated parameters of the transmitting body information of the target interface, the associated parameters of the transmitting body information of each interface in the associated interface information set and the associated parameters of the returning body information.
In an embodiment, the preset parameter category identification model includes an input layer, a hidden layer, and an output layer, and the generating module 220 is further configured to:
inputting the first interface information list into the input layer to obtain a first vector;
inputting the first vector to the hidden layer to obtain a second vector;
and inputting the second vector to the output layer to obtain the parameter category of each parameter in the first interface information list.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the interface call link generation apparatus described above may refer to the corresponding process in the foregoing interface call link generation method embodiment, and details are not described herein again.
Referring to fig. 5, fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present disclosure.
As shown in fig. 5, the computer device includes a processor, a memory, and a communication interface connected by a system bus, wherein the memory may include a nonvolatile storage medium and an internal memory.
The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause the processor to perform any of the interface call link generation methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a non-volatile storage medium, which when executed by the processor, causes the processor to perform any of the interface call link generation methods.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the bus is, for example, an I2C (Inter-Integrated Circuit) bus, the Memory may be a Flash chip, a Read-Only Memory (ROM) magnetic disk, an optical disk, a usb disk, or a removable hard disk, the Processor may be a Central Processing Unit (CPU), the Processor may also be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, a discrete hardware component, or the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring a first interface information list;
inputting the first interface information list into a preset parameter category identification model to obtain the parameter category of each parameter in the first interface information list, wherein the parameter category identification model is a pre-trained neural network model;
updating each parameter in the first interface information list based on the parameter category of each parameter to obtain a second interface information list;
acquiring target interface information, and screening interface information associated with the target interface information from the second interface information list to obtain an associated interface information set;
and generating a target interface calling link according to the target interface information and each interface information in the associated interface information set.
In one embodiment, the processor, when implementing the obtaining the first interface information list, is configured to implement:
acquiring at least one data packet;
analyzing at least one data packet to obtain message information of at least one interface;
and generating a first interface information list according to the message information of at least one interface.
In an embodiment, when the processor generates the first interface information list according to the packet information of at least one of the interfaces, the processor is configured to:
analyzing the message information of at least one interface to obtain a request mode, a Uniform Resource Locator (URL), first header information, sending body information, second header information and returning body information of at least one interface;
and generating a first interface information list based on the request mode, the URL, the first header information, the sending body information, the second header information and the return body information of at least one interface.
In one embodiment, the processor is further configured to implement:
the associated interface information set at least comprises first associated interface information and second associated interface information, the first associated interface information is associated with the target interface information, the second associated interface information is associated with the first associated interface information, the first associated interface information comprises associated parameters in the target interface information, and the second associated interface information comprises associated parameters in the first associated interface information.
In one embodiment, when the processor generates a target interface call link according to the target interface information and each interface information in the associated interface information set, the processor is configured to:
determining the splicing sequence of each interface information in the target interface information and the associated interface information set;
and splicing the target interface information and each interface information in the associated interface information set according to the splicing sequence to obtain the target interface calling link.
In one embodiment, the processor, when performing the determining the splicing order of the target interface information and each interface information in the associated interface information set, is configured to perform:
acquiring the associated parameters of the sender information of the target interface;
acquiring the association parameters of the sending body information and the association parameters of the returning body information of each interface in the association interface information set;
and determining the splicing sequence of the target interface information and each interface information in the associated interface information set according to the associated parameters of the transmitting body information of the target interface, the associated parameters of the transmitting body information of each interface in the associated interface information set and the associated parameters of the returning body information.
In one embodiment, when the processor implements that the preset parameter category identification model includes an input layer, a hidden layer, and an output layer, and the first interface information list is input to the preset parameter category identification model to obtain a parameter category of each parameter in the first interface information list, the processor is configured to implement:
inputting the first interface information list into the input layer to obtain a first vector;
inputting the first vector to the hidden layer to obtain a second vector;
and inputting the second vector to the output layer to obtain the parameter category of each parameter in the first interface information list.
It should be noted that, as will be clearly understood by those skilled in the art, for convenience and brevity of description, the specific working process of the computer device described above may refer to the corresponding process in the foregoing interface call link generation method embodiment, and details are not described herein again.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and a method implemented when the program instructions are executed may refer to the embodiments of the interface call link generation method in the present application.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.