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

Dynamic management method and system for service interface Download PDF

Info

Publication number
CN115309566A
CN115309566A CN202210952145.6A CN202210952145A CN115309566A CN 115309566 A CN115309566 A CN 115309566A CN 202210952145 A CN202210952145 A CN 202210952145A CN 115309566 A CN115309566 A CN 115309566A
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.)
Granted
Application number
CN202210952145.6A
Other languages
Chinese (zh)
Other versions
CN115309566B (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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

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 a response parameter and a request parameter of each script based on an initial service interface, and configuring the response parameter and the request parameter; defining an interface service to configure the accessibility of the service interface so that a calling party 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 on the basis of the visual platform, additional programming operation is not needed, repeated waste of resource cost is avoided, and 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 dynamic management method and system for a service interface.
Background
Service interfaces, also known as application programming interfaces, are predefined functions that are primarily intended to provide applications and developers the ability to access a set of routines without accessing source code or understanding the details of internal working 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 thus an abstraction. The service interface herein refers to a "Web service interface", such as WebApi, webService, etc., and is hereinafter referred to as a "service interface".
In the prior art, if a new service interface is to be added, a programming method must be relied on, which results in that each service interface must be reprogrammed. Moreover, each service interface has a single purpose, and if a demand change occurs, a series of processes such as encoding, testing, releasing, online connection and the like need to be performed on the service interface again, so that a great amount of resource cost is wasted repeatedly.
Disclosure of Invention
In view of this, the present invention provides a dynamic management method and system for a service interface, and the specific scheme is as follows:
a dynamic management method of a service interface comprises 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 a related request;
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 architecture of the interface, and creating an initial service interface according to the first configuration information;
defining a response parameter and a request parameter of each script based on an initial service interface, and configuring the response parameter and the request parameter according to the second configuration information; defining an independent interface service to configure the accessibility of the 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 finished, constructing an online document according to the second configuration information to show and describe the relevant information of the service interface, and configuring a log 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 for generating a 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 scripts are obtained;
editing parameter attributes including data types, data validation rules and aliases of each request parameter and each response parameter;
configuring the transmission format and response timeout time of the response parameters;
and configuring the authority authentication strategy of the service interface based on the second configuration information.
In a specific 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 caller can access the service interface through a URL (uniform resource locator);
after the routing registration is completed, automatically generating an online document of the service interface according to the second configuration information, and registering the online document to an interface document module of the interface service so as to display and describe relevant 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 a plurality of sets of data connection modes, 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 at the corresponding stage;
the environment of the service interface comprises a development environment of the service interface in a development stage, a test environment of the service interface in a test stage and a production environment of the service interface in an actual application stage.
In a specific embodiment, the dynamic management method further includes:
calling a direction service interface URL to initiate a request, wherein the request is accompanied with request parameters required by the service interface;
the interface service receives the request and starts to record through the log;
analyzing the URL through a route analysis module in the interface service and forwarding the URL to a preset processing function;
the authority verification of the request is carried out through an authority authentication module in the interface service;
if the verification fails, 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 log recording and finishing the request.
In one embodiment, the method further comprises:
screening out data sources recorded in the log and frequently accessed by a calling party;
analyzing whether the accessed time node of the data source meets a preset time condition:
if the preset time condition 1 related to the access times is met, a first link is established on the visual interface, and the 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 related to the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, constructing a second link on the visual interface, and automatically completing the access to the corresponding data source according to the access frequency by the second link to obtain the access result of each time;
and if the preset time condition 3 related to the access duration is met, constructing a third link on the visual interface, wherein 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 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 for the same data source.
In a specific embodiment, counting the use frequency of each script function, and sequencing the script functions in sequence according to the sequence of the use frequency from large to small;
screening 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 the script templates and connected with corresponding data sources.
In a specific embodiment, screening out items with changeable parameters in the service interface based on the request parameters to obtain adjustable items;
when one or more parameters of the adjustable items are changed, generating historical data of one version, and creating a backup document to backup the historical data of each version of the adjustable items;
when the caller has the preset recovery right, the caller can call any version historical data from the backup document to recover the service interface so as to obtain the service interface under the version historical data.
A dynamic management system of a service interface, which is used for implementing any one of the above dynamic management methods of the service interface; the dynamic management system comprises a configuration management service; the configuration management service comprises:
the data source adapter module is used for managing various data sources;
the script analysis module is used for analyzing the script, performing operation corresponding to the instruction on the data source through the execution script and obtaining a corresponding execution result;
the script editor module is used as an editor for compiling scripts, can carry out real-time grammar detection and intelligent prompt on the compiled scripts and can store script fragments in a keyword form;
the parameter generation module is used for generating corresponding parameters and data types according to the script or the storage process;
a route configuration module for configuring a URL route of the service interface to provide a URL exposed to the external network;
the parameter configuration module is used for configuring and managing the parameters generated by the parameter generation module, and configuring the data attributes of the parameters, including the data type, alias mapping and data validation 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 affiliated scope groups;
and the import and export module is used for exporting and importing the preset configuration items in a file form, and comprises the steps of exporting and importing the configuration of the data source in the file form, exporting and importing the configuration of the script in the file form, and exporting and importing the configuration of the service interface in the file form.
In a specific embodiment, the system further comprises an interface service, wherein the interface service comprises:
the route registration module is used for registering the URL route of the on-line service interface into 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 a full link request log, a script execution log and a 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 unauthorized state codes to calling parties without the authority;
the service gateway module is used for forwarding service interface requests, aggregating interfaces, limiting flow, fusing services, controlling authority and balancing loads, and protecting, enhancing and controlling access to the service interfaces;
the interface debugging module is used for calling the service interface on line in real time so as to test the usability of the service interface and ensure that the created service interface can be timely and effectively verified by the usability;
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 relevant information of the service interface.
Has the advantages that: the invention provides a dynamic management method and a dynamic management system for a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation, thereby avoiding the repeated waste of resource cost. The programming logic inside the visual platform is relatively fixed, and when the visual platform faces different functions or is butted with different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting the 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 does not need 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 present invention;
FIG. 2 is a diagram illustrating an example of interaction between a user and a system in accordance with an embodiment of the present invention;
FIG. 3 is a block diagram of a dynamic management system according to an embodiment of the present invention;
fig. 4 is a schematic diagram of services to which some modules belong in the dynamic management system according to the embodiment of the present invention.
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Reference numerals: 1-a data source adapter module; 2-data source master-slave configuration module; 3-a service environment configuration module; 4-script parsing module; 5-script editor module; 6-a parameter generation module; 7-a route configuration module; 8-parameter configuration module; 9-interface basic information module; 10-leading in and out module; 11-route registration module; 12-a route resolution module; 13-logging module; 14-a rights authentication module; 15-a service gateway module; 16-an interface debugging module; 17-interface documentation module; 18-route forwarding module.
Detailed Description
Hereinafter, various embodiments of the present disclosure will be described more fully. The present disclosure is capable of various embodiments and of being practiced with modification and alteration. 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 disclosure is 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 forms are intended to include the plural forms 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 the various embodiments of the disclosure belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments.
Example 1
The embodiment 1 of the invention discloses a dynamic management method of a service interface, wherein in a visual interface, different databases are connected by filling corresponding parameters, 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 flow block diagram specification is shown in fig. 1, and the specific scheme is as follows:
a dynamic management method of a service interface comprises the following steps:
101. based on a preset user request, a data source of an interface is configured through a preset visual interface, and at least one script which can access the data source and execute a related request is created;
102. acquiring first configuration information and second configuration information of an interface based on a visual interface, wherein the first configuration information relates to a basic architecture of the interface, and creating an initial service interface according to the first configuration information;
103. defining a response parameter and a request parameter of each script based on the initial service interface, and configuring the response parameter and the request parameter according to the second configuration information; an independent interface service is defined to configure the accessibility of the service interface, and the service interface is registered 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 finished, constructing an online document according to the second configuration information to show and describe the relevant information of the service interface, and configuring a log 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 the present embodiment consists of a configuration management service and an interface service, and fig. 2 provides an example of the interaction between the user and the system. The user request relates to the desired database and what instructions to execute on the database. The configuration management service is used for configuring a data source, a script and a service interface, and the interface service is an independently operated Web service and is used for disclosing the service interface to a network.
First, one or more data sources are defined, including but not limited to relational databases (MySQL, SQL Server, oracle, etc.), non-relational databases (MongoDB, etc.), externally provided service interfaces (WebAPI, webservice, etc.), and the like. On a data source configuration interface of a visual interface, selecting a type of database from several data source types predefined by a program, and configuring connection information of the database, such as IP, ports, database names, database user names, database passwords and the like. And performing connection test on the visual interface, and completing the configuration of a data source after the connection test is successful. By the method, the data source containing the database can be generated in advance or in real time.
Wherein, different databases can be connected by connecting data sources. For example, the database may be connected 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, the service interface is independent of the data source, but the service interface and the data source can have a corresponding relation by setting corresponding parameters. Therefore, when the data in the database a needs to be queried, the corresponding process is as follows: a calling party initiates a request, a service interface receives the request, a database A connection is provided according to a configuration matching data source, the data source executes a script query method and a result is returned.
It is assumed that there exist a plurality of data sources, each of which is a database connection, corresponding to a database.
Data source 1- > database1- > SQLServer
Data Source 2- - > database2- - > MySQL
Data Source 3- - > database3- - > Oracle
There is now a need to look up the data of table1 from database 1. Selecting a data source 1 on a visual interface of the configuration script, and creating (or generating immediately) 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 table in database1 database.
After the data source is constructed, a corresponding script needs to be configured based on the data source 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 compiling an SQL script or a storage process related to functions of inquiry, addition, modification, deletion and the like in a script editor. And performing script execution test on the interface, and finishing the configuration of the script after success. Scripts (SQL scripts) can be created in advance or when needed, and different scripts correspond to different functions, for example, functions such as query, addition, modification, deletion, and the like can be included. These scripts, like plug-ins, can be called from the service interface when needed. After the connection to the database, a pre-established script or a script automatically generated at that time may be called, and a function corresponding to the script may be executed on the data source, for example, checking data in the database, deleting data in the database, or modifying data in the database, and so on.
The script functions comprise inquiry, addition, modification, deletion, replacement, calling and the like, the use frequencies of different script functions are different, and the use frequencies of common scripts corresponding to the inquiry, addition, modification, deletion and the like are higher, so that a plurality of script functions with higher use frequencies are screened out to construct the script template so as to realize the rapid construction of the script. Each script needs to match with a data source, and the script template has strong universality and does not determine the data source. Counting the use frequency of each script function, and sequencing the script functions in sequence from high use frequency to low use frequency; screening 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; and one or more script templates capable of realizing the user request are selected from all the script templates and connected with corresponding data sources, so that the construction of the script can be completed, and the user can conveniently and quickly construct the needed script. In a particular domain, a script template can be constructed according to particular needs.
The following steps may be performed by a service interface configuration interface of the visualization interface:
1. fill in basic information needed to create a service interface: interface name, route (for generating service interface URL), request style (GET, POST, PUT, DELETE, etc.).
2. The last configured script is selected.
3. Automatically generating response parameters according to the query result through the selected script; and automatically generating request parameters according to the query conditions.
4. Editing the data type, data verification rule, alias and other attributes of each request parameter and response parameter.
5. The configuration response parameters are transmitted through HTTP in a format (JSON, XML, etc.), response timeout time, and the like.
6. And configuring the authority authentication strategy (OAuth 2.0, apiKey and other modes) 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 the name of the service interface, and the second configuration information comprises routing information used for generating a service interface URL and request information related to an interface request mode.
The request parameter may be understood as an entry, and the response parameter may be understood as an exit. The parameter is a parameter, and 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 parameter is the result of the script query. Each parameter has a name, and the field name corresponding to the parameter in the database may be Column1, but a Title is actually stored, and the alias name of Column1 is set to Title for clarifying the meaning of the parameter. And (3) data verification rules: for example, the Title allows a maximum of 20 characters, and in order to avoid program errors caused by the calling party transmitting more than 20 characters, the validation rule of the Title needs to be configured to be less than or equal to 20 characters.
The service interface can correspond to the authority, and different authorities can correspond to scripts with different functions, so that the service interface can be provided with a plurality of authorities, and each authority has respective authority. In addition, authority authentication can be carried out on a calling party of the service interface. For example, only the script related to the view function has lower authority to call, and the script related to the delete function has higher authority. Preferably, different scripts may correspond to different permissions; the authority of the caller may be confirmed during the authority authentication, and the authority is not discussed in terms of level. The authority includes which scripts can be operated, for example, the authority of the user 1 is authority 1, and the authority 1 includes the operation of executing the viewed scripts and the deleted scripts.
After the configuration of the service interface is completed, the operations of registration, operation, reception, 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 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 the URL; after the routing registration is completed, an online document of the service interface is automatically generated according to the second configuration information, and is registered in the interface document module, and the online document is used for displaying and describing relevant information of one interface, including information such as an interface name, a request mode, a request parameter, a response parameter and the like. And constructing a log about the service interface for recording the processing and calling processes of the service interface. Every time a caller calls an interface, the API service records the processing procedure of the internal program between the time the API service receives the request and the time the response information is returned. After all parts of the service interface are built, the interface can be tested and called on an interface debugging interface of the configuration management service to ensure that the service interface is available.
In addition, the service interface of the embodiment also has a backup recovery function. Specifically, screening out items with changeable parameters in the service interface based on the request parameters to obtain adjustable items; when one or more parameters of the adjustable items are changed, generating historical data of one version, and creating a backup document to backup the historical data of each version of the adjustable items; when the caller has the preset recovery authority, the caller can call any version historical data in the backup document to recover the service interface so as to obtain the service interface under the version historical 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 recovery function requires the caller to have a higher authority, and the service interface will also verify the authority of the caller.
Preferably, the service interface is configured with a plurality of sets of data connection modes, each set of data connection mode corresponding 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 at the corresponding stage. The environment of the service interface comprises a development environment of the service interface in a development stage, a test environment of the service interface in a test stage, a production environment of the service interface in an actual application stage and the like. Different application fields may have different production environments, for example, in the field a, only a normal function is needed, in the field B, a high-level function such as recovery is needed, and the field a and the field B are configured with different data connection modes.
In each set of data connection mode, different interfaces, transmission paths and devices need to be connected. The service interface may have different data connections in the development phase and the actual application phase, for example, debugging is required to be performed in the development phase and a debugging device is required to be connected, and debugging is not required in the application phase and a debugging device is not required to be connected. Frequent changes of data connections due to different environments are very cumbersome. The scheme of this embodiment has set up the environment configuration function specially, only needs to set up different data connection modes in the environment of difference, around the service interface on-line, the direct switch environment corresponds the data connection mode can.
The service interface can be published on an external network, and a calling party can be connected with the service interface through the Internet subsequently and then operates the database to be processed through the service interface. An operator can simply configure the system management panel through the visual interface to generate a service interface for providing data interface service, which is beneficial to reducing the repeated waste of a large amount of resource cost caused by the development of the service interface due to the increase or change of most software requirements and is beneficial to reducing the cost of enterprises for the post requirements of related technicians.
The calling service interface specifically includes: calling a direction service interface URL to initiate a request, wherein the request is accompanied with request parameters required by the service interface; the interface service receives the request and starts to record the full link log by recording the log; analyzing the URL through a route analysis module in the interface service and forwarding to a corresponding processing function; the authority verification of the request is carried out through an authority authentication module in the interface service; if the verification fails, 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 log recording and finishing the request.
After receiving the request, the server needs to process the parameters of the request and the operation that should be performed by the interface, and the process of this processing is packaged (called method or function in terms), i.e. processing function.
In a specific embodiment, to improve the processing efficiency of the service interface, the scheme further includes: historical operation records of the same user can be recorded, and data sources recorded in a recording log and frequently accessed by a 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 established on the visual interface, and the 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 related to the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, constructing a second link on a visual interface, and automatically completing the access to the corresponding data source according to the access frequency by the second link to obtain the access result of each time; and if the preset time condition 3 related to the access duration is met, constructing a third link on the visual interface, wherein 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 the visualization interface. The first link, the second link and the third link may be understood as a 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 same data source for a preset time.
In addition, if it is found that the same user frequently operates the data source 1 within a certain time, and various different steps or parameters may be available for the operation, the flow of the service interface may be set as an icon for storage after the operation is suspended or ended, and after the subsequent user clicks the icon, the user may directly enter the interface before the operation is performed in the data source 1 without inputting information for connecting the data source 1, and the data and the interface after the last access are retained, thereby facilitating the operation between the continuation of the user.
The embodiment provides a dynamic management method for a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation, thereby avoiding the repeated waste of resource cost. The programming logic inside the visual platform is relatively fixed, and when the visual platform faces different functions or is butted with different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting the 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 does not need to be reprogrammed, so that the construction efficiency of the service interfaces is improved.
Example 2
The embodiment 2 of the present invention discloses a dynamic management system for a service interface, which can implement the dynamic management method for the service interface of the embodiment 1, the specific structure of the system is as 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. The system consists of the following modules: the system comprises a data source adapter module 1, a data source master-slave configuration module 2, a service environment configuration module 3, a script analysis module 4, a script editor module 5, a parameter generation module 6, a routing configuration module 7, a parameter configuration module 8, an interface basic information module 9, an import-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 abstraction is a uniform interface, and various data sources in the example respectively realize the interface and inject the interface into the abstract interface in a plug-in mode. And when the script analysis module is required, a corresponding instance is created for the script analysis module in a factory mode according to a specified data provider (for example, mySQL).
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 reading and writing data separately, and data throughput performance is effectively improved.
The service environment configuration module 3 is used for managing and configuring environment differentiation before and after the service interface is on line, one service interface can be in different environments at different stages, such as a development environment, a test environment and a production environment, and different environments usually 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 need to be set in different environments, and the environments can be directly switched before and after the service interface is on line.
The script analysis module 4 is used for analyzing and executing the manually written script so as to execute the operations of adding, deleting and modifying the database type data source and obtain the corresponding execution result.
The script editor module 5 is used for an editor for compiling SQL scripts on a Web page, can perform real-time grammar detection and intelligent prompt on the compiled scripts, can store script fragments in a keyword form, and can generate corresponding script fragments only by inputting keywords when a writer reuses the script fragments, so that the compiling 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 the storage process, and the parameters include input parameters and output parameters. The automatic generation of the parameters saves the workload of manual input and also avoids the problem that the manual input is easy to make mistakes.
The route configuration module 7 is used to configure URL routing to provide service interface URLs exposed on external networks. And configuring a service interface URL which accords with RESTful specification according to the rule of the route resolver. The configuration parameters may provide resource name (english), operation name (english), PATH type parameters, etc.
The parameter configuration module 8 is used for configuring and managing the parameters generated by the parameter generation module 6, and configuring the data type, alias mapping, data validation rule and other attributes of the parameters.
The interface basic information module 9 is used for configuring and managing basic information such as an interface name, a parameter type (Query, form, body), a request mode (Get, post, put, delete, etc.), a scope group to which the service interface belongs, and the like.
The import-export module 10 is used for exporting and importing the configuration of the data source in a file form, exporting and importing the configuration of the script in a file form, exporting and importing the configuration of the service interface in a file form, and exporting and importing other configuration items.
The interface service is used for exposing the service interface to an external network, providing a calling party with access to the service interface, tracking and recording request access and other functions. The system consists of the following modules: a route registration module 11, a route analysis module 12, a logging 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 includes:
the route registration module 11 is used for registering the URL route of the service interface which is on line into the route manager according to the route information configured in the route configuration module 7 so as to provide the external access service.
The route parsing module 12 is used for parsing the URL requested by the caller (the URL provided by the route registration module 11) according to the routing rule and forwarding the URL to a matching method for execution and returning a response result to the caller.
The log recording module 13 is configured to record a full link request log, a script execution log, and a data audit log of the service interface. The log record is helpful for statistics of service interface access, troubleshooting of abnormal program operation information, analysis of data change of a positioning calling party and the like.
The authority authentication module 14 controls the access authority of the service interface by using modes such as ApiKey, oauth2.0 and the like, only the calling party with corresponding authority can access the service interface, and returns 401 unauthorized state codes to the calling party without authority, thereby effectively ensuring the security of the service interface.
The service gateway module 15 is used for performing non-business functions such as forwarding, interface aggregation, traffic limitation, service fusing, authority control, load balancing, etc. on the service interface request, and is used for protecting, enhancing and controlling access to the service interface, and the interface gateway is a system in front of an application program or service and is used for managing authorization, access control, traffic limitation, etc., so that the service interface is protected by the service gateway, and is transparent to all callers.
The interface debugging module 16 is used for calling the service interface on line in real time to test the availability of the service interface, so as to ensure that the created service interface can be validated in time and effectively.
And the interface document module 17 is used for automatically generating an online document of the online service interface so as to show and describe the relevant information of the service interface. A new service interface is created or a relevant 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.
And the route forwarding module 18 is configured to forward the URL parsed by the route parsing module to a corresponding processing function.
Description figure 4 provides services to which some of the modules belong.
This embodiment provides a dynamic management system for service interfaces, which can implement the dynamic management method of embodiment 1
The invention provides a dynamic management method and a dynamic management system for a service interface, which can simply and efficiently construct the service interface based on a visual platform without additional programming operation, thereby avoiding the repeated waste of resource cost. The programming logic inside the visual platform is relatively fixed, and when the visual platform faces different functions or is butted with different databases, the construction of the service interface is sequentially realized by filling different parameters in the visual interface, connecting the 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 does not need to be reprogrammed, so that the construction efficiency of the service interfaces is improved.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present invention. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. 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 invention numbers are merely for description and do not represent the merits of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present invention, however, the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.

Claims (11)

1. A dynamic management method for service interfaces is characterized by comprising the following steps:
based on a preset user request, configuring a data source of an interface through a preset visual interface, and creating at least one script which can access the data source and execute a related request;
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 architecture of the interface, and creating an initial service interface according to the first configuration information;
defining a response parameter and a request parameter of each script based on an initial service interface, and configuring the response parameter and the request parameter according to the second configuration information; defining an independent interface service to configure the accessibility of the 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, constructing an online document according to the second configuration information to show and describe the relevant information of the service interface, and configuring a log 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.
2. The dynamic management method according to claim 1, wherein the second configuration information includes routing information related to a URL for generating a service interface and request information related to an interface request method;
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 scripts are obtained;
editing parameter attributes including data types, data validation rules and aliases of each request parameter and each response parameter;
configuring the transmission format and response timeout time of the response parameters;
and configuring the authority authentication strategy of the service interface based on the second configuration information.
3. The dynamic management method of claim 1, wherein an independent interface service is defined in the default 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 caller can access the service interface through a URL (uniform resource locator);
after the routing registration is completed, automatically generating an online document of the service interface according to the second configuration information, and registering the online document to an interface document module of the interface service so as to display and describe relevant information of the service interface including an interface name, a request mode, a request parameter and a response parameter.
4. The dynamic management method according to claim 1, wherein the service interface is configured with a plurality of sets of data connection modes, each set of data connection mode corresponding 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 at the corresponding stage;
the environment of the service interface comprises a development environment of the service interface in a development stage, a test environment of the service interface in a test stage and a production environment of the service interface in an actual application stage.
5. The dynamic management method of claim 1, further comprising:
calling a direction service interface URL to initiate a request, wherein the request is accompanied with request parameters required by the service interface;
the interface service receives the request and starts to record through the log;
analyzing the URL through a route analysis module in the interface service and forwarding the URL to a preset processing function;
the authority verification of the request is carried out 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 log recording and finishing the request.
6. The dynamic management method of claim 1, further comprising:
screening out data sources recorded in the log and frequently accessed by a calling party;
analyzing whether the accessed time node of the data source meets a preset time condition:
if the preset time condition 1 related to the access times is met, a first link is established on the visual interface, and the 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 related to the access frequency is met, analyzing the time interval of two adjacent accesses of the data source to calculate the access frequency, constructing a second link on the visual interface, and automatically completing the access to the corresponding data source according to the access frequency by the second link to obtain the access result of each time;
and if the preset time condition 3 related to the access duration is met, constructing a third link on the visual interface, wherein the third link stores the operation data of the calling party in the service interface.
7. The dynamic management method according to claim 6, wherein the preset time condition 1 is that the number of times that a caller 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 for the same data source.
8. The dynamic management method according to claim 1, wherein the frequency of use of each script function is counted, and the script functions are sequentially ordered from large to small;
screening 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 the script templates and connected with corresponding data sources.
9. The dynamic management method of claim 1, wherein the items with changeable parameters in the service interface are screened out based on the request parameters to obtain adjustable items;
when one or more parameters of the adjustable item are changed, generating historical data of one version, and creating a backup document to backup the historical data of each version of the adjustable item;
when the caller has the preset recovery right, the caller can call any version historical data from the backup document to recover the service interface so as to obtain the service interface under the version historical data.
10. A dynamic management system of service interfaces, characterized in that it is used to implement a dynamic management method of service interfaces according to any one of claims 1-9; the dynamic management system comprises a configuration management service; the configuration management service includes:
the data source adapter module is used for managing various data sources;
the script analysis module is used for analyzing the script, performing operation corresponding to the instruction on the data source through the execution script and obtaining a corresponding execution result;
the script editor module is used as an editor for compiling scripts, can carry out real-time grammar detection and intelligent prompt on the compiled scripts and can store script fragments in a keyword form;
the parameter generation module is used for generating corresponding parameters and data types according to the script or the storage process;
a route configuration module for configuring the URL route of the service interface to provide the URL exposed in the external network;
the parameter configuration module is used for configuring and managing the parameters generated by the parameter generation module, and configuring the data attributes of the parameters, including the data type, the alias mapping and the data verification rule;
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 affiliated scope groups;
and the import and export module is used for exporting and importing the preset configuration items in a file form, and comprises the steps of exporting and importing the configuration of the data source in the file form, exporting and importing the configuration of the script in the file form, and exporting and importing the configuration of the service interface in the file form.
11. The dynamic management system of claim 10, further comprising an interface service, the interface service comprising:
the route registration module is used for registering the URL route of the on-line service interface into 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 a full link request log, a script execution log and a 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 unauthorized state codes to calling parties without the authority;
the service gateway module is used for forwarding service interface requests, aggregating interfaces, limiting flow, fusing services, controlling authority and balancing loads, and protecting, enhancing and controlling access to the service interfaces;
the interface debugging module is used for calling the service interface on line in real time so as to test the usability of the service interface and ensure that the created service interface can be timely and effectively verified by the usability;
and the interface document module is used for automatically generating an online document of the online service interface so as to show and describe the relevant 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 true CN115309566A (en) 2022-11-08
CN115309566B 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)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627486A (en) * 2023-07-25 2023-08-22 中博信息技术研究院有限公司 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
CN117193990A (en) * 2023-11-08 2023-12-08 建信金融科技有限责任公司 Scheduling management method, device, equipment and storage medium of http interface
CN117354114A (en) * 2023-12-05 2024-01-05 北京捷泰天域信息技术有限公司 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

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116627486A (en) * 2023-07-25 2023-08-22 中博信息技术研究院有限公司 Compact configuration type rest interface management and message conversion method and device
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
CN117193990A (en) * 2023-11-08 2023-12-08 建信金融科技有限责任公司 Scheduling management method, device, equipment and storage medium of http interface
CN117193990B (en) * 2023-11-08 2024-02-23 建信金融科技有限责任公司 Scheduling management method, device, equipment and storage medium of http interface
CN117354114A (en) * 2023-12-05 2024-01-05 北京捷泰天域信息技术有限公司 Data service release method and system based on cloud native architecture
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

