CN110795174B - Application program interface calling method, device, equipment and readable storage medium - Google Patents

Application program interface calling method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN110795174B
CN110795174B CN201911053762.7A CN201911053762A CN110795174B CN 110795174 B CN110795174 B CN 110795174B CN 201911053762 A CN201911053762 A CN 201911053762A CN 110795174 B CN110795174 B CN 110795174B
Authority
CN
China
Prior art keywords
application program
program interface
application
internet
called
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
CN201911053762.7A
Other languages
Chinese (zh)
Other versions
CN110795174A (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.)
CHENGDU SKSPRUCE TECHNOLOGY Inc
Original Assignee
CHENGDU SKSPRUCE TECHNOLOGY Inc
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 CHENGDU SKSPRUCE TECHNOLOGY Inc filed Critical CHENGDU SKSPRUCE TECHNOLOGY Inc
Priority to CN201911053762.7A priority Critical patent/CN110795174B/en
Publication of CN110795174A publication Critical patent/CN110795174A/en
Application granted granted Critical
Publication of CN110795174B publication Critical patent/CN110795174B/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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • 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

Abstract

The invention discloses an application program interface calling method, which comprises the following steps: receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name; judging whether the application program interface to be called is an application program interface of the Internet of things platform; if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token; if not, calling the application program interface to be called. The invention realizes the mutual compatibility of the application program interface of the platform of the Internet of things and the application program interface of the third-party service, and avoids the influence on the data access between the platform of the Internet of things and the third-party service. The invention also discloses an application program interface calling device, equipment and a storage medium, and has corresponding technical effects.

Description

Application program interface calling method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for calling an application program interface.
Background
The Internet of things platform and the third-party service both provide Application Program Interfaces (APIs) for data access, and when data access is required between the Internet of things platform and the third-party service and between one third-party service and the other third-party service, the data access can be completed by calling the application program interfaces of the other parties, but because the interface design of the application program interfaces of the Internet of things platform and the conventional application program interfaces of the third-party service is not uniform, the third-party service cannot call the application program interfaces of the Internet of things platform, the application program interfaces of the Internet of things platform and the third-party service are incompatible, and the data access between the Internet of things platform and the third-party service is influenced.
In summary, how to effectively solve the problem that the data access between the platform of the internet of things and the third-party service is affected due to the incompatibility of the application program interface of the platform of the internet of things and the application program interface of the third-party service is an urgent problem to be solved by those skilled in the art at present.
Disclosure of Invention
The invention aims to provide an application program interface calling method, which realizes mutual compatibility of an application program interface of an Internet of things platform and an application program interface of a third-party service, and avoids influence on data access between the Internet of things platform and the third-party service; another object of the present invention is to provide an application program interface calling apparatus, a device and a computer readable storage medium.
In order to solve the technical problems, the invention provides the following technical scheme:
an application program interface calling method, comprising:
receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name;
judging whether the application program interface to be called is an application program interface of the Internet of things platform;
if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling the application program interface to be called by using the Internet of things platform access token to perform access operation on the Internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among all application program names, all application identifications and all application private keys;
if not, calling the application program interface to be called so as to access the target third-party service.
In a specific embodiment of the present invention, before searching for an application identifier and an application private key corresponding to the application name from a remote dictionary service database, and before calling the to-be-called application program interface to perform an access operation on a target third-party service, the method further includes:
acquiring authority authentication information sent by a request sender of the application program interface calling request;
verifying the authority authentication information;
and when the verification is successful, executing the step of searching the application identifier and the application private key corresponding to the application program name from a remote dictionary service database, or executing the step of calling the to-be-called application program interface to perform access operation on the target third party service.
In a specific embodiment of the present invention, acquiring the authorization authentication information sent by the request sender of the application program interface invocation request includes:
obtaining an API gateway storage access token which is sent by the request sender and corresponds to the application program name; the API gateway storage access token is obtained by the request sender through a pre-generated user public key and a pre-generated user private key which correspond to the application program name from API gateway storage;
and verifying the authority authentication information, wherein the verification operation comprises the following steps:
and utilizing a key manager to perform verification operation on the API gateway storage access token.
In a specific embodiment of the present invention, determining whether the application program interface to be called is an application program interface of an internet of things platform includes:
and judging whether the to-be-called application program interface is the Internet of things platform application program interface or not according to whether the to-be-called application program interface contains the Internet of things platform identification information or not.
An application program interface calling apparatus comprising:
the request analysis module is used for receiving an application program interface calling request, analyzing the application program interface calling request and obtaining an application program interface to be called and a corresponding application program name;
the judging module is used for judging whether the application program interface to be called is an application program interface of the Internet of things platform;
the platform access module of the internet of things is used for searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database when the application program interface to be called is determined to be the platform application program interface of the internet of things, acquiring a corresponding platform access token of the internet of things by using the application identifier and the application private key, and calling the application program interface to be called by using the platform access token of the internet of things so as to perform access operation on the platform of the internet of things; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys;
and the third-party service access module is used for calling the application program interface to be called to perform access operation on the target third-party service when the fact that the application program interface to be called is not the Internet of things platform application program interface is determined.
In one embodiment of the present invention, the method further comprises:
the information acquisition module is used for acquiring authority authentication information sent by a request sender of the application program interface calling request before searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database and before calling the application program interface to be called to perform access operation on a target third-party service;
the information verification module is used for verifying the authority authentication information;
the platform access module of the internet of things is specifically a module which searches an application identifier and an application private key corresponding to the name of the application program from a remote dictionary service database when the application program interface to be called is determined to be the platform application program interface of the internet of things and the authority authentication information is successfully verified, obtains an access token of the platform of the internet of things by using the application identifier and the application private key, and calls the application program interface to be called by using the access token of the platform of the internet of things so as to perform access operation on the platform of the internet of things;
the third-party service access module is specifically a module for calling the to-be-called application program interface to perform access operation on a target third-party service when the to-be-called application program interface is determined not to be the internet of things platform application program interface and the authority authentication information is successfully verified.
In a specific embodiment of the present invention, the information receiving module is specifically a module for acquiring an API gateway storage access token corresponding to the application name and sent by the request sender; the API gateway storage access token is obtained by the request sender through a pre-generated user public key and a pre-generated user private key which correspond to the application program name from API gateway storage;
the information verification module is specifically a module for performing verification operation on the API gateway storage access token by using a key manager.
In a specific embodiment of the present invention, the determining module is specifically a module that determines whether the to-be-called application program interface is the internet of things platform application program interface according to whether the to-be-called application program interface includes the internet of things platform identification information.
An application program interface calling device comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the application program interface calling method when executing the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the application program interface calling method as described above.
The invention provides an application program interface calling method, which comprises the following steps: receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name; judging whether the application program interface to be called is an application program interface of the Internet of things platform; if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token to perform access operation on the Internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys; if not, calling the application program interface to be called so as to access the target third-party service.
According to the technical scheme, the application identification, the application private keys and the corresponding relations among the platform access tokens of the Internet of things are stored in advance, the application program names, the application identifications and the corresponding relations among the platform access tokens of the Internet of things are stored in advance in the remote dictionary service database, when the application program interface to be called is determined to be the platform application program interface of the Internet of things, the platform access token of the Internet of things is obtained by using the application identification and the application private keys, the platform access token of the Internet of things is verified to call the application program interface to be called, the application program interface of the Internet of things platform and the application program interface of the third-party service are compatible with each other, and the influence on data access between the platform of the Internet of things and the third-party service is avoided.
Correspondingly, the embodiment of the invention also provides an application program interface calling device, equipment and a computer readable storage medium corresponding to the application program interface calling method, which have the technical effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart illustrating an implementation of a method for invoking an application program interface according to an embodiment of the present invention;
FIG. 2 is a flowchart of another implementation of the API call method according to an embodiment of the present invention;
FIG. 3 is a flowchart of another implementation of the API call method according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a third party service API call in accordance with an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating a call to an application program interface of an internet of things platform according to an embodiment of the present invention;
FIG. 6 is a block diagram of an API-calling apparatus according to an embodiment of the present invention;
fig. 7 is a block diagram of an application program interface calling device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
referring to fig. 1, fig. 1 is a flowchart of an implementation of an application program interface calling method in an embodiment of the present invention, where the method may include the following steps:
s101: and receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name.
The Internet of things platform, each third party service and the like can log in an API Gateway storage (API Gateway Store) of an accessed party as a subscriber role in advance according to actual data access requirements to create an Application program (Application) needing to be accessed. When the Internet of things platform needs to perform data access on a certain third-party service, or the certain third-party service needs to perform data access on another third-party service, or the certain third-party service needs to perform data access on the Internet of things platform, an application program interface calling request can be sent to a data access management center of an accessed object, and the data access management center receives the application program interface calling request. The application program interface calling request may include an application program interface to be called and a corresponding application program name, and the received application program interface calling request may be analyzed to obtain the application program interface to be called and the corresponding application program name.
S102: and judging whether the application program interface to be called is an application program interface of the Internet of things platform, if so, executing the step S103, and if not, executing the step S104.
After the application program interface to be called and the corresponding application program name are obtained by analyzing the application program interface calling request, whether the application program interface to be called is an internet of things platform application program interface or not can be judged, if the application program interface to be called is determined to be the internet of things platform application program interface through an interface identifier, an interface type and the like, when the application program interface to be called is determined to be the internet of things platform application program interface, it is indicated that the application program interface to be called cannot be directly accessed, step S103 can be executed, and when the application program interface to be called is determined not to be the internet of things platform application program interface, step S104 can be executed.
S103: searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token so as to access the Internet of things platform.
The system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys.
When the internet of things platform needs to establish data access connection with a certain third-party service, internet of things platform applications used for mutual access can be established in the internet of things platform in advance, and the internet of things platform applications and corresponding application programs in the third-party service are set to have the same name. A remote dictionary service database (Redis database) may be pre-deployed, and a correspondence between each application name, each application identifier, and each application private key is stored in the remote dictionary service database, that is, one application name corresponds to one application identifier, and one application name corresponds to one application private key. And the corresponding relation among the application identifications, the application private keys and the access tokens of the Internet of things platforms can be stored in advance. If the corresponding relation among the application identifications, the application private keys and the internet of things platform access tokens can be stored in a key-value pair mode, one application identification corresponds to one application private key and corresponds to one internet of things platform access token. After the to-be-called application program interface is determined to be the application program interface of the platform of the internet of things, the application identification and the application private key corresponding to the application program name can be searched from the remote dictionary service database. The method comprises the steps that an application program interface of the Internet of things platform is provided with an access Token (Token), the corresponding Internet of things platform access Token (IOT accessToken) is obtained by utilizing an application identifier and an application private key, the Internet of things platform access Token is added to a real path URL needing to be accessed to serve as a query parameter, and the application program interface to be called is called through the Internet of things platform access Token, so that the access operation of the Internet of things platform is realized, namely, the mutual compatibility of the Internet of things platform application program interface and a third-party service application program interface is realized.
S104: and calling the application program interface to be called so as to access the target third-party service.
After the fact that the to-be-called application program interface is not the Internet of things platform application program interface is determined, the to-be-called application program interface can be directly called, and access operation on the target third-party service is achieved.
According to the technical scheme, the application identification, the application private keys and the corresponding relations among the platform access tokens of the Internet of things are stored in advance, the application program names, the application identifications and the corresponding relations among the platform access tokens of the Internet of things are stored in advance in the remote dictionary service database, when the application program interface to be called is determined to be the platform application program interface of the Internet of things, the platform access token of the Internet of things is obtained by using the application identification and the application private keys, the platform access token of the Internet of things is verified to call the application program interface to be called, the application program interface of the Internet of things platform and the application program interface of the third-party service are compatible with each other, and the influence on data access between the platform of the Internet of things and the third-party service is avoided.
It should be noted that, based on the first embodiment, the embodiment of the present invention further provides a corresponding improvement scheme. In the following embodiments, steps that are the same as or correspond to those in the first embodiment may be referred to each other, and corresponding advantageous effects may also be referred to each other, which are not described in detail in the following modified embodiments.
Example two:
referring to fig. 2, fig. 2 is a flowchart of another implementation of the method for calling an application program interface according to an embodiment of the present invention, where the method may include the following steps:
s201: and receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name.
S202: and acquiring the authority authentication information sent by the request sender of the application program interface calling request.
The permission authentication process before the application program interface is called can be preset, and after the application program interface calling request is received, permission authentication information sent by a request sending party of the application program interface calling request can be obtained.
S203: and carrying out verification operation on the authority authentication information.
After the authority authentication information sent by the request sender is acquired, verification operation can be performed on the authority authentication information. By performing authority authentication on the request sender firstly and performing subsequent calling steps of the application program interface to be called only after the authority authentication on the request sender is successful, data can be prevented from being maliciously stolen, and the data security of an Internet of things platform or a third-party service as an accessed party is ensured.
S204: and judging whether the to-be-called application program interface is the Internet of things platform application program interface or not according to whether the to-be-called application program interface contains the Internet of things platform identification information or not, if so, executing step S205, and otherwise, executing step S206.
S205: and when the authority authentication information is successfully verified, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token so as to access the Internet of things platform.
The system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys.
S206: and when the authority authentication information is successfully verified, calling an application program interface to be called so as to access the target third-party service.
Example three:
referring to fig. 3, fig. 3 is a flowchart of another implementation of the application program interface invoking method in the embodiment of the present invention, where the method may include the following steps:
s301: and receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name.
S302: and acquiring an API gateway storage access token which is sent by the request sender and corresponds to the application program name.
The API gateway storage access token is obtained by the request sender from the API gateway storage through a pre-generated user public key and a user private key corresponding to the application program name.
After the internet of things platform or the third-party service creates the application program, the system creates a Client (Client) for authority authentication for the application program, and simultaneously generates a user public key (consumerKey) and a user private key (consumerSecret) corresponding to the application program name of the application program, and establishes a corresponding relation between the user public key and the user private key and the storage access token of the API gateway. After sending the application program interface call request, the request sender may obtain an API Gateway storage access token from an API Gateway storage (API Gateway storage) through a user public key and a user private key corresponding to the application program name. After receiving the application program interface call request, the data access management center may obtain an API gateway storage access token corresponding to the application program name and sent by the request sender.
S303: and utilizing the key manager to perform verification operation on the API gateway storage access token.
The corresponding relation between the standard user public Key and the standard user private Key and the API gateway storage access token can be stored in a Key Manager (Key Manager) in advance, and after the API gateway storage access token corresponding to the application program name and sent by the request sender is obtained, the Key Manager can be used for verifying the API gateway storage access token.
S304: and judging whether the to-be-called application program interface is the internet of things platform application program interface or not according to whether the to-be-called application program interface contains the internet of things platform identification information or not, if so, executing step S305, and if not, executing step S306.
The internet of things platform identification information can be set for the internet of things platform application program interface, after the application program interface calling request is analyzed to obtain the application program interface to be called and the corresponding application program name, whether the application program interface to be called is the internet of things platform application program interface or not can be judged according to whether the application program interface to be called contains the internet of things platform identification information or not. Therefore, whether the application program interface to be called is the application program interface of the Internet of things platform or not is simply and conveniently identified.
S305: and when the verification of the API gateway storage access token is successful, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token so as to access the Internet of things platform.
The system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys.
S306: and when the verification of the API gateway storage access token is successful, calling an application program interface to be called to perform access operation on the target third-party service.
In an embodiment, referring to fig. 4, fig. 4 is a schematic diagram illustrating a call to a third party service application program interface according to an embodiment of the present invention. The whole process from subscription to calling of the third-party service application program interface by applying the technical scheme provided by the embodiment of the invention can comprise the following steps:
1. the user can log in the API gateway for storage as a subscriber, an application program is created, and when the application program is created, the system creates a client side with authority authentication for the application program, namely a key manager, and generates a corresponding user public key and a corresponding user private key at the same time.
2. And subscribing an application program interface needing to be called by using the application program, and then acquiring an access token stored by the API gateway through the user public key and the user private key.
3. An application program interface is invoked using the access token as an authorization credential.
4. The API gateway store may validate the access token at the key manager and, if validation is successful, invoke the real third party application program interface.
5. And calling a real third-party application program interface successfully, and returning a result.
In a specific example implementation, referring to fig. 5, fig. 5 is a schematic diagram illustrating a call to an application program interface of an internet of things platform according to an embodiment of the present invention, and an overall process from subscription to call to an application program interface of a third-party service according to the technical solution provided by the embodiment of the present invention may include:
1. the user can log in the API gateway for storage as a subscriber, an application program is created, and when the application program is created, the system creates a client side with authority authentication for the application program, namely a key manager, and generates a corresponding user public key and a corresponding user private key at the same time.
2. And establishing the platform application of the Internet of things with the same name on the platform of the Internet of things according to the corresponding application program name in the subscriber per se, and returning the application identifier and the application private key. And storing the application identification and the application private key into a remote dictionary service database, and setting the name of the application program as a search keyword.
3. And subscribing the application program interface needing to be called by using the application program.
4. And obtaining the access token stored by the API gateway through the user public key and the user private key.
5. The API gateway store may validate the access token at the key manager.
6. And if the application program interface comprises the identification of the Internet of things platform, the application program interface is the Internet of things platform application program interface.
7. And after the access token is successfully verified, querying the corresponding application identification and the application private key according to the application program name.
8. And obtaining an access token of the Internet of things platform at the Internet of things platform by using the application identifier and the application private key.
9. And adding an access token of the platform of the Internet of things to a real path needing to be accessed as a query parameter, and calling a real application program interface for accessing.
10. The real application program interface verifies that the access token is successful, the access is successful, and a result is returned.
Corresponding to the above method embodiments, the embodiments of the present invention further provide an application program interface calling apparatus, and the application program interface calling apparatus described below and the application program interface calling method described above may be referred to correspondingly.
Referring to fig. 6, fig. 6 is a block diagram of an application program interface calling apparatus according to an embodiment of the present invention, where the apparatus may include:
the request analysis module 61 is used for receiving the application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name;
the judging module 62 is configured to judge whether the application program interface to be called is an application program interface of an internet of things platform;
the internet of things platform access module 63 is used for searching an application identifier and an application private key corresponding to an application program name from a remote dictionary service database when the to-be-called application program interface is determined to be the internet of things platform application program interface, acquiring a corresponding internet of things platform access token by using the application identifier and the application private key, and calling the to-be-called application program interface by using the internet of things platform access token so as to perform access operation on the internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys;
and the third-party service access module 64 is configured to, when it is determined that the to-be-called application program interface is not the internet of things platform application program interface, call the to-be-called application program interface to perform an access operation on the target third-party service.
According to the technical scheme, the application identification, the application private keys and the corresponding relations among the platform access tokens of the Internet of things are stored in advance, the application program names, the application identifications and the corresponding relations among the platform access tokens of the Internet of things are stored in advance in the remote dictionary service database, when the application program interface to be called is determined to be the platform application program interface of the Internet of things, the platform access token of the Internet of things is obtained by using the application identification and the application private keys, the platform access token of the Internet of things is verified to call the application program interface to be called, the application program interface of the Internet of things platform and the application program interface of the third-party service are compatible with each other, and the influence on data access between the platform of the Internet of things and the third-party service is avoided.
In one embodiment of the present invention, the apparatus may further include:
the information receiving module is used for receiving authority authentication information before searching an application identifier and an application private key corresponding to an application program name from a remote dictionary service database and before calling an application program interface to be called to perform access operation on a target third-party service;
the information verification module is used for verifying the authority authentication information;
the internet of things platform access module 63 is specifically a module for searching an application identifier and an application private key corresponding to an application program name from a remote dictionary service database when the to-be-called application program interface is determined to be the internet of things platform application program interface and the authority authentication information is successfully verified, acquiring an internet of things platform access token by using the application identifier and the application private key, and calling the to-be-called application program interface by using the internet of things platform access token to perform access operation on the internet of things platform;
the third-party service access module 64 is specifically a module that calls the to-be-called application program interface to perform an access operation on the target third-party service when it is determined that the to-be-called application program interface is not the internet of things platform application program interface and the authorization authentication information is successfully verified.
In a specific embodiment of the present invention, the information receiving module is specifically a module for receiving an API gateway storage access token sent by a request sender of an application program interface call request; the API gateway storage access token is obtained by a request sender from API gateway storage through a pre-generated user public key and a pre-generated user private key;
the information verification module is specifically a module for performing verification operation on the storage access token of the API gateway by using the key manager.
In a specific embodiment of the present invention, the determining module 62 is specifically a module for determining whether the to-be-called application program interface is an application program interface of an internet of things platform according to whether the to-be-called application program interface includes the identification information of the internet of things platform.
Corresponding to the above method embodiment, referring to fig. 7, fig. 7 is a schematic diagram of an application program interface calling device provided in the present invention, where the device may include:
a memory 71 for storing a computer program;
the processor 72, when executing the computer program stored in the memory 71, may implement the following steps:
receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name; judging whether the application program interface to be called is an application program interface of the Internet of things platform; if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token so as to access the Internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys; if not, calling an application program interface to be called so as to access the target third-party service.
For the introduction of the device provided by the present invention, please refer to the above method embodiment, which is not described herein again.
Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of:
receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name; judging whether the application program interface to be called is an application program interface of the Internet of things platform; if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling an application program interface to be called by using the Internet of things platform access token to perform access operation on the Internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys; if not, calling an application program interface to be called so as to access the target third-party service.
The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
For the introduction of the computer-readable storage medium provided by the present invention, please refer to the above method embodiments, which are not described herein again.
In the present specification, the embodiments are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same or similar parts between the embodiments are referred to each other. The device, the apparatus and the computer-readable storage medium disclosed in the embodiments correspond to the method disclosed in the embodiments, so that the description is simple, and the relevant points can be referred to the description of the method.
The principle and the implementation of the present invention are explained in the present application by using specific examples, and the above description of the embodiments is only used to help understanding the technical solution and the core idea of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (10)

1. An application program interface calling method, comprising:
receiving an application program interface calling request, and analyzing the application program interface calling request to obtain an application program interface to be called and a corresponding application program name;
judging whether the application program interface to be called is an application program interface of the Internet of things platform;
if so, searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database, acquiring a corresponding Internet of things platform access token by using the application identifier and the application private key, and calling the application program interface to be called by using the Internet of things platform access token to perform access operation on the Internet of things platform; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys;
if not, calling the application program interface to be called so as to access the target third-party service.
2. The API calling method of claim 1, further comprising, before searching the remote dictionary service database for the application identifier and the application private key corresponding to the application name, and before calling the API to be called to perform an access operation on a target third-party service:
acquiring authority authentication information sent by a request sender of the application program interface calling request;
verifying the authority authentication information;
and when the verification is successful, executing the step of searching the application identifier and the application private key corresponding to the application program name from a remote dictionary service database, or executing the step of calling the to-be-called application program interface to perform access operation on the target third party service.
3. The method for calling the application program interface according to claim 2, wherein obtaining the authorization authentication information sent by the request sender of the application program interface calling request comprises:
obtaining an API gateway storage access token which is sent by the request sender and corresponds to the application program name; the API gateway storage access token is obtained by the request sender through a pre-generated user public key and a pre-generated user private key which correspond to the application program name from API gateway storage;
and performing verification operation on the authority authentication information, wherein the verification operation comprises the following steps:
and utilizing a key manager to perform verification operation on the API gateway storage access token.
4. The method for calling the application program interface according to any one of claims 1 to 3, wherein the step of judging whether the application program interface to be called is an application program interface of an internet of things platform comprises the following steps:
and judging whether the to-be-called application program interface is the Internet of things platform application program interface or not according to whether the to-be-called application program interface contains the Internet of things platform identification information or not.
5. An application program interface calling apparatus, comprising:
the request analysis module is used for receiving an application program interface calling request, analyzing the application program interface calling request and obtaining an application program interface to be called and a corresponding application program name;
the judging module is used for judging whether the application program interface to be called is an application program interface of the Internet of things platform;
the platform access module of the internet of things is used for searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database when the application program interface to be called is determined to be the platform application program interface of the internet of things, acquiring a corresponding platform access token of the internet of things by using the application identifier and the application private key, and calling the application program interface to be called by using the platform access token of the internet of things so as to perform access operation on the platform of the internet of things; the system comprises a plurality of application identifiers, application private keys and access tokens of the Internet of things platform, wherein the corresponding relations among the application identifiers, the application private keys and the access tokens of the Internet of things platform are prestored; the remote dictionary service database stores the corresponding relation among the application program names, the application identifications and the application private keys;
and the third-party service access module is used for calling the application program interface to be called to perform access operation on the target third-party service when the fact that the application program interface to be called is not the Internet of things platform application program interface is determined.
6. The API-calling device of claim 5, further comprising:
the information receiving module is used for acquiring authority authentication information sent by a request sender of the application program interface calling request before searching an application identifier and an application private key corresponding to the application program name from a remote dictionary service database and calling the application program interface to be called to perform access operation on a target third-party service;
the information verification module is used for verifying the authority authentication information;
the platform access module of the internet of things is specifically a module which searches an application identifier and an application private key corresponding to the name of the application program from a remote dictionary service database when the application program interface to be called is determined to be the platform application program interface of the internet of things and the authority authentication information is successfully verified, obtains an access token of the platform of the internet of things by using the application identifier and the application private key, and calls the application program interface to be called by using the access token of the platform of the internet of things so as to perform access operation on the platform of the internet of things;
the third-party service access module is specifically a module which calls the application program interface to be called to perform access operation on a target third-party service when the fact that the application program interface to be called is not the internet of things platform application program interface and the authority authentication information is successfully verified is determined.
7. The API call apparatus according to claim 6, wherein the information receiving module is specifically a module that obtains an API gateway storage access token corresponding to the application name sent by the request sender; the API gateway storage access token is obtained by the request sender through a pre-generated user public key and a pre-generated user private key which correspond to the application program name from API gateway storage;
the information verification module is specifically a module for performing verification operation on the API gateway storage access token by using a key manager.
8. The api call apparatus according to any one of claims 5 to 7, wherein the determining module is specifically a module that determines whether the api to be called is the internet of things platform api according to whether the api to be called includes the internet of things platform identifier information.
9. An application program interface calling device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the application program interface call method according to any one of claims 1 to 4 when executing said computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of the application program interface calling method according to any one of claims 1 to 4.
CN201911053762.7A 2019-10-31 2019-10-31 Application program interface calling method, device, equipment and readable storage medium Active CN110795174B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911053762.7A CN110795174B (en) 2019-10-31 2019-10-31 Application program interface calling method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911053762.7A CN110795174B (en) 2019-10-31 2019-10-31 Application program interface calling method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110795174A CN110795174A (en) 2020-02-14
CN110795174B true CN110795174B (en) 2023-03-14

Family

ID=69440889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911053762.7A Active CN110795174B (en) 2019-10-31 2019-10-31 Application program interface calling method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110795174B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111913722A (en) * 2020-06-15 2020-11-10 北京爱接力科技发展有限公司 Third-party application program management method and device applied to robot
CN113347579B (en) * 2021-05-31 2022-09-27 广州宏算信息科技有限公司 Data transmission method and device for train equipment
CN113867720A (en) * 2021-09-29 2021-12-31 上海同星智能科技有限公司 Third-party library function intermodulation method and intermodulation system for software platform
CN114461294A (en) * 2021-12-24 2022-05-10 广东智联蔚来科技有限公司 Method for quickly constructing application service, computer device and storage medium
CN116560764B (en) * 2023-07-12 2023-12-22 深圳市华曦达科技股份有限公司 Application program interface control method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107124433A (en) * 2017-07-04 2017-09-01 中国联合网络通信集团有限公司 Internet of things system, internet of things equipment access method, access authorization methods and equipment
CN108632329A (en) * 2017-03-24 2018-10-09 华为技术有限公司 A kind of access method and device of third side plug
CN108777699A (en) * 2018-04-13 2018-11-09 西安电子科技大学 A kind of application cross-domain access method under the domain collaborative multi framework based on Internet of Things
CN108900309A (en) * 2018-05-17 2018-11-27 北京岸思信息科技有限公司 A kind of method for authenticating and right discriminating system
CN109726025A (en) * 2018-12-29 2019-05-07 北京神舟航天软件技术有限公司 A kind of api interface access method based on API gateway
CN109768988A (en) * 2019-02-26 2019-05-17 安捷光通科技成都有限公司 Decentralization Internet of Things security certification system, facility registration and identity identifying method
CN110099055A (en) * 2019-04-29 2019-08-06 北京工业大学 Internet of Things service architecture based on lightweight block chain node

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9538311B2 (en) * 2014-02-04 2017-01-03 Texas Instruments Incorporated Auto-provisioning for internet-of-things devices

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108632329A (en) * 2017-03-24 2018-10-09 华为技术有限公司 A kind of access method and device of third side plug
CN107124433A (en) * 2017-07-04 2017-09-01 中国联合网络通信集团有限公司 Internet of things system, internet of things equipment access method, access authorization methods and equipment
CN108777699A (en) * 2018-04-13 2018-11-09 西安电子科技大学 A kind of application cross-domain access method under the domain collaborative multi framework based on Internet of Things
CN108900309A (en) * 2018-05-17 2018-11-27 北京岸思信息科技有限公司 A kind of method for authenticating and right discriminating system
CN109726025A (en) * 2018-12-29 2019-05-07 北京神舟航天软件技术有限公司 A kind of api interface access method based on API gateway
CN109768988A (en) * 2019-02-26 2019-05-17 安捷光通科技成都有限公司 Decentralization Internet of Things security certification system, facility registration and identity identifying method
CN110099055A (en) * 2019-04-29 2019-08-06 北京工业大学 Internet of Things service architecture based on lightweight block chain node

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MWoT多域体系架构设计与实现;邬俊杰;《中国优秀硕士学位论文全文数据库 信息科技辑》;I138-1713 *

