Cross-gateway interface calling method
By calling interface methods across gateways, network access problems in different departments are solved, automated interface registration and management are realized, data silos are broken, information interaction is facilitated, and manual registration and security problems are solved.
Patent Information
- Application Number
- CN202411238785.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-05
AI Technical Summary
Network access between different management departments and organizations is difficult to achieve, data silos are serious, multi-layer authorization information makes it difficult for callers to use, manual registration of interfaces is cumbersome and unsafe, and cannot be counted and managed.
By calling the interface method across the gateway, the user applies to call the interface of the gateway G1 in the gateway G2, registers the proxy interface after review by both parties, authorizes and records information. The user carries the authorization information when calling through the proxy interface, and gateway G2 is verified and managed.
It realizes automated interface registration and management, avoids network restrictions, breaks data silos, provides convenience for information interaction between different departments, and improves management and statistical capabilities.
Smart Images

Figure CN119094606A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of service communication and information security, and in particular to a method for calling an interface across gateways. Background Art
[0002] With the development and popularization of electronic information technology, various management departments and organizations have more and more service platforms and interfaces. Each platform provides interface calls to the inside and outside through independent interface gateways. However, network access between different management departments and organizations is difficult to achieve or open up. The problem of data islands is becoming more and more serious. Multi-layer authorization information makes it difficult for callers to use it. Manual registration in one's own interface gateway is cumbersome, unsafe, and cannot be counted and managed.
[0003] In order to solve the above problem, the present invention proposes a method for calling an interface across gateways. Summary of the invention
[0004] In order to make up for the defects of the prior art, the present invention provides a simple and efficient method for calling an interface across gateways.
[0005] The present invention is achieved through the following technical solutions:
[0006] A method for calling an interface across gateways, wherein user U is a user of gateway G1, and interface I is an interface of gateway G2. The steps for user U to call interface I are as follows:
[0007] Step S1, user U checks and applies to call interface I of gateway G2 at gateway G1;
[0008] Step S2, after the interface application is approved by both gateway G1 and gateway G2, interface I is registered in gateway G1 to generate proxy interface I2;
[0009] Step S3, respectively authorizing the interface I to the user U at the gateway G1 and the gateway G2, and recording the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1;
[0010] Step S4, user U calls the proxy interface I2 of gateway G1. Gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. After splicing the authorization information into the request information, gateway G2 is called again.
[0011] In step S1, the specific implementation steps are as follows:
[0012] Step S1.1, setting an interface list in the gateway G1, the interface list is used to display all interface information of the current gateway and other connected network management platforms; the interface information includes interface name, function description, request method and request parameters;
[0013] Step S1.2, user U views interface I displayed through interface docking in the interface list page of gateway G1, and submits application information to gateway G1, the application information including user ID, interface ID, application validity period, application number and application reason;
[0014] Step S1.3, after receiving the application information, the gateway G1 records the application information and performs a preliminary review and approval process; the preliminary review and approval process includes verifying the user's identity and checking whether the user meets the conditions for calling interface I;
[0015] After the preliminary approval, gateway G1 pushes the application information to gateway G2 through interface calls;
[0016] Step S1.4: After receiving the application information pushed by gateway G1, gateway G2 performs a secondary review and approval; the secondary review and approval includes verifying the validity of the interface and checking whether the user meets the conditions for calling the interface;
[0017] After the second review is passed, gateway G2 will return the confirmation information to gateway G1.
[0018] In step S2, the proxy interface I2 is responsible for forwarding the user's request to interface I and processing the returned result;
[0019] Gateway G1 establishes a mapping relationship between proxy interface I2 and interface I to ensure the correct forwarding of requests and the correct return of results.
[0020] In the step S3, the gateway G1 records the authorization information of the user U for the proxy interface I2, and the gateway G2 records the authorization information of the user U for the interface I; the authorization information includes the user ID, the interface ID, the authorization time, the number of authorizations and the authorization validity period;
[0021] The authorization information of user U for interface I in gateway G2 is returned to gateway G1, and gateway G1 records the returned authorization information and associates the authorization information with the authorization of user U for interface I through association fields (such as user ID, interface ID, etc.);
[0022] The associated field is used to query the authorization information when the interface is called and assembled into the call parameters.
[0023] In the step S4, the authorization information of user U at gateway G2 interface I is queried according to the associated field, and then spliced into the request information through the authorization method specified by gateway G2, requesting to call interface I;
[0024] After receiving the request, gateway G2 matches the authorization of user U according to the authorization information, and returns the result to gateway G1 after recording the call log. Gateway G1 returns the result to user U after recording its own call log.
[0025] The specific implementation steps of step S4 are as follows:
[0026] Step S4.1, user U calls proxy interface I2, gateway G1 first verifies the user's authorization information; the verification process includes checking whether the user ID, interface ID, authorization time and authorization validity period match the authorization data. If the match is successful, the user is allowed to make the interface call; otherwise, the call request is rejected;
[0027] Step S4.2, gateway G1 queries the authorization information of user U at gateway G2 interface I according to the associated field of the authorization information, and splices the queried information into the request information, and gateway G1 forwards the request information to interface I;
[0028] Step S4.3, after receiving the request information, gateway G2 verifies the identity and authority of the user according to the authorization information; after the verification is passed, gateway G2 processes the request and returns the result to gateway G1; at the same time, gateway G2 records the call log for subsequent monitoring and analysis;
[0029] Step S4, after receiving the return result from gateway G2, gateway G1 performs parsing and format conversion, and returns the final result to user U; at the same time, gateway G1 records its own call log for subsequent monitoring and analysis.
[0030] Because the authorization information carried when the gateway G2 is finally requested belongs to user U, gateway G2 manages user U, including but not limited to IP restrictions, traffic restrictions, grayscale releases and log records.
[0031] A system for calling an interface across gateways, comprising at least two gateways, a user U being a user of gateway G1, and an interface I being an interface of gateway G2; further comprising an interface application module, an interface proxy module, an interface authorization module and an interface calling module;
[0032] The interface application module is responsible for checking the interface I of the gateway G2 to be called and sending application information, which is then reviewed by the gateways G1 and G2.
[0033] The interface proxy module is responsible for registering the interface I to the gateway G1 and generating the proxy interface I2;
[0034] The interface authorization module is responsible for authorizing the interface I to the user U at the gateway G1 and the gateway G2 respectively, and recording the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1;
[0035] When user U calls the proxy interface I2 of gateway G1, gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. The interface calling module is responsible for splicing the authorization information into the request information first, and then calling gateway G2.
[0036] A device for calling an interface across gateways, characterized in that it includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0037] A readable storage medium, characterized in that: a computer program is stored on the readable storage medium, and the computer program implements the above method steps when executed by a processor.
[0038] The beneficial effects of the present invention are: the method of calling interfaces across gateways has a high degree of automation and does not require manual registration of other gateway interfaces. The called gateway can also perform statistics and management on the caller, while also avoiding network restriction problems, breaking data silos, and providing great convenience for information exchange between different departments. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Attached Figure 1 This is a schematic diagram of the method for calling an interface across gateways of the present invention.
[0041] Attached Figure 2 This is a schematic diagram of the interface application process of the present invention.
[0042] Attached Figure 3 It is a schematic diagram of the interface proxy process of the present invention.
[0043] Attached Figure 4 This is a schematic diagram of the interface authorization process of the present invention.
[0044] Attached Figure 5 This is a schematic diagram of the interface calling process of the present invention. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0046] In the method for calling an interface across gateways, user U is a user of gateway G1, and interface I is an interface of gateway G2. The steps for user U to call interface I are as follows:
[0047] Step S1, user U checks and applies to call interface I of gateway G2 at gateway G1;
[0048] In step S1, the specific implementation steps are as follows:
[0049] Step S1.1, setting an interface list in the gateway G1, the interface list is used to display all interface information of the current gateway and other connected network management platforms; the interface information includes interface name, function description, request method and request parameters;
[0050] Step S1.2, user U views interface I displayed through interface docking in the interface list page of gateway G1, and submits application information to gateway G1, the application information including user ID, interface ID, application validity period, application number and application reason;
[0051] Step S1.3, after receiving the application information, the gateway G1 records the application information and performs a preliminary review and approval process; the preliminary review and approval process includes verifying the user's identity and checking whether the user meets the conditions for calling interface I;
[0052] After the preliminary approval, gateway G1 pushes the application information to gateway G2 through interface calls;
[0053] Step S1.4: After receiving the application information pushed by gateway G1, gateway G2 performs a secondary review and approval; the secondary review and approval includes verifying the validity of the interface and checking whether the user meets the conditions for calling the interface;
[0054] After the second review is passed, gateway G2 will return the confirmation information to gateway G1.
[0055] Step S2, after the interface application is approved by both gateway G1 and gateway G2, interface I is registered in gateway G1 to generate proxy interface I2;
[0056] In step S2, the proxy interface I2 is responsible for forwarding the user's request to interface I and processing the returned result;
[0057] Gateway G1 establishes a mapping relationship between proxy interface I2 and interface I to ensure the correct forwarding of requests and the correct return of results.
[0058] Step S3, respectively authorizing the interface I to the user U at the gateway G1 and the gateway G2, and recording the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1;
[0059] In the step S3, the gateway G1 records the authorization information of the user U for the proxy interface I2, and the gateway G2 records the authorization information of the user U for the interface I; the authorization information includes the user ID, the interface ID, the authorization time, the number of authorizations and the authorization validity period;
[0060] The authorization information of user U for interface I in gateway G2 is returned to gateway G1, and gateway G1 records the returned authorization information and associates the authorization information with the authorization of user U for interface I through association fields (such as user ID, interface ID, etc.);
[0061] The associated field is used to query the authorization information when the interface is called and assembled into the call parameters.
[0062] Step S4, user U calls the proxy interface I2 of gateway G1. Gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. After splicing the authorization information into the request information, gateway G2 is called again.
[0063] In the step S4, the authorization information of user U at gateway G2 interface I is queried according to the associated field, and then spliced into the request information through the authorization method specified by gateway G2, requesting to call interface I;
[0064] After receiving the request, gateway G2 matches the authorization of user U according to the authorization information, and returns the result to gateway G1 after recording the call log. Gateway G1 returns the result to user U after recording its own call log.
[0065] The specific implementation steps of step S4 are as follows:
[0066] Step S4.1, user U calls proxy interface I2, gateway G1 first verifies the user's authorization information; the verification process includes checking whether the user ID, interface ID, authorization time and authorization validity period match the authorization data. If the match is successful, the user is allowed to make the interface call; otherwise, the call request is rejected;
[0067] Step S4.2, gateway G1 queries the authorization information of user U at gateway G2 interface I according to the associated field of the authorization information, and splices the queried information into the request information, and gateway G1 forwards the request information to interface I;
[0068] Step S4.3, after receiving the request information, gateway G2 verifies the identity and authority of the user according to the authorization information; after the verification is passed, gateway G2 processes the request and returns the result to gateway G1; at the same time, gateway G2 records the call log for subsequent monitoring and analysis;
[0069] Step S4, after receiving the return result from gateway G2, gateway G1 performs parsing and format conversion, and returns the final result to user U; at the same time, gateway G1 records its own call log for subsequent monitoring and analysis.
[0070] Because the authorization information carried when the gateway G2 is finally requested belongs to user U, gateway G2 manages user U, including but not limited to IP restrictions, traffic restrictions, grayscale releases and log records.
[0071] Furthermore, after gateway G1 queries the IP address in the request information of user U, it implements the blacklist and whitelist IP management function; accordingly, when gateway G1 requests gateway G2, it carries the IP of user U together, so gateway G2 can also accurately implement the blacklist and whitelist IP function.
[0072] Gateway G1 and Gateway G2 record the call logs of the interface, including detailed information such as request information, response results, and call time. These logs can be used to monitor the usage of the interface, troubleshoot faults, and other issues.
[0073] The system for calling interfaces across gateways includes at least two gateways, user U is a user of gateway G1, and interface I is an interface of gateway G2; it also includes an interface application module, an interface proxy module, an interface authorization module and an interface calling module;
[0074] The interface application module is responsible for checking the interface I of the gateway G2 to be called and sending application information, which is then reviewed by the gateways G1 and G2.
[0075] The interface proxy module is responsible for registering the interface I to the gateway G1 and generating the proxy interface I2;
[0076] The interface authorization module is responsible for authorizing the interface I to the user U at the gateway G1 and the gateway G2 respectively, and recording the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1;
[0077] When user U calls the proxy interface I2 of gateway G1, gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. The interface calling module is responsible for splicing the authorization information into the request information first, and then calling gateway G2.
[0078] The device for calling an interface across gateways includes a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the above method steps when executing the computer program.
[0079] The readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method steps are implemented.
[0080] Compared with the prior art, the method for calling the interface across gateways has the following characteristics:
[0081] First, compared with the traditional method, this method of interface registration gets rid of the trouble of manually registering other gateway interfaces. Users only need to click to apply, and the gateways can automatically perform interface proxy and authorization in accordance with the agreed format.
[0082] Second, compared with traditional methods, when the interface is called, the gateway behind it can sense and read the real caller, and can make targeted management, such as current limiting, IP restriction, auditing, etc.
[0083] Third, this method can avoid the network restriction problem and allow only the network connectivity between gateways to be opened without considering the network connectivity between users and interfaces, and users and other gateways.
[0084] The embodiment described above is only one specific implementation of the present invention. Common changes and substitutions made by those skilled in the art within the scope of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for calling an interface across gateways, characterized by: User U is a user of gateway G1, and interface I is an interface of gateway G2. The steps for user U to call interface I are as follows: Step S1: User U checks and applies to call interface I of gateway G2 on gateway G1; Step S2: After the interface application is approved by both gateway G1 and gateway G2, interface I is registered with gateway G1 to generate proxy interface I2. Step S3: Authorize the interface I to the user U at the gateway G1 and the gateway G2 respectively, and record the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1; In step S4, user U calls the proxy interface I2 of gateway G1. Gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. After splicing the authorization information into the request information, gateway G2 is called again.
2. The method for calling an interface across gateways according to claim 1, wherein: In step S1, the specific implementation steps are as follows: Step S1.1: Set up an interface list on the gateway G1. The interface list is used to display all interface information of the current gateway and other connected network management platforms; the interface information includes interface name, function description, request method and request parameters; Step S1.2: User U views the interface I displayed through interface docking on the interface list page of gateway G1 and submits an application to gateway G1. The application information includes user ID, interface ID, application validity period, number of applications, and application reason. Step S1.3: After receiving the application information, the gateway G1 records the application information and performs a preliminary review. The preliminary review includes verifying the user's identity and checking whether the user meets the conditions for calling interface I. After the preliminary approval is passed, gateway G1 pushes the application information to gateway G2 through interface call; Step S1.4: After receiving the application information pushed by gateway G1, gateway G2 performs a secondary review. The secondary review includes verifying the validity of the interface and checking whether the user meets the conditions for calling the interface. After the second review is passed, gateway G2 will return the confirmation information to gateway G1.
3. The method for calling an interface across gateways according to claim 1, wherein: In step S2, the proxy interface I2 is responsible for forwarding the user's request to interface I and processing the return result; Gateway G1 establishes a mapping relationship between proxy interface I2 and interface I to ensure the correct forwarding of requests and the correct return of results.
4. The method for calling an interface across gateways according to claim 3, wherein: In step S3, gateway G1 records the authorization information of user U for proxy interface I2, and gateway G2 records the authorization information of user U for interface I; The authorization information includes user ID, interface ID, authorization time, authorization times and authorization validity period; The authorization information of user U for interface I in gateway G2 is returned to gateway G1. Gateway G1 records the returned authorization information and associates the authorization information with the authorization of user U for interface I through the association field. The associated fields are used to query authorization information when the interface is called and assembled into the call parameters.
5. The method for calling an interface across gateways according to claim 4, wherein: In step S4, the authorization information of user U at gateway G2 interface I is queried according to the associated field, and then spliced into the request information through the authorization method specified by gateway G2 to request to call interface I; After receiving the request, gateway G2 matches the authorization of user U according to the authorization information, and returns the result to gateway G1 after recording the call log. Gateway G1 returns the result to user U after recording its own call log.
6. The method for calling an interface across gateways according to claim 5, wherein: The specific implementation steps of step S4 are as follows: Step S4.1: User U calls proxy interface I2. Gateway G1 first verifies the user's authorization information. The verification process includes checking whether the user ID, interface ID, authorization time, and authorization validity period match the authorization data. If a match is successful, the user is allowed to make the interface call. Otherwise, the call request is rejected; Step S4.2: Gateway G1 queries the authorization information of user U at gateway G2 interface I based on the associated fields of the authorization information, and adds the queried information to the request information. Gateway G1 then forwards the request information to interface I. Step S4.3: After receiving the request information, the gateway G2 verifies the user's identity and authority based on the authorization information; After verification, gateway G2 processes the request and returns the result to gateway G1. At the same time, gateway G2 records the call log for subsequent monitoring and analysis. In step S4, after receiving the return result from gateway G2, gateway G1 performs parsing and format conversion, and returns the final result to user U; at the same time, gateway G1 records its own call log for subsequent monitoring and analysis.
7. The method for calling an interface across gateways according to claim 4, wherein: Gateway G2 manages user U, including but not limited to IP restriction, traffic restriction, grayscale release and logging.
8. A system for calling an interface across gateways, characterized by: It includes at least two gateways, user U is the user of gateway G1, and interface I is the interface of gateway G2; it also includes an interface application module, an interface proxy module, an interface authorization module and an interface calling module; The interface application module is responsible for checking the interface I of the gateway G2 to be called and issuing application information, which is then reviewed by gateways G1 and G2. The interface proxy module is responsible for registering the interface I to the gateway G1 and generating the proxy interface I2; The interface authorization module is responsible for authorizing the interface I to the user U at the gateway G1 and the gateway G2 respectively, and recording the authorization information of the user U at the gateway G2 in the authorization information at the gateway G1; When user U calls the proxy interface I2 of gateway G1, gateway G1 confirms the authorization information and obtains the authorization information of user U in gateway G2. The interface calling module is responsible for splicing the authorization information into the request information first and then calling gateway G2.
9. A device for calling an interface across gateways, characterized by: The method comprises a memory and a processor; the memory is used to store a computer program, and the processor is used to implement the method according to any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Government affair system API interface access gateway and method, electronic equipment and storage medium
CN111416837A
Interface unified management system and platform interface management system
CN114417278A
API (Application Program Interface) resource calling method and device based on reverse proxy, equipment and medium
CN116132381A
API gateway automatic authentication method and system based on interface
CN116248319A
