General API integration parameter configuration method and system
By configuring and formatting API parameter information, the complexity of API docking in multiple companies has been solved, efficient and flexible data processing and unified format conversion are achieved, and business logic and maintenance processes are simplified.
Patent Information
- Application Number
- CN202510554992.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-08
AI Technical Summary
The docking process of APIs of many companies in the prior art is complex and inefficient, with high development costs and difficult maintenance. Inconsistent data formats lead to complex data processing, which increases the complexity of business logic.
The parameter configuration information of the API is configured through the parameter configuration interface, and formatted and stored in the database. According to the configuration information, the service call request is matched, the API type and interface address are determined, and the data is converted into a unified format is realized, and the flexible docking and dynamic parameter analysis of multiple APIs are supported.
It simplifies business logic, improves docking efficiency and data processing accuracy, reduces development and maintenance difficulties, and supports flexible docking and management of multiple APIs.
Smart Images

Figure CN120447989A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a general API integrated parameter configuration method and system. Background Art
[0002] Businesses often involve integrating APIs from multiple companies. Because each company's APIs have varying interface specifications and data formats, the integration process is complex and inefficient. Currently, a one-to-one integration approach is commonly used, requiring the development of independent integration code for each company's API. This approach is costly to develop and difficult to maintain. As company APIs are updated and upgraded, the integration code also requires frequent revisions, further increasing the complexity of development and maintenance. Furthermore, the integration process can lead to inconsistent data formats, complicating data processing and conversion and increasing the complexity of business logic. Summary of the Invention
[0003] To address the deficiencies of the existing technology, the present invention provides a universal API parameter configuration method, which enables flexible docking of APIs of multiple companies through configuration management, and adopts a unified data format for data processing and conversion, thereby simplifying business logic and improving docking efficiency and flexibility.
[0004] To achieve the above objectives, the technical solutions adopted by the present invention include:
[0005] A general API integration parameter configuration method, characterized by comprising:
[0006] S1 configures the parameter configuration information of the API through the parameter configuration interface, formats the parameter configuration information, and stores it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API-related parameters;
[0007] S2 obtains parameter configuration information from the database, receives the front-end business call request, matches the business call request with the parameter configuration information obtained from the database, and obtains a parameter set that meets the business call request;
[0008] S3 determines the API type to be called and the corresponding interface address according to the parameter configuration information, obtains the required parameter set for the call, interacts with the first API, and returns the required data;
[0009] S4. Convert the data returned by the API into a unified data format based on the field mapping relationship, and return the data in the unified data format to the client.
[0010] Furthermore, configuring the parameter configuration information of the API through the parameter configuration interface, formatting the parameter configuration information, and storing it in the database includes:
[0011] Set a parameter configuration interface, which is used to receive input parameter configuration information of multiple APIs.
[0012] Furthermore, the formatting of the parameter configuration information includes:
[0013] Convert parameter names to a unified encoding format;
[0014] The validation rules are stored in a structured manner.
[0015] Furthermore, the interacting with the first API includes:
[0016] Receive the original response data from the API, and send the parameter set to the first API interface according to the API type and the corresponding interface address.
[0017] Furthermore, the method further comprises:
[0018] Receive business call requests, distribute the requests to backend services, and process multiple APIs at the same time.
[0019] Furthermore, the method further comprises:
[0020] Automatically parse and assemble the parameters required for API calls based on parameter configuration information, dynamically adjust parameter values or add or delete parameters without recompiling code or restarting the system;
[0021] When the API parameter call request changes, only the API parameter information is modified in the parameter configuration interface without rewriting the compiled code or restarting the system.
[0022] The present invention also relates to a universal API integrated parameter configuration system, characterized by comprising:
[0023] A configuration module is used to configure the parameter configuration information of the API through the parameter configuration interface, format the parameter configuration information, and store it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API related parameters;
[0024] A matching module is used to obtain parameter configuration information from a database, receive a service call request from a front-end, match the service call request with the parameter configuration information obtained from the database, and obtain a parameter set that meets the service call request;
[0025] The docking module is used to determine the API type to be called and the corresponding interface address according to the parameter configuration information, obtain the parameter set required for the call, interact with the first API, and return the required data;
[0026] The return module is used to convert the data returned by the API into a unified data format based on the field mapping relationship, and return the data in the unified data format to the client.
[0027] The present invention also relates to a computer-readable storage medium, characterized in that a computer program is stored on the storage medium, and the computer program implements the above method when executed by a processor.
[0028] The present invention also relates to an electronic device, characterized in that it comprises a processor and a memory;
[0029] The memory is used to store program instructions;
[0030] The processor is used to execute the above method by calling program instructions.
[0031] The present invention also relates to a computer program product, comprising a computer program and / or instructions, characterized in that the computer program and / or instructions implement the steps of the above method when executed by a processor.
[0032] The beneficial effects of the present invention are:
[0033] The use of a universal API integrated parameter configuration method and system described in the present invention allows administrators to easily configure and manage API docking information of multiple companies, improving docking efficiency and data processing accuracy. Administrators and developers can focus more on the implementation of business logic, realize parameter configuration interface, dynamic parameter parsing and multiple API support, etc. Compared with traditional docking methods, it brings significant advantages and positive technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.
[0035] Figure 1 This is a flow chart of a general API integrated parameter configuration method of the present invention;
[0036] Figure 2 This is a schematic diagram of the structure of a universal API integrated parameter configuration system of the present invention;
[0037] Figure 3 A UML class diagram of a general API integrated parameter configuration implementation method of the present invention;
[0038] Figure 4 The figure is a schematic structural diagram of an electronic device of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. It should be understood that the described embodiments are only part of the embodiments of this application, not all of the embodiments, and these embodiments are only used to illustrate this application and are not used to limit the scope of this application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0040] like Figure 1 As shown, the embodiment of the present invention discloses a general API integration parameter configuration method, the steps of which include:
[0041] Step S1. Configure the parameter configuration information of the API through the parameter configuration interface, format the parameter configuration information, and store it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API related parameters.
[0042] Before step S1, the method further includes:
[0043] Set a parameter configuration interface, which is used to receive input parameter configuration information of multiple APIs.
[0044] In this embodiment, the parameter configuration interface can input parameters of a variety of different APIs, and the administrator can easily configure the parameters through an intuitive interface, including but not limited to parameter name, parameter type, default value, verification rules, and specific API-related parameters. Among them, the parameter name can be passenger name, flight number; the parameter type can be a string, integer, etc.; the default value is the default value corresponding to the parameter name, such as the default value corresponding to the flight number is 1001; the verification rule is a verification of the input content based on the parameter name, parameter type, etc., such as the passenger name length cannot be less than two characters; the API parameter configuration information also includes specific API-related parameters, such as API keys, request addresses and other data. Utilizing this configuration step, the parameter configuration information of different APIs can be efficiently managed and maintained, making the system's parameter configuration work more convenient and efficient, and providing a solid foundation for the stable operation of the system.
[0045] In this embodiment, the processed parameter data is stored in a database for subsequent invocation. This step provides the system with a flexible and configurable API parameter base to meet the invocation requirements of different APIs. In practice, when the system needs to call flight query APIs from different airlines, the corresponding parameters can be configured according to the requirements of each airline's API, making it easy for administrators to configure and manage API integration information for multiple airlines.
[0046] This embodiment introduces a specific configuration module, which can realize the parameter configuration interface, dynamically manage routing rules, service configuration, etc., support multiple APIs, so that the backend service can update the configuration without restarting, thereby improving the docking efficiency.
[0047] Step S2: Obtain parameter configuration information from the database, receive a service call request from the front end, match the service call request with the parameter configuration information obtained from the database, and obtain a parameter set that meets the service call request.
[0048] In this embodiment, the front-end request may refer to the query criteria entered by a user on the front-end to query departure, destination, and travel date. By matching and processing this data with the acquired parameter information, a parameter set that meets the API call request can be obtained. This enables dynamic parameter management and adjustment, ensuring that the system can adapt to various changes without requiring code recompilation or system restarts. In specific implementations, if the parameter requirements of an airline API change, simply modify the parameters in the configuration interface, and the present invention will automatically process the parameters according to the new configuration.
[0049] This embodiment also provides a request distribution method. Various functions need to be implemented during the business call process. Different functions correspond to different request types, and different request types correspond to different processing methods, including: after receiving the business call request, parsing the request and extracting information such as URL, HTTP method, request header, request body, etc.; searching for routing rules based on the request URL and method, where the routing rules can be dynamically configured to determine which backend service instance to send the request to, and selecting a specific backend service instance to process the request based on route matching and load balancing; the backend service accepts the request and processes it according to the business logic. After the backend service completes the processing, it returns the processing result; if the request requires multiple backend services to work together, aggregate the responses from different services and return the processing result.
[0050] Step S3: Determine the API type to be called and the corresponding interface address according to the parameter configuration information, obtain the parameter set required for the call, interact with the first API, and return the required data.
[0051] In this embodiment, interacting with the first API includes:
[0052] Receive the original response data from the API, and send the parameter set to the first API interface according to the API type and the corresponding interface address.
[0053] Specifically, the API type to be called (such as RESTful API, SOAP API, etc.) and the corresponding interface address are determined based on the configuration information. The flight query RESTful API of a certain airline is determined to be called, and the interface address is "https: / / www.xxx.com / xxx". The parameter set {"departure":"PEK","destination":"SHA","date":"2024-10-20"} is obtained. Based on the determined API type and interface address, the parameter set data is sent to the first API interface. In this embodiment, the first API interface can be an external API interface. This embodiment calls the API according to the configured API parameter configuration information to efficiently process the request.
[0054] This embodiment receives the original response data returned by the API, interacts with the external API, obtains the external data required by the system, and queries the list of flight information that meets the requirements of the airline.
[0055] Step S4: Convert the data returned by the API into a unified data format according to the field mapping relationship, and return the data in the unified data format to the client.
[0056] Convert external API data into data that can be understood and used within the system, providing effective support for the system's business functions.
[0057] like Figure 2 As shown, the embodiment of the present invention discloses a general API integrated parameter configuration system, whose structure includes:
[0058] A configuration module is used to configure the parameter configuration information of the API through the parameter configuration interface, format the parameter configuration information, and store it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API related parameters;
[0059] A matching module is used to obtain parameter configuration information from a database, receive a service call request from a front-end, match the service call request with the parameter configuration information obtained from the database, and obtain a parameter set that meets the service call request;
[0060] The docking module is used to determine the API type to be called and the corresponding interface address according to the parameter configuration information, obtain the parameter set required for the call, interact with the first API, and return the required data;
[0061] The return module is used to convert the data returned by the API into a unified data format based on the field mapping relationship, and return the data in the unified data format to the client.
[0062] By using this system, the above-mentioned calculation and processing method can be executed and the corresponding technical effects can be achieved.
[0063] The following is an example of integrating a new airline API into a general platform.
[0064] Step 1: The administrator completes the configuration of the airline API parameters through the parameter configuration interface, including:
[0065] Specify the API service address provided by the airline;
[0066] Define the parameters of flight query request, such as departure location, destination, date and time, etc.
[0067] Configure how to convert the raw data returned by the airline API into a unified data format for the system.
[0068] Step 2: The upstream microservice initiates a flight query request to the system:
[0069] Receive flight query requests from clients;
[0070] Dynamically construct airline API requests based on configuration information, including assembling request parameters and generating API call addresses;
[0071] Use an HTTP client library (such as requests) to send the constructed request to the configured airline API address.
[0072] Step 3. The system receives the original response data returned by the airline API:
[0073] The API connection module receives the raw response data from the airline API;
[0074] Convert the data returned by the airline API into a unified data format according to the configured field mapping relationship;
[0075] Perform necessary formatting on the converted data to ensure that it complies with the client's format requirements.
[0076] Step 4: The system returns the processed data to the client in a unified format.
[0077] The embodiment of the present invention also provides a representation of a UML class diagram, such as Figure 3 shown.
[0078] CoreModule: Responsible for processing requests, distributing requests to the API docking module, and processing the response data returned by the API.
[0079] ConfigurationModule: stores and manages the configuration information of the airline API, including API address, authentication information, request parameters, and return field mapping.
[0080] APIIntegrationModule: Calls the airline API according to the configuration information, processes the request and returns the original response data.
[0081] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all steps of the method in the above embodiment. The computer-readable storage medium stores a computer program that implements all steps of the method in the above embodiment when executed by a processor.
[0082] The embodiment of the present invention further provides an electronic device for executing the above method, as an implementation device of the method, whose structure is as follows: Figure 4 As shown, the electronic device 400 includes: a processor 401 and a memory 403. The processor 401 and the memory 403 are connected, such as through a bus 402. Optionally, the electronic device 400 may further include a transceiver 404. It should be noted that in actual applications, the transceiver 404 is not limited to one. It is understandable that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the specific structure of the electronic device 400. In other embodiments of the present application, the electronic device 400 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. Optionally, the electronic device may further include a display screen 405 for displaying images, or receiving user operation instructions when necessary.
[0083] The processor 401 is used in the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 404 may include a receiver and a transmitter. The transceiver 404 is used in the embodiment of the present application to implement the function of the electronic device of the embodiment of the present application communicating with other devices when executed.
[0084] Processor 401 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 401 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0085] Processor 401 may also include one or more processing units. For example, processor 401 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors. The controller may serve as the nerve center and command center of electronic device 400. The controller may generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. Processor 401 may also include memory for storing instructions and data. In some embodiments, the memory in processor 401 is a high-speed cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 401. If processor 401 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 401's latency, and thus improves system efficiency.
[0086] Processor 401 can execute the methods provided in the embodiments of the present application. Processor 401 can include different devices. For example, when a CPU and a GPU are integrated, the CPU and GPU can cooperate to execute the methods provided in the embodiments of the present application. For example, part of the algorithm in the method is executed by the CPU, and another part of the algorithm is executed by the GPU to achieve faster processing efficiency.
[0087] The bus 402 may include a path for transmitting information between the above components. The bus 402 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 402 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0088] The memory 403 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or may include a high-speed random access memory. It may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0089] Optionally, the memory 403 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 401. The processor 401 is used to execute the application code stored in the memory 403 to implement the method provided in any embodiment of the present application.
[0090] The memory 403 can be used to store computer executable program code, which includes instructions. The processor 401 executes various functional applications and data processing of the electronic device 400 by running the instructions stored in the memory 403. The memory 403 may include a program storage area and a data storage area. Among them, the program storage area can store the code of the operating system, application program, etc. The data storage area can store data created during the use of the electronic device 400 (such as images and videos collected by the camera application, etc.).
[0091] The memory 403 may also store one or more computer programs corresponding to the methods provided in the embodiments of the present application. The one or more computer programs are stored in the memory 403 and configured to be executed by the one or more processors 401. The one or more computer programs include instructions that can be used to perform the various steps in the above-mentioned corresponding embodiments.
[0092] Of course, the code of the method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 401 can run the code of the method stored in the external memory through the external memory interface, and the processor 401 can control the running process.
[0093] The display screen 405 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLED, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device 400 may include one or N display screens 405, where N is a positive integer greater than 1. The display screen 405 can be used to display information input by a user or information provided to a user, as well as various graphical user interfaces (GUIs). For example, the display screen 405 can display photos, videos, web pages, or files.
[0094] The electronic device provided in the embodiment of the present application is applicable to any embodiment of the above method. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding method provided above, and will not be repeated here.
[0095] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or boxes.
[0097] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction system that is implemented in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0098] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The present invention is described in detail below. ...
[0099] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention are intended to be covered by the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A general API integration parameter configuration method, characterized in that: include: S1 configures the parameter configuration information of the API through the parameter configuration interface, formats the parameter configuration information, and stores it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API-related parameters; S2 obtains parameter configuration information from the database, receives the front-end business call request, matches the business call request with the parameter configuration information obtained from the database, and obtains a parameter set that meets the business call request; S3 determines the API type to be called and the corresponding interface address according to the parameter configuration information, obtains the required parameter set for the call, interacts with the first API, and returns the required data; S4. Convert the data returned by the API into a unified data format based on the field mapping relationship, and return the data in the unified data format to the client.
2. The method according to claim 1, wherein The process of configuring the parameter configuration information of the API through the parameter configuration interface, formatting the parameter configuration information, and storing it in the database includes: Set a parameter configuration interface, which is used to receive input parameter configuration information of multiple APIs.
3. The method according to claim 1, wherein The formatting of the parameter configuration information includes: Convert parameter names to a unified encoding format; The validation rules are stored in a structured manner.
4. The method according to claim 1, wherein The interacting with the first API includes: Receive the original response data from the API, and send the parameter set to the first API interface according to the API type and the corresponding interface address.
5. The method according to claim 1, wherein The method further comprises: Receive business call requests, distribute the requests to backend services, and process multiple APIs at the same time.
6. The method according to claim 1, wherein The method further comprises: Automatically parse and assemble the parameters required for API calls based on parameter configuration information, dynamically adjust parameter values or add or delete parameters without recompiling code or restarting the system; When the API parameter call request changes, only the API parameter information needs to be modified in the parameter configuration interface without rewriting the compiled code or restarting the system.
7. A general API integrated parameter configuration system, characterized in that: include: A configuration module is used to configure the parameter configuration information of the API through the parameter configuration interface, format the parameter configuration information, and store it in the database. The parameter configuration information includes: parameter name, parameter type, default value, verification rules and specific API related parameters; A matching module is used to obtain parameter configuration information from a database, receive a service call request from a front-end, match the service call request with the parameter configuration information obtained from the database, and obtain a parameter set that meets the service call request; The docking module is used to determine the API type to be called and the corresponding interface address according to the parameter configuration information, obtain the parameter set required for the call, interact with the first API, and return the required data; The return module is used to convert the data returned by the API into a unified data format based on the field mapping relationship, and return the data in the unified data format to the client.
8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, which implements the method according to any one of claims 1 to 6 when executed by a processor.
9. An electronic device, characterized in that: including processor and memory; The memory is used to store program instructions; The processor is configured to execute the method according to any one of claims 1 to 6 by calling program instructions.
10. A computer program product comprising a computer program and / or instructions, characterized in that When the computer program and / or instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.