Also Published As

Publication number Publication date
CN110795174A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
CN110795174B (en) Application program interface calling method, device, equipment and readable storage medium
CN110430205B (en) Single sign-on method, device, equipment and computer readable storage medium
CN109688186B (en) Data interaction method, device, equipment and readable storage medium
CN111030812A (en) Token verification method, device, storage medium and server
CN112165454B (en) Access control method, device, gateway and console
CN113067859B (en) Communication method and device based on cloud mobile phone
CN113765906B (en) Method, equipment and system for one-key login of terminal application program
CN107645474B (en) Method and device for logging in open platform
CN111371811B (en) Resource calling method, resource calling device, client and service server
CN112131535B (en) Integrated small program authorization method for multi-deployment environment
CN111090616B (en) File management method, corresponding device, equipment and storage medium
CN110990798B (en) Application program permission configuration method and device, electronic equipment and storage medium
CN113810535B (en) Information processing method and electronic device
US10742802B2 (en) Methods and devices for verifying a communication number
CN108768987B (en) Data interaction method, device and system
CN108449367B (en) Method and device for managing user login security, electronic equipment and readable medium
CN113596226A (en) Interface display method and electronic equipment
CN114338060A (en) Authority verification method, device, system, equipment and storage medium
US10853816B1 (en) Systems and methods for authentication of an individual on a communications device
CN110807181A (en) Method, device and system for logging in and verifying database in enterprise
CN107517177B (en) Interface authorization method and device
CN112257047B (en) Safety control method, device, equipment and medium for data sharing platform
CN112822007B (en) User authentication method, device and equipment
CN112069488B (en) Application login method in communication program and related device thereof
CN113660288B (en) User number binding method and system based on block chain system

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