CN115309566B - Dynamic management method and system for service interface - Google Patents

Dynamic management method and system for service interface Download PDF

Info

Publication number
CN115309566B
CN115309566B CN202210952145.6A CN202210952145A CN115309566B CN 115309566 B CN115309566 B CN 115309566B CN 202210952145 A CN202210952145 A CN 202210952145A CN 115309566 B CN115309566 B CN 115309566B
Authority
CN
China
Prior art keywords
interface
service
service interface
script
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210952145.6A
Other languages
Chinese (zh)
Other versions
CN115309566A (en
Inventor
叶书能
黄保伟
徐海洋
冯龙飞
陈传龙
郑益凡
杨光辉
朱晓辉
高强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Medical Lijie Shanghai Information Technology Co ltd
Original Assignee
Medical Lijie Shanghai Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Medical Lijie Shanghai Information Technology Co ltd filed Critical Medical Lijie Shanghai Information Technology Co ltd
Priority to CN202210952145.6A priority Critical patent/CN115309566B/en
Publication of CN115309566A publication Critical patent/CN115309566A/en
Application granted granted Critical
Publication of CN115309566B publication Critical patent/CN115309566B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Abstract

The invention provides a dynamic management method and a system of a service interface, wherein the method comprises the following steps: configuring a data source of an interface through a preset visual interface based on a preset user request, and creating a script; acquiring configuration information of an interface based on a visual interface, and creating an initial service interface according to the configuration information; defining response parameters and request parameters of each script based on an initial service interface, and configuring the response parameters and the request parameters; defining an interface service to configure the accessibility of the service interface so that the caller can access the service interface through an external network; and constructing an online document, configuring a log, and debugging the service interface in a visual interface to ensure that the service interface is available, so as to obtain the service interface constructed based on the user request. The service interface can be simply and efficiently constructed based on the visual platform, programming operation is not needed additionally, repeated waste of resource cost is avoided, and the construction efficiency of the service interface is improved.

Description

Dynamic management method and system for service interface
Technical Field
The present invention relates to the field of programming interface development, and in particular, to a method and system for dynamically managing a service interface.
Background
Service interfaces, also known as "application programming interfaces," are a number of predefined functions that primarily aim to provide applications and developers with the ability to access a set of routines without having to access source code or understand the details of the internal operating mechanisms. Software that provides the functionality defined by a service interface is referred to as an implementation of this service interface. The service interface is an interface and is therefore an abstraction. The service interface herein refers to "Web service interface", such as WebApi, webService, etc., hereinafter collectively referred to as "service interface".
In the prior art, if a service interface is to be newly added, a programming method must be relied on, which results in that each service interface must be reprogrammed. And the use of each service interface is single, if the demand change occurs, a series of processes such as coding, testing, publishing, online and the like are needed to be carried out on the service interface again, so that repeated waste of a large amount of resource cost is caused.
Disclosure of Invention
In view of this, the invention provides a method and a system for dynamically managing service interfaces, and the specific scheme is as follows:
A dynamic management method of service interfaces includes the following steps:
configuring a data source of an interface through a preset visual interface based on a preset user request, and creating at least one script which can access the data source and execute related requests;
acquiring first configuration information and second configuration information of an interface based on the visual interface, wherein the first configuration information relates to a basic framework of the interface, and creating an initial service interface according to the first configuration information;
defining response parameters and request parameters of each script based on an initial service interface, and configuring the response parameters and the request parameters according to the second configuration information; defining an independent interface service to configure accessibility of a service interface, and registering the service interface into the interface service based on the second configuration information so that a preset calling party can access the service interface through an external network;
after the accessibility configuration is completed, an online document is constructed according to the second configuration information to display and describe the related information of the service interface, and a log is configured to record the processing process of the service interface;
and debugging the service interface in the visual interface to ensure that the service interface is available, and finally obtaining the service interface constructed based on the user request.
In a specific embodiment, the second configuration information includes routing information related to a URL of the service interface and request information related to an interface request mode;
selecting a script, generating a script response parameter according to a query result, and generating a request parameter of the script according to a query condition until the response parameters and the request parameters of all the scripts are obtained;
editing parameter attributes of each request parameter and response parameter, including data type, data verification rule and alias;
configuring a transmission format of response parameters and response timeout time;
and configuring a permission authentication policy of the service interface based on the second configuration information.
In one embodiment, an independent interface service is defined in a preset interface service system;
reading second configuration information, and registering the route of the service interface into a route registration module of the interface service based on the second configuration information so that a calling party can access the service interface through a URL;
after the route registration is completed, an online document of the service interface is automatically generated according to the second configuration information and registered to an interface document module of the interface service so as to display and describe related information of the service interface including an interface name, a request mode, a request parameter and a response parameter.
In a specific embodiment, the service interface is configured with multiple sets of data connection modes, and each set of data connection mode corresponds to an environment in which the service interface is located;
each set of data connection mode is integrated with all data transmission paths of the service interface in the corresponding stage;
the environment where the service interface is located comprises a development environment where the service interface is located in a development stage, a testing environment where the service interface is located in a testing stage and a production environment where the service interface is located in an actual application stage.
In a specific embodiment, the dynamic management method further includes:
calling a service interface URL to initiate a request, wherein the request is attached with request parameters required by a service interface;
the interface service receives the request and starts to record through the record log;
analyzing the URL through a route analysis module in the interface service and forwarding the URL to a preset processing function;
performing authority verification of the request through an authority authentication module in the interface service;
if the verification is not passed, directly returning to the access prohibition state and terminating the request;
if the verification is passed, the processing function selects a corresponding data source based on the configuration information, accesses the data source through the script and executes a corresponding instruction to obtain an access result, and returns the access result to the calling party; and finishing the recording of the log record and finishing the request.
In a specific embodiment, the method further comprises:
screening out data sources recorded in the record log and frequently accessed by a calling party;
analyzing whether the accessed time node of the data source meets a preset time condition or not:
if the preset time condition 1 about the access times is met, a first link is constructed on the visual interface, and a calling party can directly finish the access of the corresponding data source by clicking the first link to obtain an access result;
if the preset time condition 2 about the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, and constructing a second link on the visual interface, wherein the second link automatically completes the access to the corresponding data source according to the access frequency to obtain the access result of each time;
if the preset time condition 3 about the access duration is met, a third link is constructed on the visual interface, and the third link stores the operation data of the calling party in the service interface.
In a specific embodiment, the preset time condition 1 is that the number of times that the calling party accesses a certain data source exceeds a preset number of times within a limited time period;
the preset time condition 2 is that a calling party accesses a certain data source for a plurality of times at the same frequency within a limited time period;
The preset time condition 3 is that the calling party continuously accesses the same data source for a preset duration.
In a specific embodiment, counting the use frequencies of various script functions, and sequencing the script functions in sequence according to the order of the use frequencies from big to small;
screening out a plurality of script functions to respectively construct script templates, wherein each script template corresponds to one script function and is not matched with a data source;
one or more script templates capable of realizing the user request are selected from all script templates, and corresponding data sources are connected.
In one embodiment, items which can change parameters in a service interface are screened out based on request parameters, and adjustable items are obtained;
generating a version of historical data when parameters of one or more adjustable items are changed, and creating a backup document to backup the historical data of each version of the adjustable items;
when the calling party has the preset restoration right, any version of history data can be called from the backup document to restore the service interface so as to obtain the service interface under the version of history data.
A dynamic management system of a service interface, configured to implement a dynamic management method of a service interface according to any one of the foregoing embodiments; the dynamic management system comprises a configuration management service; the configuration management service includes:
A data source adapter module for managing various data sources;
the script analysis module is used for analyzing the script, and executing the script to perform the operation corresponding to the instruction on the data source and obtaining the corresponding execution result;
the script editor module is used as an editor for writing scripts, can perform real-time grammar detection and intelligent prompt on the written scripts, and can store script fragments in the form of keywords;
the parameter generation module is used for generating corresponding parameters and data types according to the script or the stored process;
the route configuration module is used for configuring the URL route of the service interface so as to provide the URL disclosed in the external network;
the parameter configuration module is used for configuring and managing the parameters generated by the parameter generation module, and configuring data attributes of the parameters including data types, alias mapping and data verification rules;
the interface basic information module is used for configuring and managing basic information of the service interface, including interface names, parameter types, request modes and belonging range groups;
and the import and export module is used for exporting and importing the preset configuration items in the form of files, and comprises exporting and importing the configuration of the data source in the form of files, exporting and importing the configuration of the script in the form of files and exporting and importing the configuration of the service interface in the form of files.
In a specific embodiment, the method further comprises an interface service, wherein the interface service comprises the following steps:
the route registration module is used for registering the URL route of the online service interface to the route manager according to the route information configured in the route configuration module so as to provide external access service;
the route analysis module is used for analyzing the URL requested by the calling party according to the route rule, forwarding the URL to the matched method for execution, and returning a response result to the calling party;
the log recording module is used for recording the full-link request log, the script execution log and the data audit log of the service interface;
the authority authentication module is used for controlling the access authority of the service interface, ensuring that only a calling party with corresponding authority can access the service interface, and returning 401 an unauthorized status code to a calling party without the authority;
the service gateway module is used for forwarding a service interface request, aggregating the interface, restricting the flow, fusing the service, controlling the authority, balancing the load, protecting, enhancing and controlling the access to the service interface;
the interface debugging module is used for calling the service interface on line in real time to test the usability of the service interface, so that the created service interface can be effectively and timely verified;
And the interface document module is used for automatically generating an online document of the online service interface so as to display and describe the related information of the service interface.
The beneficial effects are that: the invention provides a dynamic management method and a system for a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation and avoid repeated waste of resource cost. The programming logic in the visual platform is relatively fixed, when facing different functions or interfacing different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting different databases, and executing different operations on the connected different databases. The construction of different service interfaces can be completed based on one interface, and each service interface is not required to be reprogrammed, so that the construction efficiency of the service interfaces is improved.
Drawings
FIG. 1 is a flow chart of a dynamic management method according to an embodiment of the invention;
FIG. 2 is a diagram illustrating interactions between a user and a system in accordance with an embodiment of the present invention;
FIG. 3 is a schematic diagram of a dynamic management system module according to an embodiment of the present invention;
fig. 4 is a schematic service diagram of a part of modules in the dynamic management system according to an embodiment of the present invention.
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Reference numerals: 1-a data source adapter module; 2-a data source master-slave configuration module; 3-a service environment configuration module; 4-a script parsing module; 5-script editor module; 6-a parameter generation module; 7-a route configuration module; 8-a parameter configuration module; 9-interface basic information module; 10-importing and exporting module; 11-a route registration module; 12-a route parsing module; 13-a logging module; 14-a permission authentication module; 15-a service gateway module; 16-interface debugging module; 17-interface document module; 18-a route forwarding module.
Detailed Description
Hereinafter, various embodiments of the present disclosure will be more fully described. The present disclosure is capable of various embodiments and its modifications and variations are possible in light of the above teachings. However, it should be understood that: there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but rather the present disclosure is to be understood to cover all modifications, equivalents, and/or alternatives falling within the spirit and scope of the various embodiments of the present disclosure.
The terminology used in the various embodiments of the disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the various embodiments of the disclosure. As used herein, the singular is intended to include the plural as well, unless the context clearly indicates otherwise. Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present disclosure belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having a meaning that is identical to the meaning of the context in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in the various embodiments of the disclosure.
Example 1
The embodiment 1 of the invention discloses a dynamic management method of a service interface, wherein different databases are connected by filling corresponding parameters in a visual interface, and corresponding operations are executed on the databases, so that the construction of the service interface can be obtained, and the construction of the service interface is greatly simplified. The dynamic management method is shown in the flow chart and the diagram of the figure 1, and the specific scheme is as follows:
A dynamic management method of service interfaces includes the following steps:
101. based on a preset user request, configuring a data source of an interface through a preset visual interface, creating at least one script which can access the data source and execute related requests;
102. based on the first configuration information and the second configuration information of the interface obtained by the visual interface, the first configuration information relates to the basic architecture of the interface, and an initial service interface is created according to the first configuration information;
103. defining response parameters and request parameters of each script based on the initial service interface, and configuring the response parameters and the request parameters according to the second configuration information; defining an independent interface service to configure accessibility of the service interface, and registering the service interface into the interface service based on second configuration information so that a preset calling party can access the service interface through an external network;
104. after the accessibility configuration is completed, an online document is constructed according to the second configuration information to display and describe the related information of the service interface, and a log is configured to record the processing process of the service interface;
105. after the log is built, the service interface is debugged in the visual interface to ensure that the service interface is available, and finally the service interface built based on the user request is obtained.
The solution of this embodiment is composed of a configuration management service and an interface service, and fig. 2 provides an exemplary diagram of interactions between a user and a system. The user request involves the database required and what instructions to execute on the database. The configuration management service is used for configuring data sources, scripts and service interfaces, and the interface service is an independently operated Web service for disclosing the service interfaces to the network.
First, one or more data sources are defined, including but not limited to relational databases (MySQL, SQL Server, oracle, etc.), non-relational databases (mongo db, etc.), externally provided service interfaces (WebAPI, webservice, etc.), etc. On the data source configuration interface of the visual interface, a class of databases is selected from several data source types predefined by the program, and connection information of the databases is configured, such as IP, port, database name, database user name, database password, and the like. And (3) performing connection test on the visual interface, and completing configuration of a data source after success. By the method, the data source containing the database can be generated in advance or immediately.
Wherein, the connection of different databases can be realized by connecting data sources. For example, the connection database may be implemented by entering parameters (e.g., IP address, account, password, identification, etc.) of the database or data source to be processed in the service interface. The data source can be understood as a database connection, and the service interface is independent of the data source, but by setting corresponding parameters, the service interface and the data source have a corresponding relationship. Thus, when the data of the database a needs to be queried, the corresponding flow is as follows: the caller initiates a request- > the service interface receives the request- > provides a database a connection- > executes a script query method- > and returns a result according to the configuration matching data source- > the data source.
It is assumed that there are a plurality of data sources, each of which is a database connection, corresponding to one database.
Data Source 1- > database1- > SQLServer
Data Source 2- > database2- > MySQL
Data Source 3- > database3- > Oracle
There is now a need to look up table1 data from database 1. Selecting a data source 1 on a visual interface of the configuration script, and creating (or generating in real time) or calling a query script select from table1; when executing the script, the data source 1 can be connected to query the data of table1 in the database 1.
After the data source is constructed, a corresponding script needs to be configured based on the data source so as to execute the operation of the related function. And selecting a data source to be configured through a script configuration interface of the visual interface, and writing SQL scripts or stored procedures related to functions such as inquiry, addition, modification, deletion and the like in a script editor. And performing script execution test on the interface, and completing configuration of the script after success. Scripts (SQL scripts) may be created in advance or as needed, with different scripts corresponding to different functions, such as query, add, modify, delete, etc. functions. These scripts are similar to plug-ins and are called from the service interface when needed. After the database is connected, a pre-established script, or a script automatically generated at the time, may be invoked, and a function corresponding to the script is performed on the data source, such as viewing data in the database, deleting data in the database, or modifying data in the database, etc.
The script functions comprise inquiry, new addition, modification, deletion, replacement, calling and the like, the using frequencies of different script functions are different, and the script corresponding to the inquiry, the new addition, the modification, the deletion and the like is high in using frequency, so that a plurality of script functions with high using frequencies are screened out to construct a script template, and the quick construction of the script is realized. Each script needs to be matched with a data source, and the script template has strong universality and does not determine the data source. Counting the use frequency of various script functions, and sequencing the script functions in sequence according to the order of the use frequency from big to small; screening out a plurality of script functions to respectively construct script templates, wherein each script template corresponds to one script function and is not matched with a data source; one or more script templates capable of realizing the user request are selected from all script templates, and corresponding data sources are connected, so that the construction of the script can be completed, and the user can conveniently and quickly construct the script required by the user. In a particular field, script templates may be constructed according to particular needs.
The following steps may be performed by the service interface configuration interface of the visualization interface:
1. filling in basic information required for creating a service interface: interface name, route (for generating a service interface URL), request mode (GET, POST, PUT, DELETE, etc.).
2. The script of the last configuration is selected.
3. Automatically generating response parameters according to the query result through the selected script; request parameters are automatically generated according to the query conditions.
4. The data type, data validation rules, aliases, etc. attributes of each request parameter and response parameter are compiled.
5. The response parameters are configured with information such as formats (JSON, XML, etc.), response timeout times, etc. transmitted through HTTP.
6. And configuring authority authentication strategies (modes such as OAuth2.0 and ApiKey) of the service interface based on the second configuration information, and completing the configuration of one service interface.
In this embodiment, the configuration information of the service interface includes first configuration information and second configuration information. The first configuration information comprises basic information such as names of service interfaces, and the second configuration information comprises routing information for generating service interface URLs and request information related to interface request modes.
The request parameters may be understood as in-parameters and the response parameters may be understood as out-parameters. The in-parameter and the out-parameter are parameters, each parameter has a corresponding data type, such as an integer type, a character string type, a date type, and the like, and the data type can be changed through configuration. The source of the parameters is the result after the script query. Each parameter has a name, and the field name corresponding to the parameter in the database is probably Columbn 1, but the Title is actually stored, and in order to make the meaning of the parameter clear, the alias of Columbn 1 is set as Title. Data validation rules: for example, the Title allows at most 20 characters, so that in order to avoid program errors caused by calling more than 20 characters, the verification rule of the Title needs to be configured to be less than or equal to 20 characters.
The service interface may correspond to a script having rights, and different rights may correspond to different functions, so that the service interface may have a plurality of service interfaces, each having respective rights. In addition, authority authentication can be performed on the calling party of the service interface. For example, only scripts involving viewing functions have lower rights that the user needs to invoke, while scripts involving deleting functions have higher corresponding script rights. Preferably, different scripts may correspond to different rights; and the authority of the calling party can be confirmed when the authority authentication is carried out, and the authority is not in the high-low theory. Rights include which scripts can be manipulated, e.g., user 1's rights are rights 1, rights 1 include the operations that can execute the viewed script and the deleted script.
After the configuration of the service interface is completed, operations such as registration, running, receiving, forwarding and the like of the service interface are completed through the interface service. Defining an independent interface service in a preset interface service system; reading the second configuration information, and registering the route of the service interface into a route registration module of the interface service based on the second configuration information so that the calling party can access the service interface through the URL; after the route registration is completed, an online document of the service interface is automatically generated according to the second configuration information and registered to an interface document module, and the online document is used for displaying and describing related information of one interface, including information such as interface names, request modes, request parameters, response parameters and the like, and is only used for showing what interface can be provided by the service end, what request mode, request parameters, what information to return and the like are needed by each interface. A log is constructed about the service interface for recording the processing and calling procedures of the service interface. Whenever a caller invokes an interface, the API service records the processing of the internal program between the time the request is received and the time the response message is returned. After all parts of the service interface are built, the interface test call can be carried out on the interface debugging interface of the configuration management service so as to ensure that the service interface is available.
In addition, the service interface of the present embodiment also has a share recovery function. Specifically, screening out items capable of changing parameters in a service interface based on request parameters to obtain adjustable items; generating a version of historical data when parameters of one or more adjustable items are changed, and creating a backup document to backup the historical data of each version of the adjustable items; when the caller has the preset restoration authority, any version of history data can be called in the backup document to restore the service interface so as to obtain the service interface under the version of history data. The backup document can record the change of each adjustable item, and save the historical data of the version in the preset time period, so that the user can conveniently recover the historical data of a certain version. The restore function requires that the caller have higher rights and the service interface also verifies the caller's rights.
Preferably, the service interface is configured with multiple sets of data connection modes, and each set of data connection mode corresponds to an environment in which the service interface is located; each set of data connection mode is integrated with all data transmission paths of the service interface in the corresponding stage. The environment where the service interface is located comprises a development environment where the service interface is located in a development stage, a testing environment where the service interface is located in a testing stage, a production environment where the service interface is located in an actual application stage and the like. Different application fields may have different production environments, for example, in the field a, only a common function is needed, and in the field B, advanced functions such as restoration are needed, and the field a and the field B are configured with different data connection modes.
In each set of data connection modes, there are different interfaces, transmission paths and devices that need to be connected. The service interface may have different data connections during the development phase and during the actual application phase, such as requiring debugging during the development phase, requiring connection to the debugging device, and may not require debugging during the application phase, requiring connection to the debugging device. Frequent changes of data connections due to different environments are very cumbersome. The scheme of the embodiment specially sets the environment configuration function, and only needs to set different data connection modes in different environments and directly switch the data connection modes corresponding to the environments before and after the service interface is on line.
The service interface can be issued to an external network, a calling party can be connected with the service interface through the Internet, and then the database to be processed is operated through the service interface. The operator can generate a service interface for providing data interface service by simple configuration through the system management panel of the visual interface, which is beneficial to reducing repeated waste of a large amount of resource cost caused by service interface development due to the increase or change of most software requirements and reducing the cost of enterprises on the post requirements of related technicians.
The calling service interface specifically comprises the following steps: calling a service interface URL to initiate a request, wherein the request is attached with request parameters required by a service interface; the interface service receives the request and starts to record the full-link log through the log record; analyzing the URL through a route analysis module in the interface service and forwarding the URL to a corresponding processing function; performing authority verification of the request through an authority authentication module in the interface service; if the verification is not passed, directly returning to the access prohibition state and terminating the request; if the verification is passed, the processing function selects a corresponding data source based on the configuration information, accesses the data source through the script and executes a corresponding instruction to obtain an access result, and returns the access result to the calling party; and finishing the recording of the log record and finishing the request.
After the server receives the request, the server needs to process the parameters of the request and the operations that should be executed by the interface, and packages the process (called a method or a function) to be a processing function.
In a specific embodiment, to improve the processing efficiency of the service interface, the scheme further includes: the historical operation records of the same user can be recorded, and data sources which are recorded in the record logs and frequently accessed by the calling party are screened out; analyzing whether the accessed time node of the data source meets a preset time condition 1: if the preset time condition about the access times is met, a first link is constructed on the visual interface, and the caller can directly finish the access of the corresponding data source by clicking the first link to obtain an access result; if the preset time condition 2 about the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, and constructing a second link on the visual interface, wherein the second link automatically completes the access to the corresponding data source according to the access frequency to obtain the access result of each time; if the preset time condition 3 about the access duration is met, a third link is constructed on the visual interface, and the third link stores the operation data of the calling party in the service interface. The links may be presented in the form of icons in a visual interface. The first link, the second link and the third link may be understood as a kind of shortcut.
The preset time condition 1 is that the number of times that a calling party accesses a certain data source exceeds a preset number of times within a limited time period; the preset time condition 2 is that a calling party accesses a certain data source for a plurality of times at the same frequency within a limited time period; the preset time condition 3 is that the calling party continuously accesses the preset time length aiming at the same data source.
In addition, if the same user is found to frequently operate the data source 1 within a certain time, and various steps or parameters may exist in the operation, after the operation is suspended or ended, the flow of the service interface may be set to be an icon for storage, after the subsequent user clicks the icon, the user may directly enter the interface before the operation in the data source 1 without inputting the information connected with the data source 1, so that the data and the interface after the last access are retained, and the operation between the user continuation is facilitated.
The embodiment provides a dynamic management method of a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation, thereby avoiding repeated waste of resource cost. The programming logic in the visual platform is relatively fixed, when facing different functions or interfacing different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting different databases, and executing different operations on the connected different databases. The construction of different service interfaces can be completed based on one interface, and each service interface is not required to be reprogrammed, so that the construction efficiency of the service interfaces is improved.
Example 2
The embodiment 2 of the invention discloses a dynamic management system of a service interface, which can realize the dynamic management method of the service interface of the embodiment 1, and the specific structure of the system is shown in the attached figure 3 of the specification, and the specific scheme is as follows:
the dynamic management system includes a configuration management service and an interface service.
Wherein the configuration management service is used for the creation of service interfaces and the function of configuring relevant parameters. It is composed of the following modules: a data source adapter module 1, a data source master-slave configuration module 2, a service environment configuration module 3, a script parsing module 4, a script editor module 5, a parameter generation module 6, a route configuration module 7, a parameter configuration module 8, an interface basic information module 9, an import and export module 10 and the like.
The configuration management service specifically includes:
the data source adapter module 1 is for managing various data providers, such as: mySQL, SQL Server, oracle, mongoDB, webAPI, webservice, etc. The abstract is a unified interface, and various data sources in examples realize the interface respectively and are injected into the abstract interface in the form of plug-in. When the script parsing module needs, a corresponding instance is created in a factory mode according to a designated data provider (for example, mySQL) for use by the script parsing module.
The data source master-slave configuration module 2 is used for managing and configuring data connection of one master and multiple slaves so as to be used for separately reading and writing data, and effectively improves data throughput performance.
The service environment configuration module 3 is used for managing and configuring the service interfaces before and after the service interfaces are on line, and one service interface is in different environments, such as a development environment, a test environment and a production environment, at different stages, and usually different environments have different data connections. Frequent changes of data connections due to different environments are very cumbersome. The environment configuration function is used, and only different data connections are required to be set in different environments, and the environments are directly switched before and after the service interface is on line.
The script analysis module 4 is used for analyzing and executing manually written scripts to execute the operations of adding, deleting and modifying database data sources and obtain corresponding execution results.
The script editor module 5 is used for editing an editor of SQL scripts on Web pages, can perform real-time grammar detection and intelligent prompt on the edited scripts, can store script fragments in a keyword form, and can generate corresponding script fragments only by inputting keywords when the writer uses the script again, so that the editing efficiency is greatly improved.
The parameter generation module 6 is used for generating corresponding parameters and data types according to the written SQL script or stored procedure, and the parameters comprise an in parameter and an out parameter. The automatic generation of the parameters saves the workload of manual input and also avoids the problem of easy error of manual input.
The route configuration module 7 is used to configure URL routing to provide a service interface URL disclosed in an external network. Service interface URLs conforming to RESTful specifications are configured according to rules of the route resolver. The configuration parameters need to provide parameters of resource names (English), operation names (English), PATH types, etc.
The parameter configuration module 8 is configured to configure and manage the parameters generated by the parameter generation module 6, and configure the data types, alias mappings, data verification rules, and other attributes of the parameters.
The interface basic information module 9 is used for configuring and managing basic information such as interface name, parameter type (Query, form, body), request mode (Get, post, put, delete, etc.), belonging range group, etc. of the service interface.
The import export module 10 is used for exporting and importing configuration of data sources in the form of files, exporting and importing configuration of scripts in the form of files, exporting and importing configuration of service interfaces in the form of files, and exporting and importing other configuration items.
The interface service is used for disclosing the service interface to an external network, providing the calling party with access to the service interface, and tracking and recording functions such as request access. It is composed of the following modules: a route registration module 11, a route analysis module 12, a log recording module 13, a right authentication module 14, a service gateway module 15, an interface debugging module 16, an interface document module 17, a route forwarding module 18, and the like.
The interface service specifically comprises:
the route registration module 11 is configured to register the URL route of the online service interface to the route manager according to the route information configured in the route configuration module 7 to provide the external access service.
The route parsing module 12 is configured to parse the URL requested by the caller (the URL provided by the route registration module 11) according to the routing rule, forward the URL to the matching method for execution, and return a response result to the caller.
The log recording module 13 is used for recording the full link request log, script execution log and data audit log of the service interface. The log is recorded to be helpful for statistics of service interface access, investigation of abnormal program operation information, analysis and positioning of data change by calling party and the like.
The authority authentication module 14 controls the access authority of the service interface in the modes of ApiKey, OAuth2.0 and the like, only a calling party with corresponding authority can access the service interface, and an unauthorized state code is returned 401 to a calling party without authority, so that the safety of the service interface is effectively ensured.
The service gateway module 15 is used for forwarding, aggregating, traffic limiting, service fusing, controlling authority, balancing load, etc. non-business functions of service interface request, protecting, enhancing and controlling access to service interface, the interface gateway is a system before application program or service, and is used for managing authorization, access control, traffic limiting, etc., so that the service interface is protected by the service gateway and transparent to all callers.
The interface debugging module 16 is used for calling the service interface online in real time to test the availability of the service interface, so as to ensure that the created service interface can be effectively and timely validated.
An interface document module 17 for automatically generating an online document of the online service interface to present and describe the relevant information of the service interface. A new service interface is created or a related document of the service interface is automatically generated after the service interface is modified, so that the trouble of manually maintaining the interface document and the problem of easy error of manually maintaining the interface document are avoided.
The route forwarding module 18 is configured to forward the URL parsed by the route parsing module to a corresponding processing function.
Fig. 4 of the specification provides a service to which a part of the modules belong.
The present embodiment provides a dynamic management system for a service interface, which can implement the dynamic management method of embodiment 1
The invention provides a dynamic management method and a system for a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation and avoid repeated waste of resource cost. The programming logic in the visual platform is relatively fixed, when facing different functions or interfacing different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting different databases, and executing different operations on the connected different databases. The construction of different service interfaces can be completed based on one interface, and each service interface is not required to be reprogrammed, so that the construction efficiency of the service interfaces is improved.
Those skilled in the art will appreciate that the drawing is merely a schematic illustration of a preferred implementation scenario and that the modules or flows in the drawing are not necessarily required to practice the invention. Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules. The above-mentioned inventive sequence numbers are merely for description and do not represent advantages or disadvantages of the implementation scenario. The foregoing disclosure is merely illustrative of some embodiments of the invention, and the invention is not limited thereto, as modifications may be made by those skilled in the art without departing from the scope of the invention.

Claims (7)

1. A method for dynamically managing a service interface, comprising:
configuring a data source of an interface through a preset visual interface based on a preset user request, and creating at least one script which can access the data source and execute related requests, wherein script functions comprise inquiry, addition, modification, deletion, replacement and calling;
acquiring first configuration information and second configuration information of an interface based on the visual interface, wherein the first configuration information relates to a basic framework of the interface, and creating an initial service interface according to the first configuration information;
defining response parameters and request parameters of each script based on an initial service interface, and configuring the response parameters and the request parameters according to the second configuration information; defining an independent interface service to configure accessibility of a service interface, and registering the service interface into the interface service based on the second configuration information so that a preset calling party can access the service interface through an external network;
after the accessibility configuration is completed, an online document is constructed according to the second configuration information to display and describe the related information of the service interface, and a log is configured to record the processing process of the service interface;
Debugging the service interface in the visual interface to ensure that the service interface is available, and finally obtaining a service interface constructed based on a user request;
the second configuration information comprises routing information related to a service interface URL and request information related to an interface request mode;
selecting a script, generating a script response parameter according to a query result, and generating a request parameter of the script according to a query condition until the response parameters and the request parameters of all the scripts are obtained;
editing parameter attributes of each request parameter and response parameter, including data type, data verification rule and alias;
configuring a transmission format of response parameters and response timeout time;
configuring a right authentication policy of the service interface based on the second configuration information;
screening out data sources recorded in the record log and frequently accessed by a calling party; analyzing whether the accessed time node of the data source meets a preset time condition or not: if the preset time condition 1 about the access times is met, a first link is constructed on the visual interface, and a calling party can directly finish the access of the corresponding data source by clicking the first link to obtain an access result; if the preset time condition 2 about the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, and constructing a second link on the visual interface, wherein the second link automatically completes the access to the corresponding data source according to the access frequency to obtain the access result of each time; if the preset time condition 3 about the access duration is met, a third link is constructed on the visual interface, and the third link stores the operation data of the calling party in the service interface;
The preset time condition 1 is that the number of times that a calling party accesses a certain data source exceeds a preset number of times within a limited time period; the preset time condition 2 is that a calling party accesses a certain data source for a plurality of times at the same frequency within a limited time period; the preset time condition 3 is that the calling party continuously accesses the same data source for a preset time period;
counting the use frequency of various script functions, and sequencing the script functions in sequence according to the order of the use frequency from big to small; screening out a plurality of script functions to respectively construct script templates, wherein each script template corresponds to one script function and is not matched with a data source; selecting one or more script templates capable of realizing the user request from all script templates, and connecting corresponding data sources;
the service interface is configured with a plurality of sets of data connection modes, and each set of data connection mode corresponds to an environment where the service interface is located; each set of data connection mode is integrated with all data transmission paths of the service interface in the corresponding stage; the environment where the service interface is located comprises a development environment where the service interface is located in a development stage, a test environment where the service interface is located in a test stage and a production environment where the service interface is located in an actual application stage; and before and after the service interface is on line, directly switching the data connection mode corresponding to the environment.
2. The dynamic management method according to claim 1, wherein an independent interface service is defined in a preset interface service system;
reading second configuration information, and registering the route of the service interface into a route registration module of the interface service based on the second configuration information so that a calling party can access the service interface through a URL;
after the route registration is completed, an online document of the service interface is automatically generated according to the second configuration information and registered to an interface document module of the interface service so as to display and describe related information of the service interface including an interface name, a request mode, a request parameter and a response parameter.
3. The dynamic management method according to claim 1, wherein the service interface is configured with a plurality of data connection modes, and each data connection mode corresponds to an environment in which the service interface is located;
each set of data connection mode is integrated with all data transmission paths of the service interface in the corresponding stage;
the environment where the service interface is located comprises a development environment where the service interface is located in a development stage, a testing environment where the service interface is located in a testing stage and a production environment where the service interface is located in an actual application stage.
4. The dynamic management method according to claim 1, characterized in that the dynamic management method further comprises:
calling a service interface URL to initiate a request, wherein the request is attached with request parameters required by a service interface;
the interface service receives the request and starts to record through the record log;
analyzing the URL through a route analysis module in the interface service and forwarding the URL to a preset processing function;
performing authority verification of the request through an authority authentication module in the interface service;
if the verification is not passed, directly returning to the access prohibition state and terminating the request;
if the verification is passed, the processing function selects a corresponding data source based on the configuration information, accesses the data source through the script and executes a corresponding instruction to obtain an access result, and returns the access result to the calling party; and finishing the recording of the log record and finishing the request.
5. The method according to claim 1, wherein the item of modifiable parameters in the service interface is filtered out based on the request parameters to obtain the adjustable item;
generating a version of historical data when parameters of one or more adjustable items are changed, and creating a backup document to backup the historical data of each version of the adjustable items;
When the calling party has the preset restoration right, any version of history data can be called from the backup document to restore the service interface so as to obtain the service interface under the version of history data.
6. A dynamic management system for service interfaces, characterized by implementing a dynamic management method for service interfaces according to any one of claims 1-5; the dynamic management system comprises a configuration management service; the configuration management service includes:
a data source adapter module for managing various data sources;
the script analysis module is used for analyzing the script, and executing the script to perform the operation corresponding to the instruction on the data source and obtaining the corresponding execution result;
the script editor module is used as an editor for writing scripts, can perform real-time grammar detection and intelligent prompt on the written scripts, and can store script fragments in the form of keywords;
the parameter generation module is used for generating corresponding parameters and data types according to the script or the stored process;
the route configuration module is used for configuring the URL route of the service interface so as to provide the URL disclosed in the external network;
the parameter configuration module is used for configuring and managing the parameters generated by the parameter generation module, and configuring data attributes of the parameters including data types, alias mapping and data verification rules;
The interface basic information module is used for configuring and managing basic information of the service interface, including interface names, parameter types, request modes and belonging range groups;
and the import and export module is used for exporting and importing the preset configuration items in the form of files, and comprises exporting and importing the configuration of the data source in the form of files, exporting and importing the configuration of the script in the form of files and exporting and importing the configuration of the service interface in the form of files.
7. The dynamic management system according to claim 6, further comprising an interface service, the interface service having a configuration comprising:
the route registration module is used for registering the URL route of the online service interface to the route manager according to the route information configured in the route configuration module so as to provide external access service;
the route analysis module is used for analyzing the URL requested by the calling party according to the route rule, forwarding the URL to the matched method for execution, and returning a response result to the calling party;
the log recording module is used for recording the full-link request log, the script execution log and the data audit log of the service interface;
the authority authentication module is used for controlling the access authority of the service interface, ensuring that only a calling party with corresponding authority can access the service interface, and returning 401 an unauthorized status code to a calling party without the authority;
The service gateway module is used for forwarding a service interface request, aggregating the interface, restricting the flow, fusing the service, controlling the authority, balancing the load, protecting, enhancing and controlling the access to the service interface;
the interface debugging module is used for calling the service interface on line in real time to test the usability of the service interface, so that the created service interface can be effectively and timely verified;
and the interface document module is used for automatically generating an online document of the online service interface so as to display and describe the related information of the service interface.
CN202210952145.6A 2022-08-09 2022-08-09 Dynamic management method and system for service interface Active CN115309566B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210952145.6A CN115309566B (en) 2022-08-09 2022-08-09 Dynamic management method and system for service interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210952145.6A CN115309566B (en) 2022-08-09 2022-08-09 Dynamic management method and system for service interface

Publications (2)

Publication Number Publication Date
CN115309566A CN115309566A (en) 2022-11-08
CN115309566B true CN115309566B (en) 2023-09-05

Family

ID=83861657

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210952145.6A Active CN115309566B (en) 2022-08-09 2022-08-09 Dynamic management method and system for service interface

Country Status (1)

Country Link
CN (1) CN115309566B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627486B (en) * 2023-07-25 2023-10-20 中博信息技术研究院有限公司 Compact configuration type rest interface management and message conversion method and device
CN117149886A (en) * 2023-10-31 2023-12-01 厦门畅享信息技术有限公司 Dynamically configurable multi-data source data docking method and management platform
CN117193990B (en) * 2023-11-08 2024-02-23 建信金融科技有限责任公司 Scheduling management method, device, equipment and storage medium of http interface
CN117354114B (en) * 2023-12-05 2024-03-08 易智瑞信息技术有限公司 Data service release method and system based on cloud native architecture
CN117648141A (en) * 2024-01-30 2024-03-05 北京比格大数据有限公司 Dynamic configuration method and device for data service interface, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103946841A (en) * 2011-11-17 2014-07-23 益焦.com有限公司 Systems and methods for dynamic service integration
CN106021079A (en) * 2016-05-06 2016-10-12 华南理工大学 A Web application performance testing method based on a user frequent access sequence model
CN106599015A (en) * 2016-08-31 2017-04-26 重庆车杰盟科技有限公司 Data service management system and method
CN110825388A (en) * 2019-11-15 2020-02-21 中科院计算技术研究所大数据研究院 Method for directly converting SQL statement into corresponding REST interface
CN112799659A (en) * 2021-01-12 2021-05-14 杨飞 Method, device and terminal for automatically generating data interface without programming
CN113220755A (en) * 2020-12-28 2021-08-06 浙大网新科技股份有限公司 Method for flexibly generating GraphQL interface based on multi-source data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103946841A (en) * 2011-11-17 2014-07-23 益焦.com有限公司 Systems and methods for dynamic service integration
CN106021079A (en) * 2016-05-06 2016-10-12 华南理工大学 A Web application performance testing method based on a user frequent access sequence model
CN106599015A (en) * 2016-08-31 2017-04-26 重庆车杰盟科技有限公司 Data service management system and method
CN110825388A (en) * 2019-11-15 2020-02-21 中科院计算技术研究所大数据研究院 Method for directly converting SQL statement into corresponding REST interface
CN113220755A (en) * 2020-12-28 2021-08-06 浙大网新科技股份有限公司 Method for flexibly generating GraphQL interface based on multi-source data
CN112799659A (en) * 2021-01-12 2021-05-14 杨飞 Method, device and terminal for automatically generating data interface without programming

Also Published As

Publication number Publication date
CN115309566A (en) 2022-11-08

Similar Documents

Publication Publication Date Title
CN115309566B (en) Dynamic management method and system for service interface
CN108427631B (en) Application test system, method, electronic equipment and readable storage medium
US7647370B1 (en) Screen scraping interface
JP5813655B2 (en) Object management using a client-server bridge
US9323647B2 (en) Request-based activation of debugging and tracing
US20040139176A1 (en) Systems and methods for improving service delivery
US8127270B1 (en) Abstracting transformation for model driven architecture
US9747353B2 (en) Database content publisher
CA2777443A1 (en) Automated enterprise software development
JP2005512196A (en) System and method for actively managing an enterprise comprising configurable components
US20060129652A1 (en) System to coordinate the execution of a plurality of separate computer systems to effectuate a process (as amended in search report)
CN112527252B (en) Applet management method and device, applet platform, electronic equipment and medium
CN110083338B (en) Service system based on intelligent gateway
CN101727475A (en) Method, device and system for acquiring database access process
US11790058B2 (en) Automated role management for resource accessing code
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
US7865880B2 (en) System and/or method for implementing efficient techniques for testing common information model providers
US20140337728A1 (en) Operating oracle forms using a web service
KR101266685B1 (en) Method and system for policy enabled programming
TWI414995B (en) Development and execution platform
CN113127906A (en) Unified authority management platform, method and storage medium based on C/S architecture
CN111652580A (en) Method and device for processing data of nodes
Stanek Microsoft SQL Server 2012 Pocket Consultant
CN116931893A (en) JSON structure capable of being compiled and executed
CN115718755A (en) Visual interface configuration and data query method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant