CN110532107B - Interface calling method, device, computer equipment and storage medium - Google Patents

Interface calling method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110532107B
CN110532107B CN201910662547.0A CN201910662547A CN110532107B CN 110532107 B CN110532107 B CN 110532107B CN 201910662547 A CN201910662547 A CN 201910662547A CN 110532107 B CN110532107 B CN 110532107B
Authority
CN
China
Prior art keywords
information
interface
keyword
target
return field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910662547.0A
Other languages
Chinese (zh)
Other versions
CN110532107A (en
Inventor
刘啸
文松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pingan Payment Technology Service Co Ltd
Original Assignee
Pingan Payment Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pingan Payment Technology Service Co Ltd filed Critical Pingan Payment Technology Service Co Ltd
Priority to CN201910662547.0A priority Critical patent/CN110532107B/en
Publication of CN110532107A publication Critical patent/CN110532107A/en
Application granted granted Critical
Publication of CN110532107B publication Critical patent/CN110532107B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application provides a method, a device, computer equipment and a storage medium for calling an interface. The method comprises the following steps: acquiring an interface document description file of a target server; extracting interface parameter information, return field type requirement information and return field length requirement information from an interface document description file; acquiring interface calling parameters according to an interface calling program; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to a target server; acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information. The method is based on a functional test technology, and can remarkably improve test development efficiency.

Description

Interface calling method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an interface calling method, an interface calling device, a computer device, and a storage medium.
Background
In the prior art, a server provides a document description of interface call, and a calling party writes a calling program according to the document description so as to call related interfaces of the server according to the calling program to achieve function realization. However, in the development stage, the interface implementation method of the server is inconsistent with the document description provided by the interface implementation method of the server, or the calling program written by the calling party is inconsistent with the document description of the server, which causes great difficulty in development and testing.
Disclosure of Invention
The application provides an interface calling method, an interface calling device, computer equipment and a storage medium, which can be used for conveniently determining whether the interface calling is successful or not and the error condition in the process of carrying out the interface calling on a server.
In a first aspect, the present application provides an interface calling method, including: acquiring an interface document description file of a target server; extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file; acquiring interface calling parameters according to an interface calling program; judging whether the interface calling parameters are consistent with the interface parameter information in comparison or not; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server; acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; and if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information.
In a second aspect, the present application provides an interface calling device, including: a first acquisition unit configured to acquire an interface document description file of a target server; a first extracting unit, configured to extract interface parameter information, return field type requirement information, and return field length requirement information from the interface document description file; the second acquisition unit is used for acquiring interface calling parameters according to the interface calling program; the first sending unit is used for judging whether the interface calling parameters are consistent with the interface parameter information in comparison or not; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server; the second extraction unit is used for acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; and the first reminding unit is used for generating interface call success information and outputting the generated interface call success information if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information.
In a third aspect, the present application provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing any one of the interface calling methods provided herein when executing the computer program.
In a fourth aspect, the present application also provides a storage medium, wherein the storage medium stores a computer program which, when executed by a processor, causes the processor to perform any of the interface invocation methods provided herein.
The application provides an interface calling method, an interface calling device, computer equipment and a storage medium. The interface calling method is used for acquiring an interface document description file of a target server; extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file; acquiring interface calling parameters according to an interface calling program; judging whether the interface calling parameters are consistent with the interface parameter information in comparison or not; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server; acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; and if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information. The interface calling method can realize the interface calling of the server, and is convenient for determining whether the interface calling is successful or not and the error condition.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an application scenario schematic diagram of an interface calling method provided in an embodiment of the present application;
fig. 2 is a schematic flow chart of an interface calling method provided in an embodiment of the present application;
FIG. 3 is a flowchart illustrating an interface calling method according to another embodiment of the present disclosure;
FIG. 4 is a flowchart of an interface calling method according to another embodiment of the present disclosure;
FIG. 5 is a schematic sub-flowchart of an interface calling method according to another embodiment of the present application;
FIG. 6 is a schematic sub-flowchart of an interface calling method according to another embodiment of the present disclosure;
FIG. 7 is a schematic block diagram of an interface calling device provided in an embodiment of the present application;
FIG. 8 is a schematic block diagram of an interface calling device according to yet another embodiment of the present application;
FIG. 9 is a schematic block diagram of an interface calling device provided in a further embodiment of the present application;
FIG. 10 is a schematic block diagram of an interface calling device provided in another embodiment of the present application;
FIG. 11 is a schematic block diagram of an interface calling device according to yet another embodiment of the present application;
fig. 12 is a schematic block diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this specification 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 be further understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1, fig. 1 is a schematic application scenario diagram of an interface calling method according to an embodiment of the present invention, where the application scenario includes:
(1) And the server is used for providing a back-end service for transmitting the interface document description file. The server is a computer device, can be a single server or a server cluster, can be a cloud server or a special webpage server, receives the access of an external terminal, and is connected with the terminal through a wired network or a wireless network.
(2) The terminal shown in fig. 1 comprises a terminal 1, a terminal 2 and a terminal 3, wherein the terminal acquires an interface document description file from a server by accessing the server, and if the interface call parameters are consistent with the interface parameter information in the interface document description file on the terminal, the terminal sends the interface call parameters to the server. The terminal can be electronic equipment such as a smart phone, a smart watch, a notebook computer, a tablet computer or a desktop computer, and the terminal accesses the server through a wired network or a wireless network.
Referring to fig. 2, fig. 2 is a flowchart of an interface calling method according to an embodiment of the present application. As shown in fig. 2, the interface calling method includes steps S110 to S160.
S110, acquiring an interface document description file of the target server.
In the embodiment of the invention, the interface which can be provided by the target server is configured with a corresponding interface document description file, and the interface document description file in the target server is acquired through the terminal, wherein the terminal can be electronic equipment such as a smart phone, a smart watch, a notebook computer, a tablet computer or a desktop computer, and the terminal accesses the server through a wired network or a wireless network; the interface document description file may include interface parameter information, return field type requirement information, and return field length requirement information. The interface parameter information refers to basic parameter information of an interface, and mainly comprises functions of the interface, interface content, interface names and the like, wherein the functions of the interface include interfaces for login/logout, the interface content includes login/logout, and the interface names include login/logo; the return field type requirement information refers to a field type requirement corresponding to the return parameter by the interface, for example: the interface configuration corresponding to the interface of the destination server prescribes that the field types corresponding to the interface return parameters are Boolean (byte), byte, integer (int), short integer (short), long integer (long) or single-precision floating point (float) and the like; the return field length requirement information refers to a field length requirement corresponding to a return parameter by an interface, for example: the interface configuration corresponding to the interface of the destination server specifies that the field length corresponding to the interface return parameter is 1 byte, 2 bytes, 4 bytes, 8 bytes, or the like.
S120, extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file.
For example, the interface parameter information, the return field type requirement information and the return field length requirement information can be obtained by extracting keywords from the interface document description file. In this embodiment of the present invention, the terminal may store a preset first keyword database, identify keywords in the interface document description file to obtain corresponding keywords, locate the positions of the keywords in the interface document description file, and further search and extract the interface parameter information, the return field type requirement information and the return field length requirement information in the interface document description file according to the positions of the keywords.
Referring to fig. 3, a schematic sub-flowchart of an interface calling method according to another embodiment of the present invention is shown. As shown, the step S120 includes sub-steps S1200 to S1203.
S1200, carrying out keyword recognition on the interface document description file according to a preset first keyword database to obtain a first keyword group, wherein the first keyword group comprises a plurality of first keywords.
In the embodiment of the invention, the terminal comprises a preset first keyword database so as to conveniently identify keywords in the interface document description file, so as to obtain a first keyword group, specifically, the first keyword database comprises various parameter information of the interface, various return field type requirement information of the interface and various return field length requirement information of the interface, so that various keywords can be conveniently corresponding, the first keyword database can be used for conveniently corresponding to various keywords, the first keyword database can be used for identifying the received interface parameter information, return field type requirement information and return field length requirement information by receiving the interface parameter information, the return field type requirement information and the return field length requirement information corresponding to the interface document description file, the first keyword database is used for respectively beginning to split out a plurality of keywords from the first keywords in the received interface parameter information, the return field type requirement information and the return field length requirement information in sequence before identification, the split words are compared through the first keyword database, if the split words exist in the first keyword database, the split words are extracted, the split words are used as the first keywords, the first keywords can be used for forming the first keyword group, and the first keyword group comprises the first keyword group and the first keyword group.
S1201, acquiring a first keyword which is consistent with a first preset keyword in the first keyword group as a first target keyword, acquiring first position information of the first target keyword in the interface document description file, and acquiring the interface parameter information in the interface document description file according to the first position information.
In the embodiment of the invention, the terminal stores a first preset keyword, which is used for determining the interface parameter information. Acquiring first keywords which are consistent with a first preset keyword in the first keyword group as first target keywords, acquiring first position information of the first target keywords in the interface document description file, and acquiring the interface parameter information in the interface document description file according to the first position information, wherein the first position information refers to paragraph position information of a paragraph where the acquired first target keywords are located in the interface document description file and paragraph segmentation position information of a paragraph where the first target keywords are located; that is, the first target keyword is located in the paragraph number in the interface document description file, for example, the paragraph is the first paragraph, the paragraph position information is 1, the paragraph is the third paragraph, and the paragraph position information is 3. The word segmentation position information refers to the position of the first target keyword in the paragraph to which the first target keyword belongs; that is, the first target keyword is what word in the paragraph, for example, the first target keyword is the 5 th word in the paragraph, then the first target keyword position information is 5, the first target keyword is the 8 th word in the paragraph, then the first target keyword position information is 8. And finally, acquiring the interface parameter information from the interface document description file according to the first position information.
S1202, acquiring a first keyword which is consistent with a second preset keyword in the first keyword group as a second target keyword, acquiring second position information of the second target keyword in the interface document description file, and acquiring the return field type requirement information in the interface document description file according to the second position information.
In the embodiment of the invention, the terminal stores a second preset keyword, which is used for determining the return field type requirement information. And acquiring the first keyword which is consistent with a second preset keyword in the first keyword group as a second target keyword, acquiring second position information of the second target keyword in the interface document description file, and acquiring the return field type requirement information in the interface document description file according to the second position information. The second position information refers to paragraph position information of the obtained paragraphs where the second target keywords are located in the interface document description file and word segmentation position information of the paragraphs where the second target keywords are located; that is, the second target keyword is located in the paragraph number in the interface document description file, for example, the paragraph is the second paragraph, the paragraph position information is 2, the paragraph is the fourth paragraph, and the paragraph position information is 4. The word segmentation position information refers to the position of the second target keyword in the paragraph to which the second target keyword belongs; that is, the second target keyword is what word in the paragraph, for example, the second target keyword is the 8 th word in the paragraph, the second target keyword position information is 8, the second target keyword is the 10 th word in the paragraph, and the second target keyword position information is 10. And finally, acquiring the return field type requirement information from the interface document description file according to the second position information.
S1203, acquiring a first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, acquiring third position information of the third target keyword in the interface document description file, and acquiring the return field length requirement information in the interface document description file according to the third position information.
In the embodiment of the invention, the terminal stores a third preset keyword, which is used for determining the return field length requirement information. And acquiring the first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, acquiring third position information of the third target keyword in the interface document description file, and acquiring the return field length requirement information in the interface document description file according to the third position information. The third position information refers to paragraph position information of the paragraphs where the acquired third target keywords are located in the interface document description file and word segmentation position information of the paragraphs where the third target keywords are located; that is, the third target keyword is located in the paragraph number in the interface document description file, for example, the paragraph is the fifth paragraph, the paragraph position information is 5, the paragraph is the eighth paragraph, and the paragraph position information is 8. The word segmentation position information refers to the position of the third target keyword in the paragraph to which the third target keyword belongs; that is, the third target keyword is what word in the paragraph, for example, the third target keyword is the 12 th word in the paragraph, then the third target keyword position information is 12, the third target keyword is the 16 th word in the paragraph, then the third target keyword position information is 16. And finally, acquiring the return field length requirement information from the interface document description file according to the third position information.
S130, acquiring interface calling parameters according to an interface calling program.
In the embodiment of the invention, the interface calling program is stored in the terminal, and the interface calling parameters are acquired according to the interface calling program on the terminal aiming at the interface provided by the target server. Specifically, the interface calling program is executed to initiate an interface parameter calling request to the interface in the target server, the format of the calling request is JSON string format, and after the interface in the target server receives the calling request of the terminal, the calling request is checked, for example: checking whether the call request is in a correct format, if so, returning an error identification code to the terminal, and if so, writing the call request into a file server by an interface in the target server, and generating interface call parameters, wherein the interface call parameters can comprise: the interface calling program returns the generated interface calling parameters to the terminal.
S140, judging whether the interface calling parameter is consistent with the interface parameter information; and if the interface calling parameters are consistent with the interface parameter information, sending the interface calling parameters to the target server.
In the embodiment of the invention, interface calling parameters are compared with the interface parameter information extracted from the interface document description file, and if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server to call the corresponding interfaces of the target server.
S150, acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field.
In the embodiment of the invention, the target server executes the function implementation of the corresponding interface according to the interface calling parameter sent by the terminal, generates the return information and sends the return information to the terminal. And searching the return information to obtain a target return field. The terminal may store a preset second keyword database, identify the keywords in the return information, obtain a corresponding keyword, determine a position of the keyword in the return information, further search and extract the target return field in the return information according to the position of the keyword, and extract type information and length information of the target return field, where the type information of the target return field may include boolean (byte), integer (int), short integer (short), long integer (long), or single-precision floating (float), and in this embodiment, for example, the type information of the target return field is byte, the target return field is B, and the length of the target return field is 1 byte.
Referring to fig. 4, a schematic sub-flowchart of an interface calling method according to still another embodiment of the present invention is shown. As shown, the step S150 includes substeps S1500 and S1501.
S1500, carrying out keyword recognition on the returned information of the target server according to a preset second keyword database to obtain a second keyword group, wherein the second keyword group comprises a plurality of second keywords.
In the embodiment of the invention, the terminal comprises a preset second keyword database so as to conveniently identify the return information to acquire a second keyword group, specifically, the second keyword database comprises various return information of interfaces so as to conveniently correspond to various keywords, the second keyword database is used for identifying the received return information by receiving the return information of the target server, a plurality of segmented words are sequentially and respectively split from a first word in the received return information before identification, the split segmented words are sequentially compared through the second keyword database, whether the segmented words exist in the second keyword database is inquired, if yes, the segmented words are extracted and taken as the second keywords, and finally, the plurality of segmented words obtained through identification form the second keyword group, wherein the second keyword group comprises a plurality of second keywords.
S1501, obtaining a second keyword which is consistent with a fourth preset keyword in the second keyword group and is used as a fourth target keyword, obtaining fourth position information of the fourth target keyword in the return information, and obtaining the target return field in the return information according to the fourth position information.
In the embodiment of the invention, the terminal stores a fourth preset keyword, which is used for determining the target return field. And obtaining the target return field in the return information according to the fourth position information by obtaining a second keyword which is consistent with a fourth preset keyword in the second keyword group as a fourth target keyword and obtaining the fourth position information of the fourth target keyword in the return information. The fourth position information refers to paragraph position information of the obtained paragraphs where the fourth target keywords are located in the return information and word segmentation position information of the paragraphs where the fourth target keywords are located; that is, the fourth target keyword is located in the paragraph number in the return information, for example, the paragraph is the sixth paragraph, the paragraph position information is 6, the paragraph is the tenth paragraph, and the paragraph position information is 10. The word segmentation position information refers to the position of the fourth target keyword in the paragraph to which the fourth target keyword belongs; that is, the fourth target keyword is what word in the paragraph, for example, the fourth target keyword is 13 th word in the paragraph, the fourth target keyword position information is 13, the fourth target keyword is 15 th word in the paragraph, and the fourth target keyword position information is 15. And finally, acquiring the target return field from the return information according to the fourth position information.
Referring to fig. 5, a flowchart of an interface calling method according to another embodiment of the present invention is shown. As shown, the method further includes S160a before the step S160.
S160a, judging whether the type information of the target return field is compared with the return field type requirement information and the length information of the target return field is compared with the return field length requirement information respectively, and whether the type information and the return field type requirement information are identical in comparison or not.
S160, if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information.
In the embodiment of the invention, the type information and the length information of the target return field are obtained, the type information of the target return field is compared with the return field type requirement information extracted from the interface document description file, the length information of the target return field is compared with the return field length requirement information extracted from the interface document description file, if the comparison consistency information is obtained, interface call success information is generated, and the generated interface call success information is output, so that a user of the terminal is reminded.
S180, if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information, generating interface call return field error prompt information and outputting the generated interface call parameter error prompt information.
In the embodiment of the invention, the type information and the length information of the target return field are obtained, the type information of the target return field is compared with the return field type requirement information extracted from the interface document description file, the length information of the target return field is compared with the return field length requirement information extracted from the interface document description file, if the comparison inconsistent information exists, interface call return field error prompt information is generated, and the generated interface call parameter error prompt information is output, so that a user of the terminal is reminded.
Referring to fig. 6, a flowchart of an interface calling method according to another embodiment of the present invention is shown. As shown, the method further includes S170:
s170, if the interface call parameter is inconsistent with the interface parameter information, generating interface call parameter error prompt information and outputting the generated interface call parameter error prompt information.
In the embodiment of the invention, interface call parameters are compared with the interface parameter information extracted from the interface document description file, if the interface call parameters are inconsistent with the interface parameter information, comparison inconsistent information is generated, interface call parameter error prompt information is generated, and the generated interface call parameter error prompt information is output to remind a user of the terminal, so that the user can modify an interface call program to correct the interface call parameters.
Referring to fig. 7, a schematic block diagram of an interface calling device according to an embodiment of the present application is provided. As shown in the figure, the interface calling device 200 provided in the present application includes: the first acquisition unit 210, the first extraction unit 220, the second acquisition unit 230, the first transmission unit 240, the second extraction unit 250, and the first alert unit 260.
A first obtaining unit 210 for obtaining an interface document description file of the target server.
The first extracting unit 220 is configured to extract interface parameter information, return field type requirement information, and return field length requirement information from the interface document description file.
The second obtaining unit 230 is configured to obtain the interface calling parameter according to the interface calling program.
A first sending unit 240, configured to determine whether the interface calling parameter is consistent with the interface parameter information; and if the interface calling parameters are consistent with the interface parameter information, sending the interface calling parameters to the target server.
The second extracting unit 250 is configured to obtain the return information of the target server, obtain a target return field according to the return information, and extract type information and length information of the target return field.
The first reminding unit 260 is configured to generate interface call success information and output the generated interface call success information if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information.
Referring to fig. 8, a schematic block diagram of an interface calling device according to another embodiment of the present application is provided. As shown in the figure, the interface calling device 200 provided in the present application includes: the first acquisition unit 210, the first extraction unit 220, the second acquisition unit 230, the first transmission unit 240, the second extraction unit 250, the first alert unit 260, and the second alert unit 270. Other units except the second reminding unit 270 are described in the above embodiments, and are not described here again.
And the second reminding unit 270 is configured to generate an interface call parameter error prompt message and output the generated interface call parameter error prompt message if the interface call parameter is inconsistent with the interface parameter information.
Referring to fig. 9, a schematic block diagram of an interface calling device according to another embodiment of the present application is provided. As shown in the figure, the interface calling device 200 provided in the present application includes: the first acquisition unit 210, the first extraction unit 220, the second acquisition unit 230, the first transmission unit 240, the second extraction unit 250, the second judgment unit 260a, the first reminder unit 260, and the third reminder unit 280. In addition to the second determining unit 260a and the third reminding unit 280, other units are described in the above embodiments, and are not described herein.
And a second judging unit 260a, configured to judge whether the type information of the target return field and the return field type requirement information are compared and whether the length information of the target return field and the return field length requirement information are both compared and matched respectively.
And the third reminding unit 280 is configured to generate interface call return field error prompt information if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information.
Referring to fig. 10, a schematic block diagram of an interface calling device according to another embodiment of the present application is provided. As shown in the figure, the interface calling device 200 provided in the present application includes: the first extraction unit 220 includes a keyword recognition unit 2200, an interface parameter information acquisition unit 2201, a return field type requirement information acquisition unit 2202, and a return field length requirement information acquisition unit 2203.
The first keyword group obtaining unit 2200 is configured to identify keywords in the interface document description file according to a preset first keyword database, so as to obtain a first keyword group, where the first keyword group includes a plurality of first keywords.
The interface parameter information obtaining unit 2201 is configured to obtain a first keyword in the first keyword group, where the first keyword is consistent with a first preset keyword, as a first target keyword, obtain first location information of the first target keyword in the interface document description file, and obtain the interface parameter information in the interface document description file according to the first location information.
A return field type requirement information obtaining unit 2202, configured to obtain, as a second target keyword, a first keyword in the first keyword group that is consistent with a second preset keyword, obtain second location information of the second target keyword in the interface document description file, and obtain the return field type requirement information in the interface document description file according to the second location information.
The return field length requirement information obtaining unit 2203 is configured to obtain, as a third target keyword, a first keyword in the first keyword group that is consistent with a third preset keyword, obtain third location information of the third target keyword in the interface document description file, and obtain the return field length requirement information in the interface document description file according to the third location information.
Referring to fig. 11, a schematic block diagram of an interface calling device according to still another embodiment of the present application is provided. As shown in the figure, the interface calling device 200 provided in the present application includes: the first acquiring unit 210, the first extracting unit 220, the second acquiring unit 230, the first transmitting unit 240, the second extracting unit 250 and the first reminding unit 260, wherein the second extracting unit 250 includes a second keyword group acquiring unit 2500 and a target return field acquiring unit 2501.
The second keyword group obtaining unit 2500 is configured to identify, according to a preset second keyword database, a keyword for the return information of the target server to obtain a second keyword group, where the second keyword group includes a plurality of second keywords.
The target return field obtaining unit 2501 is configured to obtain a second keyword in the second keyword group, where the second keyword is consistent with a fourth preset keyword, as a fourth target keyword, obtain fourth location information of the fourth target keyword in the return information, and obtain the target return field in the return information according to the fourth location information.
The interface invoking means described above may be implemented in the form of a computer program that may be run on a computer device as shown in fig. 12.
Referring to fig. 12, fig. 12 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 300 device may be a terminal. With reference to FIG. 12, the computer device 300 includes a processor 302, a memory, and a network interface 305, which are connected by a system bus 301, wherein the memory may include a non-volatile storage medium 303 and an internal memory 304. The non-volatile storage medium 303 may store an operating system 3031 and a computer program 3032. The computer program 3032 includes program instructions that, when executed, cause the processor 302 to perform an interface calling method. The processor 302 is used to provide computing and control capabilities to support the operation of the overall computer device 300. The internal memory 304 provides an environment for the execution of a computer program 3032 in the non-volatile storage medium 303, which computer program 3032, when executed by the processor 302, causes the processor 302 to perform an interface call method. The network interface 305 is used for network communication such as transmitting assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 12 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the computer device 300 to which the present application is applied, and that a particular computer device 300 may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
The processor 302 is configured to execute a computer program 3032 stored in a memory to implement the following functions: acquiring an interface document description file of a target server; extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file; acquiring interface calling parameters according to an interface calling program; judging whether the interface calling parameter is consistent with the interface parameter information; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server; acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; and if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information.
In one embodiment, the processor 302 further performs the following functions after executing the process of obtaining the interface call parameters according to the interface caller: and if the interface calling parameters are inconsistent with the interface parameter information, generating interface calling parameter error prompt information and outputting the generated interface calling parameter error prompt information.
In one embodiment, after executing the obtaining the return information of the target server, the processor 302 obtains a target return field according to the return information, and extracts the type information and the length information of the target return field, the following functions are further implemented: and if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information, generating interface call return field error prompt information.
In one embodiment, the processor 302 performs the following functions in extracting the interface parameter information, the return field type requirement information, and the return field length requirement information from the interface document description file: according to a preset first keyword database, carrying out keyword recognition on the interface document description file to obtain a first keyword group, wherein the first keyword group comprises a plurality of first keywords; acquiring a first keyword which is consistent with a first preset keyword in the first keyword group as a first target keyword, acquiring first position information of the first target keyword in the interface document description file, and acquiring the interface parameter information in the interface document description file according to the first position information; acquiring a first keyword which is consistent with a second preset keyword in the first keyword group as a second target keyword, acquiring second position information of the second target keyword in the interface document description file, and acquiring the return field type requirement information in the interface document description file according to the second position information; and acquiring a first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, acquiring third position information of the third target keyword in the interface document description file, and acquiring the return field length requirement information in the interface document description file according to the third position information.
In one embodiment, the processor 302, when executing the obtaining the return information of the target server, obtains a target return field according to the return information, and extracts the type information and the length information of the target return field, and further implements the following functions: according to a preset second keyword database, keyword recognition is carried out on the returned information of the target server so as to obtain a second keyword group, wherein the second keyword group comprises a plurality of second keywords; and acquiring a second keyword which is consistent with a fourth preset keyword in the second keyword group as a fourth target keyword, acquiring fourth position information of the fourth target keyword in the return information, and acquiring the target return field in the return information according to the fourth position information.
It should be appreciated that in embodiments of the present application, the processor 302 may be a central processing unit (Central Processing Unit, CPU), the processor 502 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf Programmable gate arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the present application, a storage medium is provided. The storage medium may be a computer readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. The program instructions, when executed by the processor, cause the processor to perform the following: acquiring an interface document description file of a target server; extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file; acquiring interface calling parameters according to an interface calling program; judging whether the interface calling parameter is consistent with the interface parameter information; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server; acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field; and if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information.
In one embodiment, after the program instructions are executed by the processor to obtain the interface call parameters according to the interface call program, the following procedure is further executed: and if the interface calling parameters are inconsistent with the interface parameter information, generating interface calling parameter error prompt information and outputting the generated interface calling parameter error prompt information.
In one embodiment, after the processor executes the obtaining the return information of the target server, obtaining a target return field according to the return information, and extracting the type information and the length information of the target return field, the following procedure is further executed: and if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information, generating interface call return field error prompt information.
In one embodiment, the program instructions are executed by the processor to extract interface parameter information, return field type requirement information, and return field length requirement information from the interface document description file, specifically performing the following procedures: according to a preset first keyword database, carrying out keyword recognition on the interface document description file to obtain a first keyword group, wherein the first keyword group comprises a plurality of first keywords; acquiring a first keyword which is consistent with a first preset keyword in the first keyword group as a first target keyword, acquiring first position information of the first target keyword in the interface document description file, and acquiring the interface parameter information in the interface document description file according to the first position information; acquiring a first keyword which is consistent with a second preset keyword in the first keyword group as a second target keyword, acquiring second position information of the second target keyword in the interface document description file, and acquiring the return field type requirement information in the interface document description file according to the second position information; and acquiring a first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, acquiring third position information of the third target keyword in the interface document description file, and acquiring the return field length requirement information in the interface document description file according to the third position information.
In one embodiment, the program instructions are executed by the processor to obtain the return information of the target server, obtain a target return field according to the return information, extract type information and length information of the target return field, and further execute the following procedure: according to a preset second keyword database, keyword recognition is carried out on the returned information of the target server so as to obtain a second keyword group, wherein the second keyword group comprises a plurality of second keywords; and acquiring a second keyword which is consistent with a fourth preset keyword in the second keyword group as a fourth target keyword, acquiring fourth position information of the fourth target keyword in the return information, and acquiring the target return field in the return information according to the fourth position information.
The storage medium may be a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, etc. which may store the program code.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units. The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (9)

1. An interface calling method, comprising:
acquiring an interface document description file of a target server;
extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file;
acquiring interface calling parameters according to an interface calling program;
judging whether the interface calling parameter is consistent with the interface parameter information; if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server;
acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field;
If the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information, generating interface call success information and outputting the generated interface call success information;
the extracting interface parameter information, return field type requirement information and return field length requirement information from the interface document description file comprises the following steps:
according to a preset first keyword database, carrying out keyword recognition on the interface document description file to obtain a first keyword group, wherein the first keyword group comprises a plurality of first keywords;
acquiring a first keyword which is consistent with a first preset keyword in the first keyword group as a first target keyword, acquiring first position information of the first target keyword in the interface document description file, and acquiring the interface parameter information in the interface document description file according to the first position information;
acquiring a first keyword which is consistent with a second preset keyword in the first keyword group as a second target keyword, acquiring second position information of the second target keyword in the interface document description file, and acquiring the return field type requirement information in the interface document description file according to the second position information;
And acquiring a first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, acquiring third position information of the third target keyword in the interface document description file, and acquiring the return field length requirement information in the interface document description file according to the third position information.
2. The interface calling method according to claim 1, wherein after the interface calling parameters are acquired according to the interface calling program, the method further comprises:
and if the interface calling parameters are inconsistent with the interface parameter information, generating interface calling parameter error prompt information and outputting the generated interface calling parameter error prompt information.
3. The interface calling method according to claim 1, wherein after the obtaining the return information of the target server, obtaining a target return field according to the return information, and extracting the type information and the length information of the target return field, the method further comprises:
and if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information, generating interface call return field error prompt information.
4. The interface calling method according to claim 1, wherein the obtaining the return information of the target server, obtaining a target return field according to the return information, and extracting type information and length information of the target return field, includes:
according to a preset second keyword database, keyword recognition is carried out on the returned information of the target server so as to obtain a second keyword group, wherein the second keyword group comprises a plurality of second keywords;
and acquiring a second keyword which is consistent with a fourth preset keyword in the second keyword group as a fourth target keyword, acquiring fourth position information of the fourth target keyword in the return information, and acquiring the target return field in the return information according to the fourth position information.
5. An interface calling device, comprising:
a first acquisition unit configured to acquire an interface document description file of a target server;
a first extracting unit, configured to extract interface parameter information, return field type requirement information, and return field length requirement information from the interface document description file;
the second acquisition unit is used for acquiring interface calling parameters according to the interface calling program;
The first sending unit is used for judging whether the interface calling parameters are consistent with the interface parameter information in comparison or not;
if the interface calling parameters are consistent with the interface parameter information, the interface calling parameters are sent to the target server;
the second extraction unit is used for acquiring the return information of the target server, acquiring a target return field according to the return information, and extracting the type information and the length information of the target return field;
the first reminding unit is used for generating interface call success information and outputting the generated interface call success information if the type information of the target return field is consistent with the return field type requirement information and the length information of the target return field is consistent with the return field length requirement information;
wherein the first extraction unit includes:
the first keyword group acquisition unit is used for carrying out keyword recognition on the interface document description file according to a preset first keyword database so as to acquire a first keyword group, wherein the first keyword group comprises a plurality of first keywords;
an interface parameter information obtaining unit, configured to obtain a first keyword in the first keyword group, where the first keyword is consistent with a first preset keyword, as a first target keyword, obtain first location information of the first target keyword in the interface document description file, and obtain the interface parameter information in the interface document description file according to the first location information;
A return field type requirement information acquisition unit, configured to acquire a first keyword in the first keyword group, where the first keyword is consistent with a second preset keyword, as a second target keyword, acquire second location information of the second target keyword in the interface document description file, and acquire the return field type requirement information in the interface document description file according to the second location information;
the return field length requirement information obtaining unit is used for obtaining a first keyword which is consistent with a third preset keyword in the first keyword group as a third target keyword, obtaining third position information of the third target keyword in the interface document description file, and obtaining the return field length requirement information in the interface document description file according to the third position information.
6. The interface calling device of claim 5, wherein the device further comprises:
and the second reminding unit is used for generating interface calling parameter error prompt information and outputting the generated interface calling parameter error prompt information if the interface calling parameter is inconsistent with the interface parameter information.
7. The interface calling device of claim 5, wherein the device further comprises:
And the third reminding unit is used for generating interface call return field error prompt information if the type information of the target return field is inconsistent with the return field type requirement information and/or the length information of the target return field is inconsistent with the return field length requirement information.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the interface invocation method of any of claims 1 to 4 when the computer program is executed by the processor.
9. A computer readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, causes the processor to perform the interface invoking method according to any of claims 1-4.
CN201910662547.0A 2019-07-22 2019-07-22 Interface calling method, device, computer equipment and storage medium Active CN110532107B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910662547.0A CN110532107B (en) 2019-07-22 2019-07-22 Interface calling method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910662547.0A CN110532107B (en) 2019-07-22 2019-07-22 Interface calling method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110532107A CN110532107A (en) 2019-12-03
CN110532107B true CN110532107B (en) 2023-04-28

Family

ID=68661701

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910662547.0A Active CN110532107B (en) 2019-07-22 2019-07-22 Interface calling method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110532107B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111045756B (en) * 2019-12-10 2024-01-09 中国工商银行股份有限公司 Method, apparatus, computing device and medium for generating interface service
CN113535830A (en) * 2020-04-21 2021-10-22 中移信息技术有限公司 Automatic interface expansion method, device, equipment and storage medium
CN113535832A (en) * 2021-06-10 2021-10-22 杭州未名信科科技有限公司 Method and device for acquiring cloud service data, electronic equipment and medium
CN114760236B (en) * 2022-04-08 2023-11-14 中国银行股份有限公司 Interface checking method, device, storage medium and equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8079017B2 (en) * 2005-11-29 2011-12-13 Alcatel-Lucent Automated QS interface testing framework
CN107193973B (en) * 2017-05-25 2021-07-20 百度在线网络技术(北京)有限公司 Method, device and equipment for identifying field of semantic analysis information and readable medium
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN110532107A (en) 2019-12-03

Similar Documents

Publication Publication Date Title
CN110532107B (en) Interface calling method, device, computer equipment and storage medium
US20190081914A1 (en) Method and apparatus for generating candidate reply message
US10572370B2 (en) Test-assisted application programming interface (API) learning
CN107731229B (en) Method and apparatus for recognizing speech
CN108846753B (en) Method and apparatus for processing data
CN109427331B (en) Speech recognition method and device
US20200279054A1 (en) Data privacy using a podium mechanism
US20210042150A1 (en) Method-call-chain tracking method, electronic device, and computer readable storage medium
CN113626223A (en) Interface calling method and device
CN110019444B (en) Operation request processing method, device, equipment and system
CN110362630B (en) Data management method, device, equipment and computer readable storage medium
CN109656592B (en) Card management method, device, terminal and computer readable storage medium
CN110990346A (en) File data processing method, device, equipment and storage medium based on block chain
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN116303937A (en) Reply method, reply device, electronic equipment and readable storage medium
CN116303888A (en) Rarely used word processing method and device, storage medium and electronic equipment
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN114048797A (en) Method, device, medium and electronic equipment for determining address similarity
US11651246B2 (en) Question inference device
CN110555070B (en) Method and apparatus for outputting information
CN113393288A (en) Order processing information generation method, device, equipment and computer readable medium
CN111444716A (en) Title word segmentation method, terminal and computer readable storage medium
CN112835494A (en) Voice recognition result error correction method and device
CN110647623A (en) Method and device for updating information
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant