Data service application programming interface (API) provision method and related device

The method automates data service API generation by parsing metadata and registering APIs, addressing inefficiencies and security issues in existing systems, ensuring efficient and secure data service creation.

HK40135056APending Publication Date: 2026-07-17CHINA TELECOM GLOBAL LTD

Patent Information

Authority / Receiving Office
HK · HK
Patent Type
Applications
Current Assignee / Owner
CHINA TELECOM GLOBAL LTD
Filing Date
2026-06-01
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing data service application programming interfaces (APIs) suffer from low development efficiency, manual code writing, long development cycles, errors, weak security, lack of encryption, inadequate data desensitization, non-standardized documentation, and complex cross-system integration.

Method used

A method and device for automatically determining metadata information of data table fields, generating processed SQL statements, and registering data service APIs with integrated security measures, enabling zero-code data service API generation and standardized access.

Benefits of technology

Facilitates efficient, secure, and standardized data service API creation with minimal manual effort, reducing errors and enhancing data security and integration capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention provides a data service application programming interface API opening method and related equipment, and relates to the technical field of computers. The method comprises the steps of determining a target data table; analyzing a field in the target data table, and determining metadata information of the field; according to the metadata information of the field, determining output field information and input parameter information in the field, and obtaining a processing structured query language (SQL) statement; service registration information of a data service API is generated to obtain data service API configuration information, and the data service API configuration information comprises the service registration information, a processing SQL statement, the output field information, the input parameter information and an access address of the data service API; and automatically registering and generating the data service API according to the data service API configuration information.
Need to check novelty before this filing date? Find Prior Art

Description

(19) State Intellectual Property Office (12) Invention Patent Application (10) Application Publication Number (43) Application Publication Date (21) Application Number 202511337543.7 (22) Application Date 2025.09.18 (71) Applicant China Telecom International Limited Address 28 / F, Everbright Centre, 108 Gloucester Road, Wanchai, Hong Kong (72) Inventors Yang Hongbin Zheng Kerong Li You Wu Shunde Liu Jingtian (74) Patent Agency Beijing Lvzhi Intellectual Property Agency Co., Ltd. 11438 Patent Attorney Sun Baohai (51) Int.Cl. G06F 16 / 25 (2019.01) G06F 16 / 242 (2019.01) G06F 16 / 22 (2019.01) (54) Invention Title Data Service Application Programming Interface (API) Opening Method and Related Device (57) Abstract This disclosure provides a data service application programming interface (API) opening method and related device, which relates to the field of computer technology. The method includes: determining a target data table; parsing the fields in the target data table to determine the metadata information of the fields; determining the output field information and input parameter information in the fields based on the metadata information, and obtaining a processed Structured Query Language (SQL) statement; generating service registration information for a data service API to obtain data service API configuration information, the data service API configuration information including the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; and automatically registering and generating the data service API based on the data service API configuration information. Claims 3 pages, Description 18 pages, Drawings 12 pages, CN 121255897 A 2026.01.02 CN 1 21 25 58 97 A 1. A method for opening a data service application programming interface (API), characterized in that it includes: determining a target data table; parsing the fields in the target data table to determine the metadata information of the fields; determining the output field information and input parameter information in the fields based on the metadata information of the fields, and obtaining a processed structured query language (SQL) statement; generating service registration information for the data service API to obtain data service API configuration information, wherein the data service API configuration information includes the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; automatically registering and generating the data service API based on the data service API configuration information. 2. The method according to claim 1, characterized in that determining the target data table includes: displaying a mode selection control on a visual interface; responding to the selection operation of the mode selection control and determining that a table mode is adopted;In the table mode, in response to the selection operation of the target table name, the target data table corresponding to the target table name is determined. 3. The method according to claim 2, characterized in that parsing the fields in the target data table to determine the metadata information of the fields includes: in the table mode, connecting to the target data source corresponding to the target table name to obtain the metadata information of the fields of the target data table; wherein, based on the metadata information of the fields, determining the output field information and input parameter information in the fields, and obtaining the processed Structured Query Language (SQL) statement, includes: parsing the metadata information, determining the output field information and input parameter information therein, and automatically generating the basic SQL statement; in response to the editing operation of the basic SQL statement, generating the processed SQL statement. 4. The method according to claim 1, characterized in that determining the target data table includes: displaying a mode selection control on the visual interface; in response to the selection operation of the mode selection control, determining that the SQL mode is adopted; obtaining the SQL statement input in the SQL mode; parsing the SQL statement into an Abstract Syntax Tree (AST); traversing the AST to obtain the target table name, output fields, and input parameters in the SQL statement, and determining the corresponding target data table based on the target table name. 5. The method according to claim 4, characterized in that, determining the output field information and input parameter information in the field based on the metadata information of the field, and obtaining the processed Structured Query Language (SQL) statement, includes: combining the AST context and the metadata database to infer the data type of the output field and input parameters, determining the data type of the output field and input parameters, wherein the output field information includes the data type of the output field, and the input parameter information includes the data type of the input parameter; obtaining the processed SQL statement based on the SQL statement. 6. The method according to claim 5, characterized in that, obtaining the processed SQL statement based on the SQL statement includes: rewriting the SQL statement to desensitize the output fields and / or input parameters to be desensitized in the SQL statement, thereby obtaining the processed SQL statement. Claims 1 / 3 Page 2 CN 121255897 A 7. The method according to claim 1, characterized in that, determining the input parameter information in the field based on the metadata information of the field includes: automatically executing sampling SQL for the field; determining whether the corresponding field is an input parameter for the sampled data; if the corresponding field is an input parameter, marking the field as a recommended input parameter and attaching its sampled example value; displaying a list of input parameters containing fields marked as recommended input parameters; and determining the input parameter information in the field in response to add, delete, or modify operations on the list of input parameters.8. The method according to claim 7, characterized in that, for the sampled data, determining whether the corresponding field is an input parameter includes at least one of the following: If the field is an integer or a string, and the number of deduplicated sampled data is less than or equal to a preset value, then it is determined to be an enumerated field, and the field is marked as a recommended input parameter; If the data type of the field is date / time, timestamp, or the field name includes time or date, then the field is marked as a recommended input parameter; If the field name contains an identifier, key, or code and is unique, then the field is marked as a recommended input parameter. 9. The method according to claim 1, wherein the output field information and the input parameter information include field description information; wherein determining the output field information and input parameter information in the field includes: for a parsed field lacking description information, using its table name and field name as a union, querying in a metadata knowledge base, wherein the metadata knowledge base stores description information of data tables and fields, and constructing a mapping between data source, data table, field, and description information; if a historical record of the description information of the corresponding field is found in the metadata knowledge base, then the description information of the field is returned; if a historical record of the description information of the corresponding field is not found in the metadata knowledge base, then a first prompt word is automatically constructed to call the description information generation model to generate the description information of the corresponding field; and the description information of the field returned by the description information generation model is automatically written back to the metadata knowledge base. 10. The method according to claim 1, characterized in that generating service registration information of the data service API to obtain data service API configuration information includes: automatically constructing a second prompt word based on the target table name, description information and main fields of the target data table; using the second prompt word to call the service information generation model to generate the service registration information, the service registration information including the service name and service description of the data service API; filling the generated service registration information into a form; and responding to modifications to the form to obtain data service API configuration information. 11. The method according to claim 1, characterized in that it further includes: in response to a publishing operation, writing the data service API configuration information into a registration center; and calling a graph relationship service to construct a graph relationship between the data service API and the target data table based on a graph database. 12. The method according to claim 11, characterized in that it further includes: when it is detected that no data is returned when calling the data service API, querying the target data table that the data service API depends on in the graph database; and checking whether the data extraction of the target data table is successful in a data warehouse or scheduling platform. Claims 2 / 3 Page 3 CN 121255897 A 13. The method according to claim 11, characterized in that it further includes:When registering the data service API, after selecting the target data table, the security level of the target data table is automatically queried in the graph database or target data source; when the data service API is published, the security level of the target data table is automatically set to the default security level of the data service API. 14. The method according to claim 11, further comprising: receiving a call request to the data service API; extracting the call parameters from the call request; replacing the variable placeholders in the processing SQL statement in the data service API configuration information with the call parameters to perform a dynamic query and obtain a response result. 15. A data service application programming interface (API) opening device, characterized in that it comprises: a response unit, configured to determine a target data table; a processing unit, configured to parse fields in the target data table and determine the metadata information of the fields; the processing unit is further configured to determine output field information and input parameter information in the fields based on the metadata information of the fields, and obtain a processed structured query language (SQL) statement; the processing unit is further configured to generate service registration information for the data service API to obtain data service API configuration information, the data service API configuration information including the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; and a registration unit, configured to automatically register and generate the data service API based on the data service API configuration information. 16. An electronic device, characterized in that it comprises: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of any one of claims 1 to 14 by executing the executable instructions. 17. A computer-readable storage medium storing a computer program thereon, characterized in that the computer program, when executed by a processor, implements the method of any one of claims 1 to 14. 18. A computer program product comprising a computer program that, when run, executes the method described in any one of claims 1 to 14. Claims 3 / 3 Page 4 CN 121255897 A Data Service Application Programming Interface (API) Opening Method and Related Devices Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to a data service application programming interface (API) opening method and related devices. Background Art

[0002] Data opening schemes in related technologies have the following problems: low development efficiency, requiring manual code writing to generate APIs (Application Programming Interfaces), and long development cycles (usually 2-3 days).Furthermore, it is prone to errors; its security capabilities are weak, data transmission lacks encryption, sensitive fields are not desensitized, and there is a risk of data leakage; standardization is insufficient, interface documentation is missing or chaotic, and cross-system integration is highly complex.

[0003] This disclosure provides a method for opening a data service application programming interface (API), which includes: determining a target data table; parsing fields in the target data table to determine the metadata information of the fields; determining output field information and input parameter information in the fields based on the metadata information, and obtaining a processed structured query language (SQL) statement; generating service registration information for the data service API to obtain data service API configuration information, wherein the data service API configuration information includes the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; and automatically registering and generating the data service API based on the data service API configuration information. In an exemplary embodiment, this method can be executed by an electronic device, or by a device (e.g., a chip) configured in an electronic device.

[0004] This disclosure provides a data service application programming interface (API) opening device, which includes: a response unit for determining a target data table; a processing unit for parsing fields in the target data table to determine the metadata information of the fields; the processing unit is further configured to determine output field information and input parameter information in the fields based on the metadata information of the fields, and obtain a processed structured query language (SQL) statement; the processing unit is further configured to generate service registration information for the data service API to obtain data service API configuration information, the data service API configuration information including the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; and a registration unit for automatically registering and generating the data service API based on the data service API configuration information.

[0005] This disclosure provides a data service application programming interface (API) opening device. In one design, the device may include modules that execute the methods / operations / steps / actions described in any embodiment of this disclosure. The modules may be hardware circuits, software, or a combination of hardware circuits and software.

[0006] This disclosure provides a data service application programming interface (API) open device, including a processor. The processor can implement the methods in any embodiment of this disclosure. Optionally, the communication device further includes a memory, and the processor is coupled to the memory and can be used to execute a computer program in the memory to implement the methods in any embodiment of this disclosure. Optionally, the communication device further includes a communication interface, and the processor is coupled to the communication interface. In this disclosure embodiment, the communication...The communication interface can be a transceiver, pin, circuit, bus, module, or other type of communication interface, without limitation.

[0007] In one implementation, the device is a terminal. When the device is a terminal, the communication interface can be a transceiver, or an input / output interface.

[0008] In another implementation, the device is a chip configured in the terminal. When the device is a chip configured in the terminal, the communication interface can be an input / output interface.

[0009] In one implementation, the device is a server. When the device is a server, the communication interface can be a transceiver, or an input / output interface.

[0010] In another implementation, the device is a chip configured in the server. When the device is a chip configured in the server, the communication interface can be an input / output interface.

[0011] Optionally, the transceiver can be a transceiver circuit. Optionally, the input / output interface can be an input / output circuit.

[0012] This disclosure also provides a processor, including: an input circuit, an output circuit, and a processing circuit. The processing circuit is used to receive signals through the input circuit and transmit signals through the output circuit, causing the processor to execute the method in any embodiment of this disclosure.

[0013] In an exemplary embodiment, the processor may be one or more chips, the input circuit may be an input pin, the output circuit may be an output pin, and the processing circuit may be a transistor, a gate circuit, a flip-flop, and various logic circuits, etc. The input signal received by the input circuit may be received and input by, for example, but not limited to, a receiver, and the signal output by the output circuit may be output to, for example, but not limited to, a transmitter and transmitted by the transmitter. The input circuit and the output circuit may be the same circuit, which is used as the input circuit and the output circuit at different times, respectively. This disclosure does not limit the specific implementation of the processor and various circuits.

[0014] This disclosure provides an electronic device, which includes: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the data service application programming interface (API) open method in any embodiment of this disclosure by executing the executable instructions.

[0015] This disclosure provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the data service application programming interface (API) opening method of any embodiment of this disclosure.

[0016] This disclosure provides a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the data service application programming interface (API) opening method of any embodiment of this disclosure.

[0017] Brief Description of the DrawingsThe accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0018] FIG1 shows a schematic diagram of an exemplary system architecture to which the methods or apparatus of the embodiments of this disclosure can be applied.

[0019] FIG2 shows a flowchart of a data service application programming interface (API) opening method according to an embodiment of this disclosure.

[0020] FIG3 shows a schematic diagram of another exemplary system architecture to which the methods or apparatus of the embodiments of this disclosure can be applied.

[0021] FIG4 shows a schematic diagram of automatically registering and generating APIs according to configuration according to an embodiment of this disclosure.

[0022] FIG5 shows a schematic diagram of service development and listing according to an embodiment of this disclosure.

[0023] FIG6 shows a schematic diagram of service subscription invocation according to an embodiment of this disclosure. Specification 2 / 18 pages 6 CN 121255897 A

[0024] FIG7 shows a schematic diagram of service operation management according to an embodiment of this disclosure.

[0025] Figure 8 shows a schematic diagram of API service testing and alarm in an embodiment of this disclosure.

[0026] Figure 9 shows a schematic diagram of service circuit breaking and alarm in an embodiment of this disclosure.

[0027] Figure 10 shows a schematic diagram of another service circuit breaking and alarm in an embodiment of this disclosure.

[0028] Figure 11 shows a schematic diagram of exception handling and security protection in an embodiment of this disclosure.

[0029] Figure 12 shows a schematic diagram of service call monitoring in an embodiment of this disclosure.

[0030] Figure 13 shows a schematic diagram of a message in an embodiment of this disclosure.

[0031] Figure 14 shows a schematic diagram of data persistence in an embodiment of this disclosure.

[0032] Figure 15 shows a schematic diagram of the entire process of service generation and invocation in an embodiment of this disclosure.

[0033] Figure 16 shows a schematic diagram of intelligent parsing of Chinese information of table names and field names in data in an embodiment of this disclosure.

[0034] Figure 17 shows a schematic diagram of a data service opening business process in an embodiment of this disclosure.

[0035] Figure 18 shows a schematic diagram of a security protection and access control process in an embodiment of this disclosure.

[0036] Figure 19 shows a schematic diagram of a data service opening technology process according to an embodiment of the present disclosure.

[0037] Figure 20 shows a schematic diagram of a data service application programming interface (API) opening device according to an embodiment of the present disclosure.

[0038] Figure 21 shows a structural block diagram of an electronic device according to an embodiment of the present disclosure. Detailed Description

[0039] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms.The embodiments described herein are intended to be implemented in a manner that is not intended to limit the scope of the examples set forth herein; rather, these embodiments are provided to make the disclosure more comprehensive and complete and to fully convey the concept of exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0040] Furthermore, the accompanying drawings are merely illustrative of the present disclosure, and the same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0041] In this disclosure, at least one item may be described as one item or more items, and more than one item may be two, three, four, or more items, without limitation. The slash " / " can indicate an "or" relationship between related objects; for example, A / B can mean A or B. "And / or" can be used to describe three possible relationships between related objects; for example, A and / or B can represent three possibilities: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. To facilitate the description of the technical solutions disclosed herein, terms such as "first," "second," "A," or "B" can be used to distinguish technical features with the same or similar functions. These terms do not limit the quantity or execution order. Furthermore, these terms do not necessarily imply differences. The words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any design described as "exemplary" or "for example" should not be construed as superior or more advantageous than other design solutions. The use of "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0042] As shown in FIG1, the system architecture 100 may include one or more of terminal devices 101, 102, and 103, network specification 3 / 18 page 7 CN 121255897 A 104 and server 105. Network 104 is used as a medium to provide a communication link between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links or fiber optic cables, etc.

[0043] It should be understood that the number of terminal devices, networks and servers in FIG1 is merely illustrative. Depending on the implementation needs, there can be any number of terminal devices, networks and servers. For example, server 105 may be a server cluster composed of multiple servers, etc.

[0044] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with displays and supporting web browsing, including but not limited to smartphones, tablets, laptops, desktop computers, wearable devices, virtual reality devices, smart home devices, etc.

[0045] Server 105 can be a server that provides various services. For example, terminal device 103 (or terminal device 101 or 102) determines a target data table from server 105. Server 105 can send an automatically registered data service API to terminal device 103. Then, terminal device 103 can display the received data service API.

[0046] This disclosure belongs to the field of IT (Information Technology) and software development technology.

[0047] The opening of intelligent data services is intended to address the problems encountered in the process of opening data from various environmental data sources, such as:

[0048] 1. Diverse data sources: various applications need to quickly access multiple data sources, including databases, Web (network) APIs, etc., with minimal or zero code to meet diverse data needs.

[0049] 2. Developers write code to encapsulate API interfaces for querying data from databases and tables, which is time-consuming, has a high error rate, low development efficiency, and takes a long time to troubleshoot.

[0050] 3. The flexibility and scalability of data services are required: users need to select the data they need according to their own needs, without having to obtain the entire dataset. It is necessary to meet the new and personalized requirements of agile support for data services, and improve the efficiency of data service support through a platform that is "zero" code, easy to operate, easy to read, and easy to maintain.

[0051] 4. The data service standards of various applications are not uniform, and it is necessary to formulate standardized specifications and achieve unified and standardized access to data services through online registration and templated service registration.

[0052] 5. Inadequate monitoring of data service interfaces, lack of monitoring of data service API call process; untimely data service anomaly alarms, poor perception of data service calls by front-end applications.

[0053] 6. Data security requirements: When providing data services through APIs, corresponding security measures will be taken, such as authentication and data encryption, to ensure the security of data during transmission and storage.

[0054] The solution provided in this disclosure, through deep integration and zero-code automated generation, solves one or more of the above-mentioned technical problems.

[0055] This disclosure provides an intelligent encapsulation of open data service APIs, which can be used to quickly access various data sources, including databases, Web APIs, etc., with minimal or zero code access. Specifically, through metadata parsing technology, combined with industry...The service scenario performs correlation analysis on the target database table (e.g., the target data table), uses a distributed framework, and automatically analyzes the basic information configuration, parameter configuration, and release configuration of the service to intelligently encapsulate the database table data of the data platform into a data service API for external sharing. This forms valuable information value-added, meets the needs of internal management decisions and production and operation activities, and provides data products and information services to customers for selection and use.

[0056] Under the provided system architecture, the embodiments of this disclosure provide a data service application programming interface (API) opening method, which can be executed by any electronic device with information processing capabilities. In some embodiments, the data service application programming interface (API) opening method provided in the embodiments of this disclosure can be executed by the terminal device of the above system architecture; in other embodiments, the data service application programming interface (API) opening method provided in the embodiments of this disclosure can be implemented by the server in the above system architecture. In still other embodiments, the data service application programming interface (API) opening method provided in the embodiments of this disclosure can be implemented by the terminal device and the server in the above system architecture through interaction.

[0057] The method shown in Figure 2 is a method for intelligently encapsulating data service API opening.

[0058] The data service API in this disclosure embodiment, also known as API, data API, service, API service, API interface, etc., is a data interface based on RESTful architecture, which allows efficient, secure, and convenient data interaction between applications, systems, and services. It enables different applications to interact efficiently, saves a lot of manpower and material resources in data transmission and processing, and helps developers focus more time and energy on their core business.

[0059] This disclosure embodiment realizes data openness through data service API, solves the "last mile" problem from data warehouse (i.e., data warehouse) to application, and quickly generates data API from data tables in the data source (e.g., target data table in the target data source), realizing low-cost, easy-to-operate, secure, and stable data sharing and openness.

[0060] For example, HTTP (Hypertext Transfer Protocol) can be used for API communication, but this disclosure is not limited to this.

[0061] As shown in FIG2, the method provided in this disclosure embodiment may include the following steps.

[0062] In S210, the target data table is determined.

[0063] In this embodiment of the disclosure, a target data table refers to one or more data tables in which at least a portion of the data is to be made available for public viewing.

[0064] Exemplarily, determining a target data table includes: displaying a mode selection control on a visual interface; responding to a mode selection control.The selection operation of the selection control determines the use of table mode; in the table mode, in response to the selection operation of the target table name, the target data table corresponding to the target table name is determined.

[0065] For example, parsing the fields in the target data table to determine the metadata information of the fields includes: in the table mode, connecting to the target data source corresponding to the target table name to obtain the metadata information of the fields of the target data table. Specifically, based on the metadata information of the fields, determining the output field information and input parameter information in the fields, and obtaining the processed Structured Query Language (SQL) statement includes: parsing the metadata information, determining the output field information and input parameter information therein, and automatically generating a basic SQL statement; in response to the editing operation of the basic SQL statement, generating the processed SQL statement.

[0066] For example, determining the target data table includes: displaying a mode selection control on a visual interface; responding to a selection operation on the mode selection control and determining that an SQL mode is used; obtaining the SQL statement input in the SQL mode; parsing the SQL statement into an Abstract Syntax Tree (AST); traversing the AST to obtain the target table name, output fields, and input parameters in the SQL statement, and determining the corresponding target data table based on the target table name.

[0067] For example, determining the output field information and input parameter information in the field based on the metadata information of the field, and obtaining the processed Structured Query Language (SQL) statement includes: combining the AST context and the metadata database to infer the data type of the output field and input parameters, determining the data type of the output field and input parameters, wherein the output field information includes the data type of the output field, and the input parameter information includes the data type of the input parameter; obtaining the processed SQL statement based on the SQL statement.

[0068] For example, obtaining the processed SQL statement based on the SQL statement includes: rewriting the SQL statement to desensitize the output fields and / or input parameters to be desensitized in the SQL statement, thereby obtaining the processed SQL statement. Specification 5 / 18 page 9 CN 121255897 A

[0069] In S220, the fields in the target data table are parsed to determine the metadata information of the fields.

[0070] In S230, the output field information and input parameter information in the fields are determined according to the metadata information of the fields, and the processed structured query language SQL statement is obtained.

[0071] For example, determining the input parameter information in the fields according to the metadata information of the fields includes: automatically executing the sampled SQL for the fields; determining whether the corresponding fields are input parameters for the sampled data; if they are input parameters, the corresponding fields are determined to be input parameters.If the corresponding field is an input parameter, then the field is marked as a recommended input parameter, and its sampled example value is attached; a list of input parameters containing fields marked as recommended input parameters is displayed; in response to the addition, deletion and modification operations on the list of input parameters, the input parameter information in the field is determined.

[0072] For example, for the sampled data, determining whether the corresponding field is an input parameter includes at least one of the following:

[0073] If the field is an integer or a string, and the number of sampled deduplicated data is less than or equal to a preset value, then it is determined to be an enumerated field, and the field is marked as a recommended input parameter;

[0074] If the data type of the field is date and time, timestamp, or the field name of the field includes time or date, then the field is marked as a recommended input parameter;

[0075] If the field name of the field contains an identifier, key, or code and is unique, then the field is marked as a recommended input parameter.

[0076] For example, the output field information and the input parameter information include the field description information; wherein, determining the output field information and input parameter information in the field includes: for the parsed field lacking description information, querying the metadata knowledge base using its table name and field name as a union, the metadata knowledge base storing the description information of data tables and fields, constructing a mapping between data source, data table, field and description information; if a historical record of the description information of the corresponding field is found in the metadata knowledge base, the description information of the field is returned; if a historical record of the description information of the corresponding field is not found in the metadata knowledge base, a first prompt word is automatically constructed to call the description information generation model to generate the description information of the corresponding field; the description information of the field returned by the description information generation model is automatically written back to the metadata knowledge base.

[0077] In S240, service registration information of the data service API is generated to obtain data service API configuration information, the data service API configuration information including the service registration information, processing SQL statement, the output field information, the input parameter information and the access address of the data service API.

[0078] For example, generating service registration information for a data service API to obtain data service API configuration information includes: automatically constructing a second prompt word based on the target table name, description information, and main fields of the target data table; using the second prompt word to call a service information generation model to generate the service registration information, the service registration information including the service name and service description of the data service API; filling the generated service registration information into a form; and responding to modifications to the form to obtain data service API configuration information.

[0079] In S250, the data service API is automatically registered and generated based on the data service API configuration information.

[0080] For example, the method provided in this embodiment further includes: responding to a publishing operation, registering the data service...API configuration information is written to the registration center; the graph relationship service is called to construct the graph relationship between the data service API and the target data table based on the graph database.

[0081] Exemplarily, the method provided in this disclosure further includes: when it is detected that no data is returned when the data service API is called, the target data table on which the data service API depends is queried in the graph database; and the data extraction of the target data table is checked in the data warehouse or scheduling platform to see if it is successful. Specification 6 / 18 pages 10 CN 121255897 A

[0082] Exemplarily, the method provided in this disclosure further includes: when the data service API is registered, after selecting the target data table, the security level of the target data table is automatically queried in the graph database or target data source; when the data service API is published, the security level of the target data table is automatically set to the default security level of the data service API.

[0083] Exemplarily, the method provided in this disclosure further includes: receiving a call request to the data service API; extracting call parameters from the call request; replacing variable placeholders in the processing SQL statement in the data service API configuration information with the call parameters to execute a dynamic query and obtain a response result.

[0084] Specifically, the processing SQL statement stored in the data service API configuration information contains variable placeholders. The system replaces these placeholders with the actual parameter values ​​(i.e., call parameters) passed by the API caller through the call request and executes the query securely. This process is called "dynamic query".

[0085] Exemplarily, the data service API configuration information can be obtained from the registry center, and the processing SQL statement and parameter list (e.g., including output field information and input parameter information) can be parsed out. A pre-compiled statement is created to convert the processing SQL statement in the data service API configuration information into JDBC (Java Database Connectivity) standard placeholders. Then, the parameters are set sequentially according to the call parameters passed in the API call request. Then, the system executes and returns the response result queried from the target data table, thereby fundamentally preventing SQL injection because it separates the compilation of the SQL statement structure from the passing of parameter values, improving security.

[0086] For example, dynamic queries can be implemented using MyBatis' dynamic SQL capabilities. First, the string in the SQL statement is processed and converted into MyBatis' parameter placeholder syntax. Then, a parameter Map is created, and the call parameters passed by the API caller are put into a Map. Then, MyBatis executes the query and directly returns the Map list, which can be easily converted into JSON as the response result.

[0087] In this embodiment of the disclosure, the processing SQL statement stored in the data service API configuration information is the input of the user-defined business logic. The system backend executes this SQL securely, efficiently, and dynamically, and packages it into a standard HTTP API, thereby realizing the intelligence and automation of the system.

[0088] The method provided by this embodiment of the disclosure is illustrated below with reference to the system architecture shown in Figure 3. As shown in Figure 3, this embodiment of the disclosure provides an API full lifecycle automated management solution. The system 300 adopts a microservice architecture, including a frontend 310, a backend service 320, and an underlying infrastructure 330. The frontend 310 provides a visual interface 311 for user interaction. The backend service 320 includes: a metadata parsing engine 321, an intelligent completion engine 322, an API registration and management center 322 (also known as a registration center), and a graph relationship service 324. The underlying infrastructure 330 includes a data source 331, a metadata knowledge base 332, a private large model 333 (which includes a description information generation model and a service information generation model), a graph database 334, an API gateway 336, and an OpenAPI document generator (i.e., an API document generator 335). The front-end 310 interacts with these back-end services 320 through a unified visual interface 311.

[0089] The method provided in this embodiment includes step 1. Metadata intelligent parsing, which may further include the following steps.

[0090] (1) Table structure intelligent parsing: The API encapsulation front-end interface (i.e., the visual interface 311 provided by the front-end 310) supports service registration by selecting a table (selecting a table mode) or writing SQL (selecting an SQL mode). After the back-end parsing engine (e.g., the metadata parsing engine 321) obtains the front-end configuration (e.g., the target table name passed by the front-end), it intelligently parses the table metadata structure, identifies field types, completes annotations, etc., to obtain the metadata information of the fields of the target data table, so as to facilitate users to identify API service configurations such as input parameters (short for input parameters) and output parameters (short for output parameters or output fields).

[0091] For SQL parsing, for example, SQL metadata parsing can be implemented based on an SQL parser (which can parse standard SQL into an abstract syntax tree, see page 7 / 18, CN 121255897 A (AST)) to obtain the field information of the SQL execution output (i.e., output field information), including field name, field Chinese description, field type / data type, etc., and at the same time, the SQL execution input parameters are parsed. This provides a dependency for API registration, such as: displaying a list of the input parameters and output fields of this SQL parsing, so that when registering on the page, users can quickly select the corresponding input and output parameter information of the API in the visual interface 311 to determine the output field information and input parameter information.

[0092] For metadata retrieval, the table structure (field names, types (i.e., data types), comments (i.e., descriptive information), etc.) can be obtained directly through the JDBC interface by the table name (e.g., the target table name).

[0093] For example, the user selects "table mode" or "SQL mode" in the visualization interface 311 of the front end 310. The backend metadata parsing engine 321 receives the target table name or the input SQL statement.

[0094] For table mode, the metadata parsing engine 321 directly uses JDBC to connect to the target data source in the data source 331 and obtains the metadata information of all fields of the specified target data table through the connection.getMetaData().getColumns(...) method. For example, in the database context, the definition information about the table structure is queried from the data dictionary or system directory of the database system.

[0095] The metadata information in this embodiment is a structured collection of information describing the data itself, which can be divided into basic information, constraint and key information, and extended information.

[0096] The basic information describes the most basic attributes of the field and is the basis for generating the API output parameter list (i.e., the output field list or output parameter list, which contains output field information). Basic information includes, but is not limited to: field name / field name, i.e., the physical name of the field in the database, such as user_id, username; data type, i.e., the type defined in the database, which is key to determining the API parameter type (e.g., integer, string, date); length / precision; whether nullable is allowed, indicating whether the field is allowed to store NULL values, which can be used for API validation (determining whether input parameters are required); and the field's default value. Basic information can be used for API output / input parameter type validation, length limits, and mandatory field validation.

[0097] The constraint and key information can be used for intelligent recommendation and logical judgment. This information describes the relationship and constraints of the field in the table. Constraint and key information includes, but is not limited to, primary key, foreign key, unique constraint, and auto-increment. The primary key indicates whether the field is the primary key of the table. The primary key field can be automatically recommended as an API input parameter. The foreign key indicates whether the field references the primary key of another table. This helps in building data graphs. For example, knowing that the user_id field in the order table references the id in the user table allows for the establishment of relationships between APIs and services, and between tables. A unique constraint indicates whether the value of this field must be unique (but not a primary key). An auto-incrementing constraint indicates whether the value of this field is automatically generated by the database (usually a primary key). These types of fields are typically not used as input parameters for APIs (because users should not provide them), but they are always output parameters. Constraint and key information can be used for intelligently recommending input parameters (such as automatically using the primary key as a query condition), building data graphs, etc.

[0098] Among them, extended and semantic information can be used to improve readability and intelligence. This information provides business context for fields and is the basis for intelligent completion and generation of understandable API documentation. Among them, extended and semantic information includes, but is not limited to, field comments, ordinal positions, etc. Field comments (i.e., field description information) are important semantic information. The business meaning of the field is described in natural language. For example, the comment for the field status may be "User status: 0-inactive, 1-normal, 2-frozen". The system will give priority to using this comment as the "Chinese description" or "meaning" of the API output parameter. Ordinal position identifies the creation sequence number of the field in the table. Extended and semantic information can be used to complete the Chinese description of API output or input parameters, generate readable API documentation, etc.

[0099] After the system obtains this metadata information, it can provide a solid data foundation for subsequent intelligent parsing, automatic template filling and graph construction, thereby achieving the goals of "zero coding" and "intelligence".

[0100] In SQL mode, syntax parsing is performed first to parse the SQL statement entered by the user into AST. Then, the query field is parsed, and the SELECT part in the AST is traversed to parse out all output columns. For SELECT*, the table in the FROM sub-manual page 8 / 18, 12 CN 121255897 A sentence can be used to obtain all fields and then expand them. Then, the parameter is parsed, and the WHERE clause, HAVING clause, etc. in the AST are traversed to extract all placeholders or variables in the expression, which are the input parameters. Then, the type inference is performed. The data type of the output field and the input parameter can be inferred by combining the AST context and the metadata database. For example, WHERE id = ?, if the id field is of type bigint, then it can be inferred that the type of the input parameter ? should also be bigint.

[0101] Exemplarily, the backend service encapsulates the parsed output field list (e.g., field name, type, original comment) and input parameter list (e.g., name, inferred type) into JSON (JavaScript Object Notation) and returns it to the frontend, and displays it on the visualization interface.

[0102] The embodiments of this disclosure also provide intelligent completion function. When registering via API using a table selection method or SQL parsing mode, if the Chinese description information of the output table fields is incomplete, the intelligent completion engine 322 completes the Chinese description information based on the system metadata knowledge base 332 and a large model approach (e.g., a description information generation model). For example, the intelligent completion engine 322 prioritizes matching the metadata knowledge base 332; if the metadata knowledge base 332 cannot satisfy the requirement, it automatically calls the description information from the private large model 333.The information generation model performs intelligent completion to provide understandable Chinese descriptions for user registration.

[0103] For example, the metadata knowledge base can be built using Elasticsearch or a relational database (such as MySQL). It is used to store Chinese description information of all tables and fields in history, establishing a mapping between data source, table, field, and description. For each field that is parsed and lacks a Chinese description, its table name and field name are used as a composite key to perform a fuzzy or precise query in the metadata knowledge base 332. If a historical record is found, the completed description is returned directly. If it is not found in the metadata knowledge base 332, a first prompt word is automatically constructed to call the description information generation model.

[0104] An example of the first prompt word is as follows:

[0105] “text

[0106] You are a senior database administrator. Please generate an accurate and concise Chinese business description based on the [table name] and [field name].

[0107] Requirements: The description must be based on common business scenarios and be within 10-15 characters in length.

[0108] [Table name]: t_user_order

[0109] [Field name]: status

[0110] [Field type]: int

[0111] [Field example value]: [0,1,2,9]”.

[0112] For example, the result returned by the description information generation model (after review) can be automatically written back to the metadata knowledge base 332 to realize the continuous updating of the knowledge base.

[0113] For example, this embodiment of the disclosure also provides an intelligent adaptation function to realize the automatic recommendation of input parameters. After the backend metadata parsing engine 321 parses and obtains the table fields, the intelligent adaptation engine (not shown in the figure) determines whether it can be returned to the visual interface as an API input parameter for configuration through the field type and data sample mode, so as to facilitate users to quickly identify and register. For example, when the field type is int (integer type), and the data is 0, 1, 9... etc. with many repeated values, and the number of data does not exceed 5, then the task is a certain type of data, and the system automatically returns this field as an API input parameter to the input parameter list of the front-end registration page for users to quickly select.

[0114] Specifically, data sampling is performed first. For each parsed field, a sampling SQL is automatically executed. A series of rules are applied to the sampled data:

[0115] Rule 1 (enumeration field): If the field is an integer (TINYINT, INT) or a string (VARCHAR), and the number of sampled duplicate data is <= 10, then it is determined to be an enumeration field and recommended as an input parameter. Instruction manual 9 / 18 page 13 CN 121255897 A

[0116] Rule 2 (Time field): If the field type is DATETIME (date and time), TIMESTAMP (time stamp) orIf the field name contains time / date, it is recommended as an input parameter (commonly used for range queries).

[0117] Rule 3 (Identification Field): If the field name contains id (identifier) / key (key) / code (encoding) and is unique, it is recommended as an input parameter.

[0118] The backend service returns the recommendation results to the frontend, marking the fields that meet the rules as "recommended input parameters", and attaching the sampled example values ​​(such as [0,1,2]) to the frontend, which are then highlighted on the interface.

[0119] For example, this disclosure also provides an automatic API service template: the API registration template is automatically filled based on the above-mentioned intelligent parsing output, specifically including but not limited to:

[0120] Input parameter configuration: based on the parsed input parameter information list, including input parameter code, input parameter meaning, value / example, hierarchical control, etc., which can be manually added or removed;

[0121] Output parameter configuration: based on the parsed SQL output table field information, the parameter list is automatically displayed, including output parameter code, output parameter meaning, value / example, security level, etc., which can be manually added or removed;

[0122] Service registration information: based on the obtained table name and description information, the service name and service description of the API service registration are automatically completed by calling a private big model (e.g., a service information generation model), which can be modified by the user.

[0123] For input / output parameter configuration, the front end displays the parsed input and output parameter lists in the form of an editable table. Each record includes: parameter code (corresponding field name), parameter meaning (result of intelligent completion), value / example (sample of intelligent adaptation sampling or manual filling), hierarchical control (drop-down selection, such as "public", "internal", "confidential"), whether it is required, parameter type, etc. Users can add, delete, and modify this table.

[0124] For example, this disclosure embodiment also provides a service registration information completion function. For example, the following second prompt word can be generated:

[0125] “text

[0126] You are an API interface naming expert. Please generate a clear, RESTful service name and a service description based on the following database table information.

[0127]

Table Name

[0128]

Table Chinese Description

[0129]

Main Fields

[0130] Service Name Requirements: Use camelCase, such as: getUserOrderById

[0131] Service Description Requirements: Within 50 characters, describing the core function of the interface.

[0132] Please output in JSON format: {"serviceName":"...","serviceDescription":"..."}”

[0133] The front end automatically fills the generated results into the form, which the user can then modify to determine the data service API configuration information.

[0134] For example, a graph relationship between the API service and the target data table involved can also be constructed based on a graph database to provide data for overall system operation monitoring and security level inheritance.

[0135] For example, it can be used for anomaly analysis. When an API service is published, if the caller accesses the interface but there is no data, the graph relationship between the API and the table can be used to trace back whether the data of this table was collected on time.

[0136] For example, it can be used for security integration. When an API registration selects a table, the API automatically inherits the security level of this table, which is used by the API service registration to determine the security level of this interface.

[0137] Specifically, the relationship between "data table" - "depended on by API" - "API service" is first constructed. When a user completes API registration and clicks the "Publish" button on the visualization interface, the system not only writes the data service API configuration information into the registration file (see page 10 / 18 of the manual, CN 121255897 A), but also calls the graph relationship service 324 to write the following information into the graph database 334: Create an API node with attributes including apiName, apiId, and url (API access address). Create or find an existing Table node. Create a DEPENDS_ON relationship between the API node and the Table node. For example, Field nodes can also be created for important input / output parameters, and INPUT / OUTPUT relationships can be established with the API node. For instance, when monitoring finds that API_A returns no data, a query is performed in the graph database to find the dependent table T_USER, and then the data warehouse or scheduling platform can be checked to see if the most recent data extraction from the T_USER table was successful. For example, when registering an API, after the user selects table T_SECRET, the background automatically queries the security level of the table in the graph database or data source 331. When the API is published, this level is automatically set as the default security level of the API, realizing the inheritance of security levels.

[0138] Exemplarily, the method provided in this embodiment of the disclosure further includes step 2. Automatic registration and generation of API interfaces, which may further include the following steps.

[0139] (1) Automatically register and generate APIs according to configuration.

[0140] Exemplarily, the data service API configuration information is written into the microservice registry center, including the processing SQL statements, input parameters, output parameters, and access address information involved in the API. Exemplarily, the complete configuration of the API (including processing SQL, input parameter list, output parameter list, access address, etc.) is published as a configuration file to the specified namespace of the registry center.

[0141] The SQL statement in the configuration is a SQL statement that the user writes or selects to generate through the front-end interface. The user can directly enter a query SQL in the code editor of the front-end interface. This SQL will be completely saved and become part of the API configuration. Alternatively, it can be generated by selecting a table (table schema). The user selects a table (such as t_user), and the system may automatically generate a basic SQL according to some preset rules. The user can make secondary edits on the generated basic SQL (for example, select only certain fields, add JOIN operations, add complex WHERE conditions, etc.). The final edited version is the saved SQL.

[0142] Then, the registry center coordinates: the services in the service configuration page are automatically published as underlying microservices and provided to the front-end for invocation.

[0143] For example, a protocol adaptation template is also provided: for a specific protocol access specification, an adaptation template is extracted and developed, and the client call protocol template of the access service provider is used to automatically access the platform by configuring the service parameter interface.