Also Published As

Publication number Publication date
CN115309566B (en) 2023-09-05

Similar Documents

Publication Publication Date Title
CN115309566B (en) Dynamic management method and system for service interface
CN108268253B (en) Interface code generation method and terminal equipment
US7647370B1 (en) Screen scraping interface
US8141043B2 (en) Automated business process testing that spans multiple platforms or applications
US20050160104A1 (en) System and method for generating and deploying a software application
CN107273286A (en) For the scene automatic test platform and method of task application
US20040139176A1 (en) Systems and methods for improving service delivery
KR102417742B1 (en) API Data Aggregation System And Method Of The Same
CN108628748B (en) Automatic test management method and automatic test management system
AU2015271640A1 (en) Telecommunications product defining and provisioning
US20060147020A1 (en) Method for automatic graphical profiling of a system
CN109344075A (en) Configuration method, test method, configuration server and service node device
CN101727475A (en) Method, device and system for acquiring database access process
CN111880839A (en) API processing method and device
CN114398293A (en) Interface test case generation method, electronic device and storage medium
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN113918149A (en) Interface development method and device, computer equipment and storage medium
CN116719735A (en) Test case generation method and device
GB2411984A (en) Updating forms
CN115407981A (en) Front-end data mock method and system based on middleware adaptation
CN112256595B (en) Heterogeneous system testing method and device and electronic equipment
CN114756224A (en) Activity execution method and device
CN114610803A (en) Data processing method and device, electronic equipment and storage medium
CN117407456B (en) Structured data sharing system for nuclear power service
CN114816579B (en) SaaS chemical industrial APP access method based on industrial Internet platform

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