Third-party api protocol access method and system based on http protocol
By using a third-party API protocol access method and system based on the HTTP protocol, the problem of application interface integration in low-code development platforms has been solved, enabling rapid access and flexible expansion, reducing manpower input, and supporting cross-platform configuration and debugging.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-06
- Publication Date
- 2026-03-24
Smart Images

Figure CN116599949B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a method and system for accessing third-party API protocols based on the HTTP protocol. Background Technology
[0002] The statements in this section merely refer to the background art related to this invention and do not necessarily constitute prior art.
[0003] Low-code development platforms are development platforms that allow applications to be generated quickly with little or no coding.
[0004] After purchasing a low-code development platform, if a user needs to install a new application from the low-code development platform server using their own client, a technical problem needs to be solved:
[0005] The interface between the new application's interface and the low-code development platform server requires the low-code development platform developer to dispatch professional programmers to assist in programming, which requires a significant investment of manpower and wastes the user's time.
[0006] Current technology, which uses code to implement HTTP protocol interface integration, requires the investment of programming and development personnel. If the HTTP interface integration changes or is adjusted, it requires a new investment of development manpower. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention provides a method and system for accessing third-party API protocols based on the HTTP protocol. This invention creates a method and system for accessing third-party API protocols based on the HTTP protocol, which allows users to obtain predefined functions from third-party applications without accessing the source code or understanding the details of the internal working mechanism.
[0008] In a first aspect, the present invention provides a method for accessing third-party API protocols based on the HTTP protocol;
[0009] Methods for accessing third-party API protocols based on the HTTP protocol include:
[0010] The client creates an API protocol template based on the HTTP protocol and sends the template to the server; the server persists the configuration information in the HTTP API protocol template to the database for the first time.
[0011] The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application.
[0012] Based on the type of API protocol template used by the application, the server retrieves the corresponding HTTP-based API protocol template from the database, parses the data in the retrieved HTTP-based API protocol template, and persists the parsed data to the database a second time.
[0013] The client starts the application and sends the start command to the server. After receiving the start command, the server starts the gateway service according to the pre-made gateway template, starts the debugging service according to the pre-made debugging template, loads the second persistent API protocol template based on the HTTP protocol, starts the scheduled task, and actively requests the third-party interface of the application configured by the scheduled task according to the configuration information of the scheduled task, and persists the obtained third-party interface configuration of the application into memory.
[0014] The client sends request parameters to the server; the server retrieves the request parameters, and based on the request interface address in the request parameters, the server obtains the corresponding third-party interface configuration of the application in the API protocol template based on the HTTP protocol. The server encapsulates the request parameters according to the third-party interface configuration of the application, and determines whether there is an associated call interface mapping in the request parameters. If there is, the server retrieves the corresponding third-party interface configuration of the application in the API protocol template based on the request interface address again. If there is no mapping, the server forwards the encapsulated interface object to the client's application.
[0015] Secondly, the present invention provides a third-party API protocol access system based on the HTTP protocol;
[0016] A third-party API protocol access system based on the HTTP protocol, including: client and server;
[0017] The client creates an API protocol template based on the HTTP protocol and sends the template to the server; the server persists the configuration information in the HTTP API protocol template to the database for the first time.
[0018] The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application.
[0019] Based on the type of API protocol template used by the application, the server retrieves the corresponding HTTP-based API protocol template from the database, parses the data in the retrieved HTTP-based API protocol template, and persists the parsed data to the database a second time.
[0020] The client starts the application and sends the start command to the server. After receiving the start command, the server starts the gateway service according to the pre-made gateway template, starts the debugging service according to the pre-made debugging template, loads the second persistent API protocol template based on the HTTP protocol, starts the scheduled task, and actively requests the third-party interface of the application configured by the scheduled task according to the configuration information of the scheduled task, and persists the obtained third-party interface configuration of the application into memory.
[0021] The client sends request parameters to the server; the server retrieves the request parameters, and based on the request interface address in the request parameters, the server obtains the corresponding third-party interface configuration of the application in the API protocol template based on the HTTP protocol. The server encapsulates the request parameters according to the third-party interface configuration of the application, and determines whether there is an associated call interface mapping in the request parameters. If there is, the server retrieves the corresponding third-party interface configuration of the application in the API protocol template based on the request interface address again. If there is no mapping, the server forwards the encapsulated interface object to the client's application.
[0022] Compared with the prior art, the beneficial effects of the present invention are:
[0023] This invention enables rapid integration between client application programming interfaces (APIs) and low-code development platform interfaces, reducing limitations on application expansion and increasing its flexibility. It supports cross-platform compatibility; configuration and debugging of HTTP interface connections can be performed simply by opening a browser, eliminating the need for development manpower. Changes to the interface only require adjusting the relevant parameters in the configuration to achieve protocol integration.
[0024] This invention solves the data synchronization problem between multiple systems using a single system and a single set of data. Once the interface documentation, interface debugging, data mocking, and interface testing are defined, the system can be used directly without further definition. The same tool is used for interface documentation and interface development and debugging, ensuring complete consistency with the interface documentation definition after debugging. Attached Figure Description
[0025] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0026] Figure 1 This is a flowchart of the method in Example 1. Detailed Implementation
[0027] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0028] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments of the invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. Furthermore, it should be understood that the terms “comprising” and “having”, and any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0030] All data acquisition in this embodiment is carried out in accordance with laws and regulations and with user consent, and the data is used legally.
[0031] An API (Application Programming Interface) is a predefined set of functions designed to provide applications and developers with the ability to access a set of routines based on certain software or hardware, without needing access to the source code or understanding the details of the internal workings. Besides meaning "application interface," API also specifically refers to the documentation for the API, also known as help documentation.
[0032] Example 1
[0033] This embodiment provides a method for accessing third-party API protocols based on the HTTP protocol;
[0034] like Figure 1 As shown, the methods for accessing third-party API protocols based on the HTTP protocol include:
[0035] S101: The client creates an API protocol template based on the HTTP protocol and sends the API protocol template based on the HTTP protocol to the server; the server persists the configuration information in the API protocol template based on the HTTP protocol to the database for the first time;
[0036] S102: The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application.
[0037] Based on the type of API protocol template used by the application, the server retrieves the corresponding HTTP-based API protocol template from the database, parses the data in the retrieved HTTP-based API protocol template, and persists the parsed data to the database a second time.
[0038] S103: The client starts the application and sends the start command to the server; after receiving the start command, the server starts the gateway service according to the pre-made gateway template, starts the debugging service according to the pre-made debugging template, loads the second persistent API protocol template based on the HTTP protocol, starts the scheduled task, and actively requests the third-party interface of the application configured by the scheduled task according to the configuration information of the scheduled task, and persists the obtained third-party interface configuration of the application into memory.
[0039] S104: The client sends the request parameters to the server; the server obtains the request parameters, retrieves the corresponding third-party interface configuration of the application in the API protocol template based on the request interface address in the request parameters, encapsulates the request parameters according to the third-party interface configuration of the application, and determines whether there is an associated call interface mapping in the request parameters. If there is, the server retrieves the corresponding third-party interface configuration of the application in the API protocol template based on the request interface address again. If there is no such mapping, the server forwards the encapsulated interface object to the client's application.
[0040] Furthermore, the server is a low-code development platform.
[0041] Furthermore, in S101, the API protocol template based on the HTTP protocol includes: API protocol type, API protocol template name, API protocol template name, and authorized application.
[0042] API protocol type distinguishes the application scenarios of API templates based on the HTTP protocol. After the template is created, when calling the template, the corresponding application scenario template can be selected from the database. Application scenarios include: social, life services, e-commerce shopping, business, transportation and geography, Internet of Things, artificial intelligence, blockchain, etc.
[0043] API protocol template naming serves as an ID, allowing queries to be performed based on the name, and template names are unique.
[0044] The name of the API protocol template is determined by the user based on the actual application scenario of the template. It is usually a representative name for a certain industry, which can help users quickly understand the relevant application scenario of the template. The name does not have to be unique.
[0045] API authorization applications are designed for multi-system, multi-tenant scenarios. Authorization allows you to choose whether to grant permission to certain platforms within a low-code development platform. Platform A can only use this template after it has been authorized; otherwise, platform A cannot use it.
[0046] Furthermore, in S102, an application program refers to a computer program that runs on a client to complete a specified task, interacts with the user, and has a visual user interface.
[0047] Furthermore, in S102, the server pre-configures a gateway template, which refers to a third-party API protocol configuration template. Based on the configuration parameters, the configuration parameters are loaded into the gateway runtime file. After the gateway starts, the configuration template is run as a gateway program for the business or project based on the configuration parameters.
[0048] Furthermore, S102: The server pre-configures a gateway template, and the specific process includes: protocol reception, policy, forwarding and response mechanisms.
[0049] Protocol reception refers to the process in front-end and back-end separated projects where the development documentation enables the front-end to call back-end interfaces (generated by Swagger), while the back-end is used to return and manipulate data. The returned data format is standardized after communication between the back-end and the front-end, making data manipulation more consistent and easier for the front-end (iOS, Android, Web).
[0050] The strategy refers to defining several custom logical methods during the pass-through process, allowing data to be passed through directly during normal pass-through. These custom logical methods involve preprocessing the data in the request at the gateway layer, such as adding a unified identifier to the data before handing it over to the corresponding backend service (an interface exposed by the low-code development platform) for processing according to the identifier.
[0051] Forwarding refers to forwarding different services through a gateway (Swagger2). A gateway, also known as an internetwork connector or protocol converter, is a default gateway that implements network interconnection at the network layer and above. It is the most complex network interconnection device and is only used for interconnecting two networks with different high-level protocols. The structure of a gateway is similar to that of a router, but the interconnection layer is different. Gateways can be used for both wide area network (WAN) and local area network (LAN) interconnection. Its functions include: authenticating and verifying user requests; routing user requests to microservices and implementing load balancing; and rate limiting user requests.
[0052] Swagger is a real-time API documentation generation tool. API documentation is an indispensable tool in modern front-end and back-end separated projects. Before front-end and back-end development, the back-end needs to generate API documentation first, and the front-end develops the project based on the API documentation. After both sides have completed development, they conduct integration testing. Swagger has two commonly used versions: Swagger 2 and Swagger 3.
[0053] Swagger2 generates API specification documents for each module based on the specifications and generates interfaces. The gateway acts as a data relay station, collecting data and then transferring it to various interfaces.
[0054] The response mechanism refers to using Swagger (used to generate, describe, invoke, and visualize RESTful web services) to enable the client and file system to update at the same speed as the server. The methods, parameters, and models of the file are tightly integrated into the server-side code, allowing the API to always stay in sync.
[0055] Swagger is a middleware that generates API documentation in the Responsive style and supports testing.
[0056] The backend code includes: HTTP port number, HTTP username, mapped address, mapped port, and forwarding strategy.
[0057] The basic attributes of the gateway template in the HTTP page include: communication protocol, domain name / IP, port, management username, password, terminal registration authorization ID, long-term access token, and response timeout.
[0058] Gateway communication protocols are protocols used for communication between different types of networks. They are key components connecting different networks, enabling data conversion and transmission.
[0059] A terminal registration authorization ID is a unique identifier used in certain application scenarios to ensure the legitimacy of terminal devices. It requires registration and authorization of the terminal device. When installing an application on a terminal device, the registration authorization ID of that terminal device must be associated with the application to ensure that only authorized terminal devices can use the application.
[0060] A long-lived access token is an access token with a longer validity period. Typically, a regular access token is a short-term access credential with a short validity period, while a long-lived access token can be used for long-term access to applications or services, with a validity period that can last for days, weeks, or months. Compared to short-term access tokens, long-lived access tokens avoid the inconvenience of frequent re-authentication for users and can also improve the performance and efficiency of applications or services.
[0061] Response timeout refers to a situation in network communication where, after a client sends a request, if the server does not return a response within a specified time, the client will stop waiting for a response and throw a timeout error.
[0062] Response timeouts are set to prevent clients from waiting indefinitely for a response. During network communication, servers may fail to respond to client requests promptly for various reasons, such as network latency or server overload. If the client does not set a response timeout, it will wait indefinitely for a server response, which will degrade the application's responsiveness and performance. By setting a response timeout, the client can wait for a server response within a specified time. If a timeout occurs, the client can promptly handle errors and take appropriate action.
[0063] The debugging template includes: params configuration information, header configuration information, cookie configuration information, and body configuration information.
[0064] `url`, `api_key`, and `api_secret` represent the gateway's URL, API key, and API secret, respectively, and can be modified according to the actual situation. `headers` represents the request header information, where `X-API-KEY` and `X-API-SECRET` are the API key and API secret used for authentication, respectively, and `Content-Type` indicates the format of the request data. `data` represents the request data, and can be modified according to the actual situation. The `requests.post` method is used to send a POST request, where `json` indicates that the request data format is JSON. Finally, `response.status_code` and `response.json()` are used to output the response status code and response data, respectively.
[0065] This is a simple gateway debugging template that can be modified and extended according to specific needs. In actual development, features such as logging and exception handling can be added as needed to improve the reliability and robustness of the application.
[0066] Related modules:
[0067] Swagger-tools: Provides various tools for integrating and interacting with Swagger. For example, schema validation,
[0068] Swagger-core: A Swagger implementation for Java / Scala. It integrates with JAX-RS (Jersey, Resteasy, CXF...), Servlets, and the Play framework.
[0069] Swagger-js: A Swagger implementation for JavaScript.
[0070] Swagger-node-express: The Swagger module for the Express web application framework for Node.js.
[0071] Swagger-ui: A dependency-free collection of HTML, JS, and CSS that dynamically generates elegant documentation for Swagger-compatible APIs.
[0072] Swagger-codegen: A template-driven engine that generates client-side code in various languages by analyzing user Swagger resource declarations.
[0073] Furthermore, in S102, a pre-made debugging template is provided. The debugging template refers to the protocol that can be mounted after the gateway is started, and the debugging process can be used to simulate requests and responses.
[0074] A debug template is a simulation of a front-end and back-end separated development model. It simulates the front-end calling the back-end interface (simulating data forwarding through the gateway). The protocols mounted after the gateway project starts can be simulated for requests and responses through the debug project.
[0075] Pre-built debugging templates, the specific process of which includes: the protocol's simulated request and response mechanism;
[0076] The simulated request of the protocol refers to capturing request data packets, then resending the captured data packets without relying on the host machine, simulating real data packet capture, and then simulating the request to achieve the goal of resending packets. The set functions are implemented based on the request packets. The set functions include: login protocol, check-in protocol, flash sale protocol, game packets, and so on. Then, functions such as login and check-in can be implemented without relying on the host machine (i.e., without logging into a browser or application device).
[0077] The response mechanism refers to using Swagger software (for generating, describing, invoking, and visualizing RESTful web services) to ensure that the client and file system update at the same speed as the server. The methods, parameters, and models of the API are tightly integrated into the server-side code, allowing the API to always remain in sync.
[0078] Furthermore, in S102, the client creates an application, including:
[0079] The client creates an application project, configures the application name, application directory, associated protocol template, gateway address, interface, and debug address for the application project.
[0080] Furthermore, in S102, the basic parameters in the pre-made gateway template and the pre-made debugging template are replaced with the basic parameters of the application, including: type, interface, document or parsing template.
[0081] Furthermore, in S102, the step of parsing the data of the retrieved API template based on the HTTP protocol and persisting the parsed data to the database specifically includes: parsing the API interface method, request address, name, and request data.
[0082] Further, S102: The client creates an application, specifically including:
[0083] Create an application interface API template, which includes: configuration, interface, documentation, template parsing, data retrieval, and deletion sections.
[0084] The configuration section includes: basic API template configuration; this includes: API type, API template naming, API template name, authorized application, display icon, description information, whether it is enabled, whether it belongs to a system user template, and whether the template is locked. Users can modify the API template information within the system in this section, and the modified content will be automatically saved to the corresponding database.
[0085] The interface section includes: interfaces for various APIs; interfaces for various APIs include: GET, POST, PUT, DELETE, and OPTIONS interface types.
[0086] The documentation section contains Markdown documents in the standard API. These Markdown documents will be added to the database, and once the database is updated, the server will synchronously update and generate the corresponding documents.
[0087] The parsing template section, part of the general API parsing template, is highly versatile and can meet the needs of specific or even multiple scenarios. Within this section, you can define both response and request data parsing. After the parsing is defined, the backend will automatically generate the logic code using an algorithm, and you can then select the parser within the template.
[0088] For the data retrieval part, the existing API template is retrieved, and the server automatically generates the interface and documentation after retrieval.
[0089] Furthermore, the interface portion includes: API interface settings, request configuration, response configuration, structure parsing, and interface debugging.
[0090] Each API interface in the API settings includes: its own icon, global ID, name, request address, request method, request data parsing, response data parsing, original link, description, whether to display, whether to enable, and whether to display to lower levels. The global ID must be unique, and the name should be selected based on the business scenario. The request address is the address information in a complete request (the part after the port number and before the parameters), concatenated using an algorithm. The request method selects the type of request to send, including GET, POST, PUT, DELETE, and OPTIONS. For request data parsing and response data parsing, you can choose predefined data parsing types or write and call custom parsing methods. This section can be left blank if not needed in the actual scenario.
[0091] The request configuration includes: Params configuration information, Header configuration information, Cookie configuration information, and Body configuration information.
[0092] Response configuration refers to the type of response, commonly including 200 Success and 404 No Response. Users collect various response types during actual operation, and the system automatically generates the corresponding response configuration.
[0093] The structure parsing is divided into request data parser and response data parser. If users do not have a suitable parsing protocol template in the actual scenario, they can write a parser online in the structure parsing. After writing, the system will automatically generate logic code to return the parsed data to the code.
[0094] Interface debugging: Debug directly online. After configuration, the system will automatically debug according to the algorithm and return the result type and data information.
[0095] Furthermore, the Pramms configuration information is the parameter section following the complete request. The Pramms configuration information is determined based on the parameter information that follows in the actual request. The number of parameters, parameter names, types, etc. can all be filled in here, and then concatenated into the complete request.
[0096] Header configuration information is similar to cookie configuration information. When the token is included in the header or cookie, you can fill in the token parameter information in the corresponding place. After filling in, the backend automatically generates the logic code and algorithm to construct the complete request.
[0097] The Body configuration information includes: a Swagger structure containing all information and a RequestBody structure containing the information to be returned. The internal JSON format information is the returned request format.
[0098] Furthermore, the interface configuration includes: Hypertext Transfer Protocol format, method, request address, request data protocol, and response data parsing.
[0099] Furthermore, in S104, the associated call interface mapping refers to the requirement to call another interface when requesting a certain interface.
[0100] The HTTP protocol access process, at the user level, only requires four parts: creating a protocol template, creating an application, starting the application, and requesting access.
[0101] The creation of protocol templates is managed in the API module, while the creation of applications, starting applications, and requesting access are managed in the API application module.
[0102] Create a protocol template: Users configure the protocol interface address, port, mapping parameters, and general parameters on the page. After the configuration is completed, the configured information will be persisted to the database.
[0103] Creating an application: Configure the API application in the API application management page. Users need to create the corresponding application project, configure the application name, application directory, and associated protocol template. After the configuration is complete, configure the gateway address, gateway address interface, debug address, and debug address interface of the corresponding project.
[0104] After configuring the debugging interface, the server automatically copies the core code configured by the user, then finds the predefined gateway template and debugging template in the system, replaces the original default core code in the template, and then pulls the replaced associated protocol template and persists the interface information to the service file code.
[0105] Start the application: After creating the application project, start the service according to the configuration when creating the application. When starting, replace the pre-made gateway template and the pre-made debug template. After starting, load the persistence protocol template and then start the scheduled task. After setting the scheduled task, it will actively request the third-party interface configured by the scheduled task according to the setting logic, and then persist the information return value to memory.
[0106] For example, a scheduled task can be set up to detect the time when a user last requested an API interface. If the time exceeds the specified period, the token needs to be obtained again. If the time has not expired, the token can be retrieved directly from memory when requesting a third-party interface without needing to request the third-party interface again.
[0107] Access Request: Obtain the configured request parameters, retrieve the corresponding interface configuration in the service persistence template based on the request interface address and method, encapsulate the parameters according to the template interface configuration, determine whether the parameters have an associated call interface mapping, if so, return to the template to find the corresponding interface configuration, until all associations have been found, then encapsulate the data format and forward it to request the third-party service.
[0108] The methods of this invention are divided into two main categories: API template management and API application management.
[0109] There are two ways to create templates for API template management:
[0110] One method involves creating an API template, after which you need to manually input the type of the third-party API template.
[0111] Another option is for users to pull existing third-party templates online and automatically generate the corresponding information within the platform. The technical content mentioned below can all be written and used online based on the existing platform.
[0112] The user-input template requires inputting a name, authorized application, display icon, description, whether it is enabled, whether it belongs to a system user template, and whether the template is locked. Once created, the template information is stored in the database.
[0113] The client creates the application and sends it to the server. API application management is divided according to different projects; the same template can be applied to different projects. API application management creates corresponding application management based on the actual situation of the project by calling existing API templates (if no API template exists, it needs to be created first and then called). API application management mainly includes three parts: interface configuration, interface debugging, and interface synchronization. It also includes basic information such as whether the gateway service is started, whether it is available, whether it is a system project, whether the project is locked, and description information.
[0114] Interface configuration includes setting the service domain, authorized interface, token mapping fields, and basic timer settings. The service domain obtains information data through intranet penetration technology. Parameter configuration requires setting Params, Header, and Cookie information.
[0115] API debugging involves debugging the connected parts of the API interfaces in a project. Successful debugging returns all data in the Swagger structure; failure returns the corresponding data type. When sending debugging information, the local request uses a logical algorithm to call the third-party API interface, and then generates a set of logic code in the background.
[0116] The interface synchronization part synchronizes information in the project's current interface configuration by locating the corresponding data through intranet penetration. Then, the information is quickly synchronized using an algorithm.
[0117] Example 2
[0118] This embodiment provides a third-party API protocol access system based on the HTTP protocol;
[0119] A third-party API protocol access system based on the HTTP protocol, including: client and server;
[0120] The client creates an API protocol template based on the HTTP protocol and sends the template to the server; the server persists the configuration information in the HTTP API protocol template to the database for the first time.
[0121] The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application.
[0122] Based on the type of API protocol template used by the application, the server retrieves the corresponding HTTP-based API protocol template from the database, parses the data in the retrieved HTTP-based API protocol template, and persists the parsed data to the database a second time.
[0123] The client starts the application and sends the start command to the server. After receiving the start command, the server starts the gateway service according to the pre-made gateway template, starts the debugging service according to the pre-made debugging template, loads the second persistent API protocol template based on the HTTP protocol, starts the scheduled task, and actively requests the third-party interface of the application configured by the scheduled task according to the configuration information of the scheduled task, and persists the obtained third-party interface configuration of the application into memory.
[0124] The client sends request parameters to the server; the server retrieves the request parameters, and based on the request interface address in the request parameters, the server obtains the corresponding third-party interface configuration of the application in the API protocol template based on the HTTP protocol. The server encapsulates the request parameters according to the third-party interface configuration of the application, and determines whether there is an associated call interface mapping in the request parameters. If there is, the server retrieves the corresponding third-party interface configuration of the application in the API protocol template based on the request interface address again. If there is no mapping, the server forwards the encapsulated interface object to the client's application.
[0125] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for accessing third-party API protocols based on the HTTP protocol, characterized by: include: The client creates an API protocol template based on the HTTP protocol and sends the HTTP protocol template to the server; wherein, the HTTP protocol template includes: API protocol type, API protocol template name, API protocol template name, and authorized application; the server is a low-code development platform; The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application. The client starts the application and sends the startup command to the server; The client sends the request parameters to the server. The server retrieves the request parameters and, based on the request interface address in the request parameters, obtains the corresponding third-party interface configuration of the application from the API protocol template based on the HTTP protocol. The server then encapsulates the request parameters according to the third-party interface configuration of the application.
2. The method for accessing a third-party API protocol based on the HTTP protocol as described in claim 1, characterized in that, After the client creates an HTTP-based API protocol template and sends it to the server, before the client creates the application and sends it to the server, the process also includes: The server persists the configuration information from the API protocol template based on the HTTP protocol to the database for the first time.
3. The method for accessing a third-party API protocol based on the HTTP protocol as described in claim 1, characterized in that, After replacing the basic parameters in the pre-built gateway template and the pre-built debug template with the corresponding basic parameters of the application, before the client starts the application and sends the startup command to the server, the following steps are also included: Based on the type of API protocol template used by the application, the server retrieves the corresponding HTTP-based API protocol template from the database, parses the data in the retrieved HTTP-based API protocol template, and then persists the parsed data to the database a second time.
4. The method for accessing a third-party API protocol based on the HTTP protocol as described in claim 1, characterized in that, After the client launches the application and sends the launch command to the server, and before the client sends the request parameters to the server, the process also includes: After receiving the startup command, the server starts the gateway service according to the pre-built gateway template, starts the debugging service according to the pre-built debugging template, loads the second persistent API protocol template based on the HTTP protocol, starts the scheduled task, and actively requests the third-party interface of the application configured by the scheduled task according to the configuration information of the scheduled task, and persists the obtained third-party interface configuration of the application into memory.
5. The method for accessing a third-party API protocol based on the HTTP protocol as described in claim 1, characterized in that, After encapsulating the request parameters according to the application's third-party interface configuration, it also includes: Check if there is an associated API call mapping in the request parameters. If it exists, retrieve the corresponding third-party API configuration of the application in the HTTP protocol-based API template based on the requested API address. If it does not exist, forward the encapsulated API object to the client application.
6. The method for accessing a third-party API protocol based on the HTTP protocol as described in claim 1, characterized in that, The server pre-configures a gateway template, which refers to a third-party API protocol configuration template. Based on the configuration parameters, the configuration parameters are loaded into the gateway runtime file. After the gateway starts, the configuration template is run as a gateway program for the business or project based on the configuration parameters. The debug template includes: params configuration information, header configuration information, cookie configuration information, and body configuration information.
7. Third-party API protocol access systems based on the HTTP protocol, including: Client and server; The client creates an API protocol template based on the HTTP protocol and sends the HTTP protocol template to the server; wherein, the HTTP protocol template includes: API protocol type, API protocol template name, API protocol template name, and authorized application; the server is a low-code development platform; The client creates an application and sends it to the server; the server prepares a gateway template and a debug template. After receiving the application, the server replaces the basic parameters in the pre-prepared gateway template and debug template with the corresponding basic parameters of the application. The client starts the application and sends the startup command to the server; The client sends the request parameters to the server. The server retrieves the request parameters and, based on the request interface address in the request parameters, obtains the corresponding third-party interface configuration of the application from the API protocol template based on the HTTP protocol. The server then encapsulates the request parameters according to the third-party interface configuration of the application.
Citation Information
Patent Citations
Aggregation API development method and system suitable for multi-party collaborative development
CN110716743A