[0144] For example, create a Spring Boot Starter project as a data API gateway. This Starter has a built-in protocol adaptation template (such as a RESTful Controller template). It listens to the registry configuration center. When a new API configuration is published, this general service dynamically (using Spring's RequestMappingHandlerMapping) registers a new Controller endpoint with the Web container. The processing logic of this endpoint is general: receive HTTP requests (call requests), extract parameters, execute dynamic queries via JDBC or MyBatis according to the SQL in the configuration, convert the result set into JSON / XML, and then return a response.

[0145] For example, message adaptation and conversion are also provided: message conversion includes the conversion of JSON and XML data formats, which can be implemented by writing data conversion rule scripts, or by using XSLT and Schema scripting languages.

[0146] Figure 4 shows a schematic diagram of automatically registering and generating APIs according to configuration in an embodiment of this disclosure. As shown in Figure 4, the registry center 410 can be used to implement service registration, receive configuration information (processing SQL, input / output parameters, access address, etc.) of Open Rest Service and specific services (such as service 1, service 2). The registration center 410 can be used to implement service publishing, coordinate service configuration, and automatically publish services as underlying microservices for front-end or other services to call.

[0147] Continuing to refer to Figure 4, the API gateway 336 is a unified entry point that receives external requests through an open REST interface.The Router component distributes traffic to the corresponding XXXRestService based on the request path. It can perform protocol adaptation and support access and conversion of different protocols (such as HTTP / HTTPS). Manual 11 / 18 pages 15 CN 121255897 A

[0148] XXXRestService, as a specific REST service instance (such as service 1, service 2), executes business logic (such as SQL processing, data conversion). It is called through API gateway 336 to respond to external requests. Service 1, service 2, ... are microservice instances downstream of XXXRestService, used for microservice implementation. Each service encapsulates independent business functions (such as user management, order processing). It can achieve automatic registration, writing its own configuration information (input parameters / output parameters, access address) into the registration center to achieve service discovery.

[0149] Among them, the protocol adaptation template can be used to achieve protocol standardization, develop adaptation templates for specific protocols, and standardize the access format. It can also achieve automatic access, and service providers can directly call the template to access the platform through configuration parameters (application level / service level).

[0150] The message conversion configuration can be used to implement format conversion and also for parameter verification to verify the legality of message fields and ensure data security.

[0151] The protocol adaptation / message conversion module 430 can be used for dynamic adaptation, calling the protocol adaptation template to obtain parameters and complete the protocol conversion; it can also execute JSON / XML format conversion scripts to adapt to the data format requirements of different systems.

[0152] In this embodiment of the present disclosure, API registration and discovery are performed first, the data service API is written into the registration center, the registration center coordinates service publication, and the service instance is exposed through the API gateway. When an external request is received, the API gateway routes it to XXXRestService for processing, calls the microservice, the protocol adaptation / message conversion module processes the data format, and returns the result.

[0153] Continuing to refer to Figure 3, this embodiment of the present disclosure can also use the API document generator 335 to automatically generate API description documents through the data service API configuration information and the access address generated by the API publication registration center, and display them on the portal interface, including interface address, supported formats, request methods, request parameters, return parameters, return examples, encoding instructions, call examples, and SDK downloads, etc., and supports document download.

[0154] This disclosure also provides a security protection mechanism. For example, field-level desensitization can be implemented; sensitive fields (such as user ID and mobile phone number) are replaced according to rules (e.g., u***01). For example, access control can be implemented, based on dynamic tokens and IP whitelist verification to block illegal requests.

[0155] For example, for user ID desensitization, it is achieved by rewriting the SQL at the general SQL executor level. For example, when the output parameter configuration marks that user_id needs to be desensitized, the SQL is automatically rewritten to achieve replacement.

[0156] This disclosure embodiment also provides data transmission encryption, such as using HTTPS.

[0157] For example, Spring Security or Sentinel is integrated into the API gateway layer to perform strong validation (type, range, enumeration value) on all input parameters, and configure strict QPS (Queries Per Second) and blacklist / whitelist rules, which can theoretically achieve 100% interception of illegal requests. At the same time, the API access identity and the data table permissions applied for are matched and validated in conjunction with the graph relationship.

[0158] This disclosure embodiment also provides data service anomaly warning. For example, monitoring is performed according to the warning rules, warning information of service calls is output, indicator data statistics are performed according to various statistical dimensions of the service, and a log list of each service call is recorded. This mainly includes: service call log list, abnormal service monitoring, etc.

[0159] For example, in the scenario of opening the API for business activation and signing in the resource center, it is assumed that the data platform needs to encapsulate the business activation and signing table (signing_order) into an API so that the resource center can query the signing status and user information in real time to support resource scheduling and monitoring.

[0160] Figure 5 shows a schematic diagram of service development and listing in an embodiment of this disclosure. As shown in Figure 5, the following steps are included.

[0161] Step 1. Development application: Initiate a development resource application, including data and permissions, computing resources, development tools, etc. (offline or online application).

[0162] Step 2. Application for authorization: After the security administrator approves, the authorization operation of data, resources, and tools is performed, and the developer authorization is notified on page 12 / 18 of the specification, CN 121255897 A.

[0163] Step 3. Service development: Service development is divided into service encapsulation; service access configuration; and service orchestration development.

[0164] Step 4. Service registration: Register the tested services to the registration center.

[0165] Step 5. Service Release: Fill in the release information and generate a service release work order.

[0166] Step 6. Listing Approval: Approve the release work order for listing. After approval, the listed service information is displayed in the application marketplace.

[0167] Figure 6 shows a schematic diagram of a service subscription call in an embodiment of this disclosure. As shown in Figure 6, the following steps are included.

[0168] Step 1. Service Subscription: The service user initiates a service subscription, creating a service subscription instance relationship.

[0169] Step 2. Service Approval: After the administrator approves the service subscription relationship, the user obtains the corresponding service.Call the Token (service subscription instance level) and the data encryption / decryption key sKey (user level).

[0170] Step 3. Service call initiation: The subscriber initiates the call, carrying the Token to the service call server.

[0171] Step 4. Service call (server): After identity authentication, hierarchical permission control, service routing, service call, data encryption (sKey), data assembly, etc., the data is returned to the user.

[0172] Step 5. Data decryption (client): After the caller obtains the service data, it decrypts the data using sKey.

[0173] Figure 7 shows a schematic diagram of service operation management in an embodiment of this disclosure. As shown in Figure 7, the following steps are included.

[0174] Step 1. Service listing management: The developer / provider initiates the listing, the operation manager approves the service release, and then notifies the service provider of the approval result.

[0175] Step 2. Service subscription management: For services that have been listed, the user initiates the service subscription, the operation manager reviews the subscription, and then notifies the subscriber of the approval result.

[0176] Step 3. Service Monitoring and Analysis: For successfully subscribed services, users make service calls, and operation managers perform anomaly monitoring / call statistics / usage evaluation.

[0177] Step 4. Service Delisting Management: If a service needs to be delisted based on the service evaluation results or if the provider applies for service delisting, a delisting application is first initiated, approved by the operation manager, and the approval result is notified to the service provider or user.

[0178] Figure 8 shows a schematic diagram of API service testing and alarm in an embodiment of this disclosure. As shown in Figure 8, it includes a testing module, a probing system module, and monitoring and alarms.

[0179] The testing module includes: test case management, test data management, and automated testing tools. Test case management supports OpenAPI specification import, for example: supports automatic parsing of Swagger / OpenAPI 3.0 YAML / JSON formats; automatically generates test case templates (including request parameters, response examples, and status codes). The test case design method includes: equivalence class partitioning: combined testing of required / optional parameters; boundary value analysis: testing the maximum / minimum / boundary values ​​for numerical parameters; abnormal scenarios: simulating abnormal situations such as network timeouts and service degradation.

[0180] Test data management includes:

[0181] Mock data generation: automatically generating realistic test data based on the Faker library; supporting custom data templates (such as mobile phone numbers and ID card numbers in specific formats).

[0182] Data isolation strategy: using a dedicated database instance in the test environment; using data anonymization and shadow table technology in the production environment.

[0183] Automated testing tools, for example, are integrated with Postman: command-line execution is achieved through Newman; integrated into the Jenkins build pipeline.

[0184] The testing system module includes a scheduled task scheduling center, which supports interface-level / service-level test task orchestration; dynamically adjusts the test frequency (e.g., core interfaces 1 minute / time, non-core interfaces 5 minutes / time); and an automatic retry mechanism for failed tasks (configuration of retry count and interval).

[0185] For example, the monitoring alarms include:

[0186] Error rate threshold: for example, an alarm is triggered if the error rate is >1% for 5 consecutive minutes;

[0187] Response time threshold: an alarm is triggered if P99 > 500ms;

[0188] Alarm method: multi-channel notification such as SMS / email / instant messaging.

[0189] Figure 9 shows a schematic diagram of a service circuit breaker and alarm in an embodiment of this disclosure. As shown in Figure 9, the following steps are included:

[0190] Step 1. The client requests access.

[0191] External requests (App / Web / third-party systems) access the EOP gateway via the HTTPS protocol. The gateway front-end layer completes the following:

[0192] Request verification: checking basic legality (protocol format, size limit);

[0193] Request marking: injecting a unique TraceID for end-to-end tracing.

[0194] Step 2. Gateway layer circuit breaker decision.

[0195] The gateway layer integrates a circuit breaker module (Resilience4j / Sentinel) to calculate the error rate and slow call rate of the service in real time. When the threshold is triggered, the short-circuit request directly returns a preset response.

[0196] Step 3. Downstream service call.

[0197] The gateway obtains the downstream instance address through service discovery (such as Nacos) and performs the following:

[0198] Load balancing: Round-robin / weighted selection of healthy instances;

[0199] Timeout control: Set a dual timeout mechanism;

[0200] Connection timeout: For example, 3 seconds (to prevent TCP handshake blocking);

[0201] Response timeout: For example, 10 seconds (dynamically adjusted according to SLA).

[0202] For example, the retry strategy is as follows:

[0203] resilience4j.retry:

[0204] instances:

[0205] dataServiceA:

[0206] maxAttempts:2 # Retry only once (2 calls in total)

[0207] waitDuration:500ms

[0208] retryExceptions:[TimeoutException] # Retry only after timeout.

[0209] For example, the circuit breaker status rules include:

[0210] Initial state / healthy state (Closed): Normal request forwarding, real-time error rate statistics (sliding window algorithm);

[0211] Number of consecutive erroneous requests ≥ threshold (e.g., 50 times / 10 seconds) or error rate ≥ 50% (Open): Immediately reject all requests.The system returns a preset downgraded response (e.g., JSON format error code + prompt information);

[0212] The Open state automatically enters Half-Open after 5 seconds: allowing 10% of requests to pass as a probe (e.g., 2 requests per second), and if the success rate is ≥80%, it switches back to the Closed state for monitoring and alarming.

[0213] Figure 10 shows a schematic diagram of another service circuit breaker and alarm in an embodiment of this disclosure. As shown in Figure 10, the following steps are included: after the circuit breaker is opened, the service health check script is automatically triggered; when the check passes, the circuit breaker is forcibly reset (confirmation required); when it fails, the operation and maintenance are notified to intervene.

[0214] Figure 11 shows a schematic diagram of anomaly handling and security protection in an embodiment of this disclosure. As shown in Figure 11, the embodiments of this disclosure provide the following multiple functions:

[0215] Data transmission encryption: Encryption and desensitization of open data, transmission encryption, support for multiple encryption methods such as HTTPS encryption, support for transmission based on AES / ECB / PKCS5Padding encryption algorithms, encryption of open data using national cryptographic standards, and transmission encryption.

[0216] Security protection: API access, intelligent verification to prevent database injection and malicious crawling of user data; prevention of distributed denial-of-service (DDoS), cross-site scripting (XSS), cross-request forgery (CSRF), etc., and regular vulnerability scanning and penetration testing.

[0217] Sensitive data identification: API calls pass through a data gateway, and sensitive data is identified again for the data API to prevent field changes or the inclusion (replacement, modification, etc.) of sensitive data. Sensitive data is compared with the approval record, and if a change occurs, the call returns an exception code and submits a log audit.

[0218] Call logs and auditing: including subscribers, calling systems, call times, data volume, status, etc., for security auditing. Audit information includes call volume statistics, data volume limits, traffic control, and blacklist / whitelist control.

[0219] Whitelist control: The services accessed by the data EOP platform provide a whitelist function, allowing only trusted IPs to call the service, preventing malicious calls from other applications. The service provider adds the IP address list of the data EOP platform to the service whitelist, allowing the data EOP platform to call the service.

[0220] Figure 12 shows a schematic diagram of service call monitoring in an embodiment of this disclosure. As shown in Figure 12, the following functions are provided:

[0221] API asset identification and management: By using bypass traffic probes or traffic mirroring, traffic collection of API assets is achieved to scan and identify all API assets in the environment, realizing asset management.

[0222] Traffic collection and parsing: By collecting API traffic and processing and parsing the traffic, API interaction logs are obtained, providing data for subsequent monitoring and auditing.

[0223] Behavior monitoring and auditing: Through monitoring strategies and API baselines, the API log records are continuously monitored and audited to discover risks and anomalies such as data exposure, interface vulnerability, and abnormal interface access. After discovering risks and anomalies, an automatic warning can be issued through an alarm process.

[0224] Figure 13 shows a schematic diagram of a message in an embodiment of this disclosure. Figure 13 provides an example illustration of the calling specifications and message. Among them, sKey is an encryption and decryption key (32 bits) for data transmission security, and one key (validity period) corresponds to one service subscriber; Token is the identity authentication for service calls, and one token (validity period, ciphertext string) corresponds to one service subscription relationship.

[0225] The calling specifications include:

[0226] Protocol followed: HTTP protocol, adopting a RESTful architecture design style;

[0227] Request method: using POST and GET methods;

[0228] Basic input parameters: token, timestamp (milliseconds since 1970-01-01), seqid (request sequence number, UUID), sign (signature generated by the client according to the algorithm or generated by the Java SDK);

[0229] Business input parameters: papram1, papram2;

[0230] Service response output parameters: seqid (request universal unique identifier, UUID), code (response status encoding), message (description of the call result), data (data content).

[0231] For data decryption, the encryption algorithm used supports AES / Chinese national standard symmetric encryption, and the parameter configuration uses ECB / PKCS5Padding utf-8, base64 encoding, etc. The client decrypts the data using the AES algorithm or through the Java SDK decryption function, and the key used is sKey.

[0232] Figure 14 shows a schematic diagram of data persistence in an embodiment of this disclosure. As shown in Figure 14, the KV database data storage design is as follows: the data is stored in HBase, using a large KV table; the key design consists of two parts: data area code_{business query condition key}, such as: 88771996081_C001.

[0233] The cache database storage design is as follows: Specification 15 / 18 pages 19 CN 121255897 A

[0234] Mapping relationship storage: storage service ID and KV database data area code mapping relationship (SID->data area code);

[0235] Hot data storage: for keys that are accessed frequently within a unit of time, the data is cached in the Redis hot data area (with an automatic expiration time set).

[0236] The service call data acquisition process is as follows: when the service is called, the current call is obtained by accessing the cache database mapping relationship.The data area corresponding to the service is encoded; based on the data area encoding, the corresponding condition parameters are assembled to form the KEY value of the data query (which may be fuzzy); the key value is first searched in the hot data cache. If the data is found, it is returned directly to the caller. If not, it is searched in the KV.

[0237] As shown in Figure 15, the entire process of service generation and calling includes providing a database table, then parsing the metadata of the target data table, generating the interface and SQL based on the metadata parsing, then publishing the service, and the consumer calling the issued service. If successful, the data is returned, and if it fails, monitoring and alarms are triggered.

[0238] As shown in Figure 16, the metadata data source can have multiple sources. For example, a hook can be deployed in the database, and then metadata information can be transmitted through Messaging to achieve real-time collection and analysis of metadata. The database table metadata information is parsed and encapsulated into API services in a real-time, accurate and complete manner.

[0239] Figure 17 shows a data service open business process. Data sharing is achieved through capability encapsulation. Users can achieve data sharing through self-subscription. Specific application scenarios can include the sharing of marketing data, local data and real-time data.

[0240] Figure 18 shows a schematic diagram of a security protection and access control process in an embodiment of this disclosure. As shown in Figure 18, the process may include the following steps:

[0241] In S101, an API request is received.

[0242] In S102, the token validity of the API request is verified; if valid, proceed to S104; if invalid, proceed to S103.

[0243] In S103, the request is intercepted and logged.

[0244] In S104, an IP whitelist check is performed; if the check passes, proceed to S105; if rejected, proceed to S103.

[0245] In S105, field-level desensitization is performed.

[0246] In S106, TLS encrypted transmission is performed.

[0247] In S107, server-side business processing is performed.

[0248] In S108, encrypted data is returned to the front end.

[0249] As shown in Figure 19, this disclosure uses automatic data parsing configuration to intelligently obtain the table relationships and data structures of metadata, thereby configuring and exposing the data service with one click; for user calls, multi-layer load balancing and circuit breaker algorithms are used to ensure the normal operation of the service.

[0250] The method provided by the embodiments of this disclosure, on the one hand, realizes fully automated configuration, with zero coding throughout the entire process of table structure parsing, interface registration, and service publishing. At the same time, it improves efficiency, shortening the API development cycle from 5 days to 1 hour. On the other hand, it enhances intelligence and automation, such as including intelligent metadata parsing and completion: based on the system metadata knowledge base and private large model technology, it performs deep parsing of data table structures and SQL query statements, automatically identifying field types, comments, andThe parameter structure improves the accuracy and semantic understandability of API registration, and significantly reduces the cost of manual configuration. By selecting a data table or writing SQL through a visual interface, the system automatically fills in the service template and generates a standardized API, supporting access to multiple protocols such as RESTful, realizing zero-code development of the entire process from data source to callable interface, greatly improving the efficiency of data service construction. In addition, it can also perform intelligent recommendation and adaptive configuration. The system automatically judges and recommends fields that can be used as API input / output parameters based on the field data type and data sample, supporting users to quickly select and adjust, improving the rationality and ease of use of the interface design. At the same time, by desensitizing user ID and encrypting data transmission, the illegal request interception rate is 100%, which also improves the security of data sharing.

[0251] As shown in Figure 20, the data service application programming interface API open device 2000 includes a response unit 2010, a processing unit 2020 and a registration unit 2030.

[0252] The response unit 2010 is used to determine the target data table.

[0253] The processing unit 2020 is used to parse the fields in the target data table and determine the metadata information of the fields.

[0254] The processing unit 2020 is also used to determine the output field information and input parameter information in the fields according to the metadata information of the fields, and obtain the processed structured query language (SQL) statement.

[0255] The processing unit 2020 is also used to generate service registration information for the data service API to obtain data service API configuration information, wherein the data service API configuration information includes the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API.

[0256] The registration unit 2030 is used to automatically register and generate the data service API according to the data service API configuration information.

[0257] Other contents of the embodiment of FIG20 can be referred to the other embodiments described above, and will not be repeated here.

[0258] Further, the present disclosure also provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method described in any embodiment of the present disclosure by executing the executable instructions.

[0259] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any embodiment of this disclosure.

[0260] This disclosure also provides a computer program product including a computer program that, when run, executes the methods described in any embodiment of this disclosure.

[0261] It should be noted that the above modules / units, as part of an apparatus, can be used in a set of computer-executable...The instructions are executed in the computer system.

[0262] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, which can be collectively referred to herein as a "circuit", "module", or "system".

[0263] Referring now to FIG21, a schematic diagram of the structure of an electronic device suitable for implementing embodiments of this application is shown. The electronic device shown in FIG21 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application. Referring to FIG21, the electronic device provided in the embodiments of this disclosure may include: a processor 2201, a communication interface 2202, a memory 2203, and a communication bus 2204.

[0264] Wherein the processor 2201, the communication interface 2202, and the memory 2203 communicate with each other through the communication bus 2204.

[0265] Optionally, the communication interface 2202 can be an interface of a communication module, such as the interface of a GSM (Global System for Mobile communications) module. The processor 2201 is used to execute programs. The memory 2203 is used to store programs. The program may include a computer program, which includes computer operation instructions.

[0266] The processor 2201 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present disclosure. Specification 17 / 18 pages 21 CN 121255897 A

[0267] The memory 2203 may include high-speed RAM (random access memory), and may also include non-volatile memory, such as at least one disk storage device.

[0268] Specifically, the program can be used to: determine a target data table; parse the fields in the target data table to determine the metadata information of the fields; determine the output field information and input parameter information in the fields based on the metadata information of the fields, and obtain the processed structured query language (SQL) statement; generate service registration information for the data service API to obtain data service API configuration information, the data service API configuration information including the service registration information, the processed SQL statement, the output field information, the input parameter information, and the access address of the data service API; and automatically register and generate the data service API based on the data service API configuration information.

[0269] According to one aspect of this application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the methods provided in various alternative implementations of the above embodiments.

[0270] It should be understood that any number of elements in the accompanying drawings of this disclosure is for illustrative purposes and not for limitation, and any naming is for distinction only and has no limiting meaning.

[0271] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only. Instruction Manual 18 / 18 Page 22 CN 121255897 A Figure 1 Figure 2 Instruction Manual Figure 1 / 12 Page 23 CN 121255897 A Figure 3 Figure 4 Instruction Manual Figure 2 / 12 Page 24 CN 121255897 A Figure 5 Instruction Manual Figure 3 / 12 Page 25 CN 121255897 A Figure 6 Figure 7 Instruction Manual Figure 4 / 12 Page 26 CN 121255897 A Figure 8 Figure 9 Figure 10 Instruction Manual Figure 5 / 12 Page 27 CN 121255897 A Figure 11 Figure 12 Instruction Manual Figure 6 / 12 Page 28 CN 121255897 A Figure 13 Figure 14 Figure 15 Instruction Manual Figure 7 / 12 Page 29 CN 121255897 A Figure 16 Instruction Manual Figure 8 / 12 Page 30 CN 121255897 A Figure 17 Figure 18 of CN 121255897 A, page 9 / 12, page 32, Figure 19 of CN 121255897 A, Figure 20 of CN 121255897 A, Figure 21 of CN 121255897 A, Figure 22 of CN 121255897 A, Figure 20 of CN 121255897 A, Figure 21 of CN 121255897 A, Page 34 of CN 121255897 A, Data Service Application Programming Interface (API) Provision Method and Related Device.disclosure provides a data service Application Programming Interface (API) provision method and a related device, relating to the field of computer technology. The method includes: determining a target data table; parsing fields in the target data table to determine metadata information of the fields; determining output field information and input parameter information in the fields based on the metadata information of the fields, and obtaining a processed Structured Query Language (SQL) statement; generating service registration information of a data service API to obtain data service API configuration information, wherein the data service API configuration information includes the service registration information, the processed SQL statement, the output field information, the input parameter information, and an access address of the data service API; and automatically registering and generating the data service API according to the data service API configuration information. Abstract

Claims

1. A method for opening a data service application programming interface (API), characterized in that, include: Identify the target data table; The fields in the target data table are parsed to determine the metadata information of the fields; Based on the metadata information of the field, determine the output field information and input parameter information in the field, and obtain the processed Structured Query Language (SQL) statement; Generate service registration information for the data service API to obtain data service API configuration information, which includes the service registration information, processing SQL statements, output field information, input parameter information, and access address of the data service API. The data service API is automatically registered and generated based on the data service API configuration information.

2. The method according to claim 1, characterized in that, Identify the target data table, including: Display mode selection controls in a visual interface; In response to a selection operation on the mode selection control, determine whether to use the table mode; In the table mode, in response to the selection operation of the target table name, the target data table corresponding to the target table name is determined.

3. The method according to claim 2, characterized in that, The fields in the target data table are parsed to determine the metadata information of the fields, including: In the table mode, connect to the target data source corresponding to the target table name to obtain the metadata information of the fields of the target data table; Specifically, based on the metadata information of the field, the output field information and input parameter information of the field are determined, and a processed Structured Query Language (SQL) statement is obtained, including: The metadata information is parsed to determine the output field information and input parameter information, and basic SQL statements are automatically generated. In response to the editing operation on the basic SQL statement, the processed SQL statement is generated.

4. The method according to claim 1, characterized in that, Identify the target data table, including: Display mode selection controls in a visual interface; In response to a selection operation on the mode selection control, determine whether to use the SQL mode; Obtain the SQL statement entered in the SQL mode; The SQL statement is parsed into an Abstract Syntax Tree (AST). Traverse the AST to obtain the target table name, output fields and input parameters in the SQL statement, and determine the corresponding target data table based on the target table name.

5. The method according to claim 4, characterized in that, Based on the metadata information of the field, determine the output field information and input parameter information in the field, and obtain the processed Structured Query Language (SQL) statement, including: By combining the AST context and metadata database, data type inference is performed on the output fields and input parameters to determine the data types of the output fields and input parameters. The output field information includes the data type of the output fields, and the input parameter information includes the data type of the input parameters. The processing SQL statement is obtained based on the SQL statement.

6. The method according to claim 5, characterized in that, The processing SQL statement is obtained based on the SQL statement, including: The SQL statement is rewritten to desensitize the output fields and / or input parameters to be desensitized, thus obtaining the processed SQL statement.

7. The method according to claim 1, characterized in that, Based on the metadata information of the field, determine the input parameter information in the field, including: For the aforementioned fields, the sampling SQL will be executed automatically; For the sampled data, determine whether the corresponding field is an input parameter; If the corresponding field is an input parameter, then the field is marked as a recommended input parameter, along with its sampled example value; Display a list of input parameters that include fields marked as recommended input parameters; In response to add, delete, or modify operations on the input parameter list, determine the input parameter information in the field.

8. The method according to claim 7, characterized in that, For the sampled data, determine whether the corresponding field is an input parameter, including at least one of the following: If the field is an integer or a string, and the number of duplicate data samples is less than or equal to a preset value, it is determined to be an enumerated field, and the field is marked as a recommended input parameter. If the data type of the field is date / time, timestamp, or if the field name includes time or date, then the field is marked as a recommended input parameter; If the field name contains an identifier, a key, and an encoding and is unique, then the field is marked as a recommended input parameter.

9. The method according to claim 1, characterized in that, The output field information and the input parameter information include field description information; wherein, determining the output field information and input parameter information in the field includes: For fields that lack descriptive information, the table name and field name are used as a union to query the metadata knowledge base, which stores the descriptive information of data tables and fields, and constructs a mapping between data source, data table, field and descriptive information; If a historical record of the description information for the corresponding field is found in the metadata knowledge base, the description information for that field is returned. If no historical record of the description information for the corresponding field is found in the metadata knowledge base, the first prompt word is automatically constructed and the description information generation model is invoked to generate the description information for the corresponding field. The description information of the fields returned by the description information generation model is automatically written back to the metadata knowledge base.

10. The method according to claim 1, characterized in that, Generate service registration information for the data service API to obtain data service API configuration information, including: Automatically construct a second suggestion word based on the target table name, description information, and main fields of the target data table; The service registration information is generated by using the second prompt word to invoke the service information generation model. The service registration information includes the service name and service description of the data service API. Fill in the generated service registration information into the form; Respond to changes to the form and obtain the data service API configuration information.

11. The method according to claim 1, characterized in that, Also includes: In response to the publishing operation, the data service API configuration information is written to the registry center; Call the graph relationship service to build a graph relationship between the data service API and the target data table based on the graph database.

12. The method according to claim 11, characterized in that, Also includes: When it is detected that no data is returned when the data service API is called, the target data table that the data service API depends on is queried in the graph database. Check whether the data extraction from the target data table was successful in the data warehouse or scheduling platform.

13. The method according to claim 11, characterized in that, Also includes: When registering with the data service API, after selecting the target data table, the security level of the target data table is automatically queried in the graph database or target data source; When the data service API is published, the security level of the target data table is automatically set to the default security level of the data service API.

14. The method according to claim 11, characterized in that, Also includes: Receive requests to invoke the data service API; Extract the call parameters from the call request; Replace the variable placeholders in the processing SQL statement in the data service API configuration information with the calling parameters to execute a dynamic query and obtain the response result.

15. A data service application programming interface (API) open device, characterized in that, include: The response unit is used to determine the target data table; The processing unit is used to parse the fields in the target data table and determine the metadata information of the fields; The processing unit is further configured to determine the output field information and input parameter information in the field based on the metadata information of the field, and obtain the processed Structured Query Language (SQL) statement; The processing unit is also used to generate service registration information for the data service API to obtain data service API configuration information. The data service API configuration information includes the service registration information, processing SQL statements, output field information, input parameter information, and access address of the data service API. The registration unit is used to automatically register and generate data service APIs based on the data service API configuration information.

16. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 14 by executing the executable instructions.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 14.

18. A computer program product comprising a computer program that, when run, performs the method described in any one of claims 1 to 14.