CN112000491A - Application program interface calling method, device, equipment and storage medium - Google Patents
Application program interface calling method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN112000491A CN112000491A CN202010819541.2A CN202010819541A CN112000491A CN 112000491 A CN112000491 A CN 112000491A CN 202010819541 A CN202010819541 A CN 202010819541A CN 112000491 A CN112000491 A CN 112000491A
- Authority
- CN
- China
- Prior art keywords
- application program
- program interface
- calling
- parameter calculation
- calculation formula
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004364 calculation method Methods 0.000 claims abstract description 71
- 238000004422 calculation algorithm Methods 0.000 claims description 20
- 238000004590 computer program Methods 0.000 claims description 6
- 238000013478 data encryption standard Methods 0.000 claims description 4
- 230000004044 response Effects 0.000 claims description 4
- 230000003287 optical effect Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 239000008186 active pharmaceutical agent Substances 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000011410 subtraction method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a method, a device, equipment and a storage medium for calling an application program interface, wherein the method comprises the following steps: responding to a calling request of a target application program interface; determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory; and calculating the interface parameters in the calling request according to the target parameter calculation formula, and returning the calling result of the target application program interface. According to the technical scheme provided by the embodiment of the invention, the calling efficiency and the calling difficulty of the application program interface are greatly improved by formulating the calling process.
Description
Technical Field
The embodiment of the invention relates to the technical field of internet application, in particular to a method, a device, equipment and a storage medium for calling an application program interface.
Background
Since the internet web2.0 era, Application Programming Interface (API) is widely used, and each internet Application or internal program needs to call a large amount of API.
However, since the APIs issued by each party do not comply with the unified standard, the calling method of the API is strange and needs professional engineers to call the corresponding API interface, the API calling workload is large, the encoding work is required to be performed each time a new API is called, and the subsequent edition issuing and on-line processing are performed, and the calling method of the API increases the development workload and reduces the development efficiency.
Disclosure of Invention
The invention provides an application program interface calling method, device, equipment and storage medium, which are used for improving calling efficiency of an API (application programming interface) and reducing calling difficulty of the API.
In a first aspect, an embodiment of the present invention provides an application program interface calling method, including:
responding to a calling request of a target application program interface;
determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory;
and calculating the interface parameters in the calling request according to the target parameter calculation formula, and returning the calling result of the target application program interface.
In a second aspect, an embodiment of the present invention further provides an apparatus for calling an application program interface, where the apparatus includes:
the response module is used for responding to a calling request of the target application program interface;
the determining module is used for determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory;
and the calling module is used for calculating the interface parameters in the calling request according to the target parameter calculation formula and returning the calling result of the target application program interface.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement an application programming interface call method as described in any of the embodiments of the invention.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an application program interface calling method according to any one of the embodiments of the present invention.
According to the calling request of the target application program interface and the incidence relation between the application program interface and the parameter calculation formula stored in the memory, the corresponding target parameter calculation formula is determined for the target application program interface, the interface parameter in the calling request is calculated according to the target parameter calculation formula, and the calling result of the target application program interface is returned. According to the technical scheme provided by the embodiment of the invention, the calling process is formulated, so that the calling efficiency of the application program interface is greatly improved, and the calling difficulty of the API interface is reduced.
Drawings
Fig. 1 is a flowchart of an application program interface calling method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an application program interface calling apparatus according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an application program interface calling method according to an embodiment of the present invention, where the embodiment is applicable to calling an API interface, and typically, the method may be applied to an API interface calling system. Specifically, the service system may initiate an API interface call request to the external server through the API interface call system to obtain the corresponding network service from the external server, and the method may be performed by an application program interface call apparatus, and the apparatus may be implemented in a software and/or hardware manner.
Referring to fig. 1, the method specifically includes the following steps:
and S110, responding to the calling request of the target application program interface.
In this embodiment, the service system may initiate a call request of the API interface to the external server through the API interface call system, so as to obtain corresponding data or implement corresponding functional requirements through the external API interface. When a call request of the API interface is generated, the API interface call system responds to the call request to execute a subsequent call process.
And S120, determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory.
The parameter calculation formula is a calculation formula related to interface parameters when the API interface is called, and the interface parameters are calculated according to the corresponding calculation formula, so that calling of the API interface can be realized.
The parameter calculation formula in this embodiment is determined according to the calling document of the application program interface, and specifically, the determining the parameter calculation formula according to the calling document of the application program interface includes: determining a calling rule of an application program interface according to a calling document of the application program interface; and configuring a parameter calculation formula corresponding to the application program interface according to the calling rule and the preset parameter information, parameter calculation method and encryption and decryption algorithm in the memory.
In this embodiment, the calculation method and the encryption and decryption algorithm involved in the parameter calculation process are pre-built into the API call system. The calculation method comprises an addition method, a subtraction method, a multiplication method, a division method, a sequencing method, a splicing method and the like; the Encryption and decryption algorithms include a message digest MD5 algorithm, an RSA algorithm, a Data Encryption Standard (DES), an SM2 algorithm, an SM3 algorithm, and the like. In the system, a complete API call framework is provided, including GET, POST, PUT, DELETE and the like, the positions of parameter settings such as Header, Query, Body and the like are added, and the request mode and the parameters are visually set in the system.
Because API interfaces provided by different external servers correspond to different calling rules, before calling the API interfaces, parameter calculation formulas corresponding to different APIs are configured in advance according to calling documents of the API interfaces, before calling the API interfaces, users configure calculation formulas of interface parameters according to the API calling documents, set which parameters need to be sent, store the formulas, and meanwhile, an API calling system caches the calculation formulas in a memory.
In the embodiment, the parameter information, the calculation method, the encryption and decryption algorithm and the like which are related in the API calling process are preset in the system memory, the coding work which is related in the API calling process is changed into the configuration work, the calling difficulty of the API interface is reduced, the configuration personnel can call the API interface only by understanding the calling rule of RESTful API, and the complicated coding work is omitted.
In this embodiment, since the parameter calculation formulas corresponding to the API interfaces are already stored in the system, when a call event occurs, the system automatically calls the corresponding parameter calculation formulas in the memory to perform calculation. Specifically, determining a target parameter calculation formula corresponding to a target application program interface according to an association relationship between the application program interface and the parameter calculation formula stored in a memory includes: matching the target application program interface with an application program interface stored in a memory; and taking the matched parameter calculation formula associated with the application program interface as a target parameter calculation formula.
S130, calculating the interface parameters in the calling request according to the target parameter calculation formula, and returning the calling result of the target application program interface.
In this embodiment, the interface parameters of the target API interface are calculated according to the target parameter calculation formula determined in S120, parameters are assembled, and finally a call frame is used to complete one call, and a result value of the API is returned for the service system to use, so that access to the API interface can be quickly and effectively implemented.
According to the technical scheme provided by the embodiment of the invention, the corresponding target parameter calculation formula is determined for the target application program interface according to the calling request of the target application program interface and the incidence relation between the application program interface and the parameter calculation formula stored in the memory, the interface parameter in the calling request is calculated according to the target parameter calculation formula, and the calling result of the target application program interface is returned. By formulating the calling process, the calling efficiency and calling difficulty of the application program interface are greatly improved, the requirements of access personnel are reduced, and the access cost of the API is reduced.
Example two
Fig. 2 is a schematic structural diagram of an application program interface calling device according to a second embodiment of the present invention, where the application program interface calling device according to the second embodiment of the present invention can execute an application program interface calling method according to any embodiment of the present invention.
Referring to fig. 2, the apparatus includes a response module 210, a determination module 220, and a calling module 230.
The response module 210 is configured to respond to a call request of the target application program interface;
a determining module 220, configured to determine a target parameter calculation formula corresponding to the target application program interface according to an association relationship between the application program interface and the parameter calculation formula stored in the memory;
and the calling module 230 is configured to calculate the interface parameter in the calling request according to the target parameter calculation formula, and return a calling result of the target application program interface.
Specifically, the determining module 220 is specifically configured to: matching the target application program interface with an application program interface stored in a memory;
and taking the matched parameter calculation formula associated with the application program interface as a target parameter calculation formula.
And the parameter calculation formula is determined according to a calling document of an application program interface.
On the basis of the above embodiment, the embodiment of the present invention further includes a parameter calculation formula determination module, where the parameter calculation formula determination module is configured to:
determining a calling rule of an application program interface according to a calling document of the application program interface;
and configuring a parameter calculation formula corresponding to the application program interface according to the calling rule and the preset parameter information, parameter calculation method and encryption and decryption algorithm in the memory.
Optionally, the calculation method includes at least one of the following: addition, subtraction, multiplication, division, sorting methods and splicing methods.
Optionally, the encryption and decryption algorithm includes at least one of the following: message digest algorithm, RSA algorithm, data encryption standard, SM2 algorithm, and SM3 algorithm.
The application program interface calling device provided by the embodiment of the invention can execute the application program interface calling method provided by any embodiment of the invention, has the corresponding functional modules and beneficial effects of the execution method, and is not described again.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an apparatus according to a third embodiment of the present invention. Fig. 3 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 3 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in FIG. 3, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 3, and commonly referred to as a "hard drive"). Although not shown in FIG. 3, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, implementing an application program interface calling method provided by an embodiment of the present invention.
Example four
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an application program interface calling method according to any one of the foregoing embodiments of the present invention, where the method includes:
responding to a calling request of a target application program interface;
determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory;
and calculating the interface parameters in the calling request according to the target parameter calculation formula, and returning the calling result of the target application program interface.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. An application program interface calling method, comprising:
responding to a calling request of a target application program interface;
determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory;
and calculating the interface parameters in the calling request according to the target parameter calculation formula, and returning the calling result of the target application program interface.
2. The method of claim 1, wherein determining a target parameter calculation formula corresponding to the target application program interface according to an association relationship between the application program interface and the parameter calculation formula stored in a memory comprises:
matching the target application program interface with an application program interface stored in a memory;
and taking the matched parameter calculation formula associated with the application program interface as a target parameter calculation formula.
3. The method of claim 1, wherein the parameter calculation formula is determined from a calling document of an application program interface.
4. The method of claim 3, wherein determining the parameter calculation formula from the invocation document of the application program interface comprises:
determining a calling rule of an application program interface according to a calling document of the application program interface;
and configuring a parameter calculation formula corresponding to the application program interface according to the calling rule and the preset parameter information, parameter calculation method and encryption and decryption algorithm in the memory.
5. The method of claim 4, wherein the calculation method comprises at least one of: addition, subtraction, multiplication, division, sorting methods and splicing methods.
6. The method of claim 4, wherein the encryption and decryption algorithm comprises at least one of: message digest algorithm, RSA algorithm, data encryption standard, SM2 algorithm, and SM3 algorithm.
7. An application program interface calling apparatus, comprising:
the response module is used for responding to a calling request of the target application program interface;
the determining module is used for determining a target parameter calculation formula corresponding to the target application program interface according to the incidence relation between the application program interface and the parameter calculation formula stored in the memory;
and the calling module is used for calculating the interface parameters in the calling request according to the target parameter calculation formula and returning the calling result of the target application program interface.
8. The apparatus of claim 7, wherein the determining module is specifically configured to:
matching the target application program interface with an application program interface stored in a memory;
and taking the matched parameter calculation formula associated with the application program interface as a target parameter calculation formula.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the application programming interface call method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out an application program interface calling method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010819541.2A CN112000491B (en) | 2020-08-14 | 2020-08-14 | Application program interface calling method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010819541.2A CN112000491B (en) | 2020-08-14 | 2020-08-14 | Application program interface calling method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112000491A true CN112000491A (en) | 2020-11-27 |
CN112000491B CN112000491B (en) | 2024-07-02 |
Family
ID=73473322
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010819541.2A Active CN112000491B (en) | 2020-08-14 | 2020-08-14 | Application program interface calling method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112000491B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112612509A (en) * | 2020-12-23 | 2021-04-06 | 天聚地合(苏州)数据股份有限公司 | Interface integration method and device, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180196647A1 (en) * | 2017-01-09 | 2018-07-12 | International Business Machines Corporation | Application Programming Interface Discovery Using Pattern Recognition |
CN111290806A (en) * | 2020-02-10 | 2020-06-16 | 广州虎牙科技有限公司 | Calling method and device of application program interface, computer equipment and storage medium |
-
2020
- 2020-08-14 CN CN202010819541.2A patent/CN112000491B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180196647A1 (en) * | 2017-01-09 | 2018-07-12 | International Business Machines Corporation | Application Programming Interface Discovery Using Pattern Recognition |
CN111290806A (en) * | 2020-02-10 | 2020-06-16 | 广州虎牙科技有限公司 | Calling method and device of application program interface, computer equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112612509A (en) * | 2020-12-23 | 2021-04-06 | 天聚地合(苏州)数据股份有限公司 | Interface integration method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112000491B (en) | 2024-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019140828A1 (en) | Electronic apparatus, method for querying logs in distributed system, and storage medium | |
CN111090628A (en) | Data processing method and device, storage medium and electronic equipment | |
US9720824B2 (en) | Garbage collection handler to update object pointers | |
CN111163096B (en) | Method, device, electronic equipment and storage medium for providing data interface service | |
US20170004074A1 (en) | Garbage collection absent use of special instructions | |
CN112346794A (en) | Interface calling method, device, equipment and medium | |
CN112612546A (en) | Page loading method and device, electronic equipment and storage medium | |
CN109033456B (en) | Condition query method and device, electronic equipment and storage medium | |
CN112100092A (en) | Information caching method, device, equipment and medium | |
CN112000491B (en) | Application program interface calling method, device, equipment and storage medium | |
CN112069158A (en) | Data restoration method, device, equipment and storage medium | |
CN110045952B (en) | Code calling method and device | |
CN116028917A (en) | Authority detection method and device, storage medium and electronic equipment | |
CN115576978A (en) | Method, device, system and medium for responding service processing request | |
CN114205156A (en) | Message detection method and device for tangent plane technology, electronic equipment and medium | |
CN107636624B (en) | Garbage collection without using special instructions | |
CN114490266A (en) | Data acquisition method, device, equipment and storage medium | |
CN114238391A (en) | Data paging query method and device, electronic equipment and storage medium | |
CN112261072B (en) | Service calling method, device, equipment and storage medium | |
CN113919310A (en) | Short message content determination method and device, electronic equipment and storage medium | |
CN112364268A (en) | Resource acquisition method and device, electronic equipment and storage medium | |
CN111695986B (en) | Method and device for controlling accumulated gold image | |
CN111046430B (en) | Data processing method and device, storage medium and electronic equipment | |
CN113572809B (en) | Single request source multi-target source data communication method, computer equipment and storage medium | |
CN113535660B (en) | Android log storage method and device |
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 |