CN111381820A - Method and device for automatically generating API based on GUI - Google Patents

Method and device for automatically generating API based on GUI Download PDF

Info

Publication number
CN111381820A
CN111381820A CN201811643896.XA CN201811643896A CN111381820A CN 111381820 A CN111381820 A CN 111381820A CN 201811643896 A CN201811643896 A CN 201811643896A CN 111381820 A CN111381820 A CN 111381820A
Authority
CN
China
Prior art keywords
api
query parameters
gui
parameters
database
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.)
Pending
Application number
CN201811643896.XA
Other languages
Chinese (zh)
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.)
Beijing Shuju Xinyun Information Technology Co ltd
Original Assignee
Beijing Shuju Xinyun 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 Beijing Shuju Xinyun Information Technology Co ltd filed Critical Beijing Shuju Xinyun Information Technology Co ltd
Priority to CN201811643896.XA priority Critical patent/CN111381820A/en
Publication of CN111381820A publication Critical patent/CN111381820A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention discloses a method and a device for automatically generating an API based on a GUI. The disclosed method comprises: determining front-end query parameters involved by the API based on the GUI; determining back-end query parameters involved by the API based on the GUI; determining a mapping relationship between the front-end query parameters and the back-end query parameters based on the GUI; the API is automatically generated based on the front-end query parameters, the back-end query parameters, and the mapping relationships. The technical scheme can obtain the front-end query parameter and the back-end query parameter corresponding to the API and the mapping relation between the front-end query parameter and the back-end query parameter based on the GUI, and directly generate the API.

Description

Method and device for automatically generating API based on GUI
Technical Field
The invention relates to the technical field of computer network application, in particular to a method and a device for automatically generating an API (application program interface) based on a GUI (graphical user interface).
Background
In the development process of computer network application programs, a complex and heavy SOAP (simple object access protocol) protocol is initially adopted for the design and development of an application program interface API (application programming interface), although a REST (representational State transfer) style software architecture mode quickly replaces SOAP and becomes a standard of a Web API, due to the relation and the complex operation of resource sets, even when the REST specification is rigidly applied for design, it is still very difficult to obtain flexible, easy-to-maintain, efficient and low-cost applications.
For example, in the prior art, when an API is constructed, the following two mainstream construction methods are mainly adopted:
1. developers write codes directly to build the API (for example, usually, fixed database query statements are written directly in the API, and the fixed database query statements are not easy to modify and difficult to maintain).
2. The original API is converted or upgraded by a business or developer through the API gateway of the third-party service provider (this process also typically does not involve performing the underlying database query operation directly).
The first construction method requires a large amount of manpower, material resources and time cost, and is low in efficiency, difficult to maintain, inflexible, and difficult to quickly respond to changes in business requirements. Although the second construction method reduces the cost of API construction to some extent and improves the development efficiency of API, it is difficult to functionally expand and modify the converted API because it depends on the original API.
In addition to the above two approaches, there is a third, non-mainstream, way to construct the API directly from the database in the prior art. A few foreign API service providers are already preparing to provide products for directly constructing APIs from databases, but are not popular at present, and because API related information and database related information are mixed together, the products are not easy to reuse, maintain, manage and expand.
In order to solve the above problems, a new technical solution needs to be proposed.
Disclosure of Invention
The method for automatically generating the API based on the GUI comprises the following steps:
determining front-end query parameters involved by the API based on the GUI;
determining back-end query parameters involved by the API based on the GUI;
determining a mapping relationship between the front-end query parameters and the back-end query parameters based on the GUI;
the API is automatically generated based on the front-end query parameters, the back-end query parameters, and the mapping relationships.
The method for automatically generating the API based on the GUI further comprises the following steps:
pre-acquiring all available front-end query parameters; and/or
Querying by pre-connecting a back-end database to obtain all available back-end query parameters; and/or
Displaying all available front-end query parameters on a GUI for selection by a user; and/or
All available backend query parameters are displayed on the GUI for selection by the user.
The method for automatically generating the API based on the GUI further comprises the following steps:
the API documents are automatically generated based on the front-end query parameters, the back-end query parameters, the mapping relationships, and the API.
The method for automatically generating the API based on the GUI further comprises the following steps:
the mapping relationship is stored based on JSON.
According to the method for automatically generating the API based on the GUI, the back-end query parameter comprises at least one of the following items: the IP address of the database, the port number of the database, the type of the database, the name of the database, the user name, the password, the name of the schema, the name of the table, the name of the query field, the query condition and the query result output format setting parameters related to the rear-end SQL query statement, and the front-end query parameters comprise: the parameters, corresponding to the back-end query parameters, API's conform to the REST specification,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
The device for automatically generating the API based on the GUI comprises the following components:
the GUI module is used for determining front-end query parameters related to the API, determining rear-end query parameters related to the API and determining a mapping relation between the front-end query parameters and the rear-end query parameters;
and the API automatic generation module is used for automatically generating the API based on the front-end query parameters, the back-end query parameters and the mapping relation.
The device for automatically generating the API based on the GUI also comprises:
the parameter pre-acquisition module is used for pre-acquiring all available front-end query parameters; and/or
Obtaining all available backend query parameters, and/or by pre-connecting a backend database for querying
The GUI module is further to:
displaying all available front-end query parameters for selection by a user; and/or
And displaying all available back-end query parameters for selection by a user.
The device for automatically generating the API based on the GUI also comprises:
and the API document automatic generation module is used for automatically generating the API document based on the front-end query parameters, the back-end query parameters, the mapping relation and the API.
The device for automatically generating the API based on the GUI also comprises:
and the storage module is used for storing the mapping relation based on JSON.
According to the device for automatically generating the API based on the GUI, the back-end query parameter comprises at least one of the following items: the IP address of the database, the port number of the database, the type of the database, the name of the database, the user name, the password, the name of the schema, the name of the table, the name of the query field, the query condition and the query result output format setting parameters related to the rear-end SQL query statement, and the front-end query parameters comprise: the parameters, corresponding to the back-end query parameters, API's conform to the REST specification,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
According to the technical scheme of the invention, the front-end query parameter and the back-end query parameter corresponding to the API and the mapping relation between the front-end query parameter and the back-end query parameter can be obtained based on the GUI, and the API can be directly generated.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention. In the drawings, like reference numerals are used to indicate like elements. The drawings in the following description are directed to some, but not all embodiments of the invention. For a person skilled in the art, other figures can be derived from these figures without inventive effort.
FIG. 1 schematically shows a schematic flow diagram of a method for automatically generating an API based on a GUI according to the present invention.
Fig. 2 exemplarily shows a schematic block diagram of an apparatus for automatically generating an API based on a GUI according to the present invention.
Fig. 3 shows a schematic diagram of a data structure that may be used according to an aspect of the invention.
Fig. 4 shows one specific example for binding extension information in API base information.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
FIG. 1 schematically shows a schematic flow diagram of a method for automatically generating an API based on a GUI according to the present invention.
As shown in a solid line box of fig. 1, the method for automatically generating an API based on a GUI according to the present invention includes:
step S102: determining front-end query parameters involved by the API based on the GUI;
step S104: determining back-end query parameters involved by the API based on the GUI;
step S106: determining a mapping relationship between the front-end query parameters and the back-end query parameters based on the GUI;
step S108: the API is automatically generated based on the front-end query parameters, the back-end query parameters, and the mapping relationships.
Optionally, as shown in the dashed box of fig. 1, the method for automatically generating an API based on a GUI according to the present invention further includes:
step S110: pre-acquiring all available front-end query parameters; and/or
Step S112: querying by pre-connecting a back-end database to obtain all available back-end query parameters; and/or
Step S114: displaying all available front-end query parameters on a GUI for selection by a user; and/or
Step S116: all available backend query parameters are displayed on the GUI for selection by the user.
For example, corresponding to step S112, the connection with the database can be established after the access authority to connect the database is acquired. Only after the connection with the database is established, the authority to operate the data is provided.
Optionally, as shown in the dashed box of fig. 1, the method for automatically generating an API based on a GUI according to the present invention further includes:
step S118: the API documents are automatically generated based on the front-end query parameters, the back-end query parameters, the mapping relationships, and the API.
Optionally, as shown in the dashed box of fig. 1, the method for automatically generating an API based on a GUI according to the present invention further includes:
step S120: the mapping relationship is stored based on JSON.
Optionally, the back-end query parameter includes at least one of the following: the IP address of the database, the port number of the database, the type of the database, the name of the database, the user name, the password, the name of the schema, the name of the table, the name of the query field, the query condition and the query result output format setting parameters related to the rear-end SQL query statement, and the front-end query parameters comprise: the API conforms to the REST specification (i.e., encapsulates the API into a RESTful interface) for the parameters corresponding to the back-end query parameters,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
Although, as described above, according to the above technical solution of the present invention, the API can be directly generated based on the underlying database. The types of the bottom layer database comprise mainstream database types such as Oracle, MySQL, SQL Server, PostgreSQL and the like.
However, the above technical solution according to the present invention is also applicable to generating an API suitable for a query operation of a non-database data file based on any other data file (e.g. a general data file) in a non-database form. The database information related to the technical scheme is only required to be correspondingly changed into the information of the related non-database file.
For example, corresponding to step S112, a database connection may be established through the IP address of the database and the port number of the database. The relevant connection information of the database service comprises a database type, a database service address, a port number, a user name, a password, a schema and the like. The access rights of different users to a given database can be guaranteed by means of the user name and password mentioned above.
In addition, when a certain API is actually called, the connection information is also needed to establish connection with the database, and is used for indexing and finding the database related information corresponding to the API, and after finding, the database connection information is read, and the operation of adding, deleting and modifying (corresponding to the backend SQL query statement) is authorized only after establishing connection with the database.
For example, the above technical solution according to the present invention may be performed by the following exemplary steps:
1. corresponding to step S116 above, all available backend query parameters displayed on the GUI include: information for all tables or views in all databases.
2. Corresponding to step S104 above, a user (e.g., a developer or a service person) may determine (e.g., optionally select, corresponding to the front-end query parameter determined in step S102) a specific back-end query parameter (e.g., a data table to be queried, a field, a query condition, a query result output format setting parameter, etc.) involved by the API based on the list information on the GUI.
That is, after the database service connection is established, the database, the schema and the specific data table for generating the API can be selected according to actual requirements. The finally generated API is used for operating a specific data table and data in the table. Information such as the data table structure used is acquired in step S104.
3. Corresponding to the step S106, a mapping relationship between API parameters (corresponding to the front-end query parameters) and data table fields (corresponding to the back-end query parameters) is established.
4. Corresponding to the above step S108, an API is automatically generated based on the front-end query parameter, the back-end query parameter, and the mapping relationship.
For example, for each of the above steps (e.g., step S102 to step S106) related to GUI interaction, various configuration rules can be manually set, and these configuration rules are finally converted into SQL expressions for performing add, delete, modify and modify operations on the database and are called by the API.
For example, the information required for configuration can be divided into two major parts:
1. API interface related information (corresponding to the front-end query parameters, and the specific configuration operation thereof corresponds to the step S102).
For example, the request method, request path, description information, request timeout time, request parameters and their types of the API, etc. Examples of interface information are as follows:
2. the database SQL related information (corresponding to the back-end query parameters, the specific configuration operation thereof corresponds to the step S104).
For example, the data field and its type to be changed by adding or deleting, the WHERE condition of SQL, ORDERBY, group, etc.
When the SQL statement needs to be called through the API and a query is performed on a certain field in the database, a mapping relationship between the API interface related information and the database SQL related information is needed. For example, when the SQL expression contains a WHERE clause, it is also necessary to map fields in the WHERE clause with parameters defined in the API.
Only when the relevant information of the API interface and the relevant information of the database SQL generate correct mapping relation, the API interface is called to automatically and indirectly execute the corresponding SQL, thereby realizing the aim of database operation interfacing. And step S106 is a step for ensuring the correctness of such a mapping relationship.
Corresponding to step S108 above, after steps S102 to S106 are completed, it is necessary to automatically generate an API according to the existing mapping relationship between the specified request parameters and the data table fields.
For example, step S108 may include the following specific operations:
1. the existing mapping between the specified request parameters and the data table fields is stored (corresponding to step S120 described above).
For example, all relevant configuration information generated by the configuration operations performed in steps S102 to S106 may be packaged (stored) into one data structure (which may be defined in JSON format, for example), which may be named KarstSQL.
2. And packaging all configuration items into a standard Restful interface for an external system or a developer to use.
For example, the REST-compliant (i.e., standard RESTful) API may perform a call/translation of SQL query statements (corresponding to the parameter mapping) for data addition, deletion, modification, query, etc. to the database.
According to the technical scheme of the invention, the parameter name (corresponding to the back-end query parameter) in the SQL expression can be automatically replaced by the dynamically-transmitted request parameter name (corresponding to the front-end query parameter), so that a complete executable SQL expression is formed, and the function of dynamically operating the data through API call (namely, the mapping relation between the parameters only needs to be configured once through a GUI, and if the front end and the back end are not changed, the data does not need to be modified in subsequent use) is realized. When the API is called to dynamically pass the parameters, the database can be dynamically operated. Dynamic query, update, deletion and the like of dynamic data of the data in the data table are realized through dynamic parameter transmission of the API interface.
For example, after a database query calling an SQL expression including a WHERE clause is API-formed, a query condition parameter (parameter is variable) in the API needs to be used to replace a query condition parameter (variable or constant) in the WHERE clause part of the database query, and in the final SQL expression, the condition of the WHERE clause is formed by parameter values and mapping relations that are introduced by a caller when the API is called. Therefore, the SQL query is dynamically transmitted and determined in the API calling process, and a new SQL does not need to be generated in each query.
Fig. 2 exemplarily shows a schematic block diagram of an apparatus for automatically generating an API based on a GUI according to the present invention.
As shown in a solid line box of fig. 2, the apparatus 200 for automatically generating an API based on a GUI according to the present invention includes:
the GUI module 201 is configured to determine a front-end query parameter related to the API, determine a back-end query parameter related to the API, and determine a mapping relationship between the front-end query parameter and the back-end query parameter;
and the API automatic generation module 203 is used for automatically generating the API based on the front-end query parameters, the back-end query parameters and the mapping relation.
Optionally, as shown in the dashed box of fig. 2, the apparatus 200 for automatically generating an API based on a GUI further includes:
a parameter pre-obtaining module 205, configured to obtain all available front-end query parameters in advance; and/or
Obtaining all available backend query parameters, and/or by pre-connecting a backend database for querying
The GUI module 201 is further configured to:
displaying all available front-end query parameters for selection by a user; and/or
And displaying all available back-end query parameters for selection by a user.
Optionally, as shown in the dashed box of fig. 2, the apparatus 200 for automatically generating an API based on a GUI further includes:
and the API document automatic generation module 207 is used for automatically generating the API document based on the front-end query parameters, the back-end query parameters, the mapping relation and the API.
Optionally, as shown in the dashed box of fig. 2, the apparatus 200 for automatically generating an API based on a GUI further includes:
and the storage module 209 is used for storing the mapping relation based on JSON.
Optionally, the back-end query parameter includes at least one of the following: the IP address of the database, the port number of the database, the type of the database, the name of the database, the user name, the password, the name of the schema, the name of the table, the name of the query field, the query condition and the query result output format setting parameters related to the rear-end SQL query statement, and the front-end query parameters comprise: the parameters, corresponding to the back-end query parameters, API's conform to the REST specification,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
In order to make the technical solution according to the present invention more clearly understood by those skilled in the art, the JSON data structure named KarstSQL will be described below with reference to specific embodiments.
For example, the KarstSQL data structure may contain the following two specific data structures:
1. a first (corresponding to the base) data structure for describing first configuration information (e.g., including the front-end query parameters described above) about the API.
The first data structure is stored in units of API interfaces, where the specific parameters stored may include: request method, request path, request parameters, description information, response information, etc. of each API interface. Can be used as a complete API basic module.
2. A second (corresponding to an extension) data structure for describing second configuration information (e.g., including the back-end query parameters described above) about the database.
The second data structure is stored in units of database services, where the specific parameters stored may include: all information related to each database service. Can be used as a complete expansion module.
For example, for a solution (i.e., a project application developed for a user), a plurality of first data structures may be employed to store basic information (corresponding to the front-end query parameters) corresponding to different APIs, respectively; multiple second data structures may also be employed to store extended information (corresponding to the back-end query parameters described above) corresponding to different database services, respectively.
The first data structure and the second data structure are adopted to store the first configuration information about the API and the second configuration information about the database respectively, so that the following advantages are achieved:
when the API relevant problem occurs, only the basic information part of KarstSQL needs to be maintained; when the problems of database connection and SQL expression occur, only the extended information part of KarstSQL needs to be maintained.
Fig. 3 shows a schematic diagram of a data structure that may be used according to an aspect of the invention.
As shown in fig. 3, the basic information may be described and stored by using the first data structure, and the extended information may be described and stored by using the second data structure.
The base information may include information common to multiple different APIs (e.g., root directory/test, host address 122.190.237.156), as well as other parameter sets for the respective APIs (corresponding to the aforementioned front-end query parameters, corresponding to the paths in fig. 3).
Configuration information of a plurality of databases (corresponding to dataSource _ No.1 and dataSource _ No.2 in fig. 3) may be included in the extension information. The configuration information of each database includes database information (corresponding to dataSource in fig. 3) common to a plurality of different SQL query statements, and other parameter sets (corresponding to the above-mentioned backend query parameters, corresponding to SQL _ No. x in fig. 3, x being a natural number) of the respective SQL query statements.
All information of the SQL query may be contained within a specific SQL No. x object as shown in fig. 3 (x is an automatically numbered number).
For example, the sql No. x object may contain the following four member objects: sqlParams, sqlElements, echoColumns, modifyTimestamp.
Wherein, the sqlParams is used for storing the request parameters in the configuration rule; the sqlElements are used for storing the type of SQL query, the table or view of query, the data table field of query, query conditions, paging, sorting (corresponding to the query result output format setting parameters) and other database query related information; the echoColumns are used for storing response fields or information and carrying out corresponding processing on the fields or the information; modifytestamp basically records the time when the SQL query message is modified.
For example, API interface request parameters (corresponding to the front-end query parameters) in the basic information part have a mapping relationship with data table fields (corresponding to the back-end query parameters) in the extended information part, and only if the mapping relationships of the two parts of information can be correctly corresponded, the dynamic parameters of the API can trigger the dynamic operation of SQL.
Fig. 4 shows one specific example for binding extension information in API base information.
As shown in FIG. 4, API "/deleteTest" binds the SQL query statement # SQL _ No.5 in dataSource _ No.1 in the extension information. This is achieved by setting x-requestsqlId and x-datasourceId to 5 (corresponding to sql _ No.5) and 1(dataSource _ No.1), respectively, in the API grounding information.
As shown in fig. 4, by binding the extension information to a specific API relationship, the above-described function of automatically generating an API based on a database can be realized. In addition, when the API is abnormal, the abnormal positioning and maintenance can be more efficiently carried out.
After binding the API base information and extension information according to the example of FIG. 4, an API can be automatically generated. For example, the key step in the API, the step of generating the SQL query statement, may be automatically generated by the following specific operations:
the front-end query parameters of the API and the back-end query parameters of the database may be associated according to the unique identifier corresponding to the API and the bound extension information (i.e., the database related information).
For example, when the SQL statement called by the API includes a WHERE clause, the parameter names after the SELECT and FROM keywords in the SQL statement are replaced by the corresponding input parameter names of the API based on the mapping relationship (e.g., the field mapping relationship), and the parameter names in the WHERE clause in the SQL statement are also replaced by the corresponding input parameter names of the API, so as to dynamically compose a complete expression SQL.
When API call operation is executed, the input parameter value from the API is automatically used to replace the corresponding input parameter value in the SQL statement, the SQL statement is executed, the data inquired by the SQL statement is obtained, and the data is output in the data format required by the API (namely, the SQL inquiry result is returned to the API according to the response format of the API), so that the whole API call operation is completed.
In order to make the above key steps for automatically generating the SQL query statement more clearly understood by those skilled in the art, the following gives a specific example of automatically generating the SQL statement based on API configuration information and database configuration information (information stored corresponding to the above JSON data structure named KarstSQL, where the database configuration information includes an SQL No. x object as shown in table 1).
Table 1: sql No. x object example
Figure BDA0001931643400000121
Figure BDA0001931643400000131
Figure BDA0001931643400000141
Figure BDA0001931643400000151
Based on the SQL No. x object example shown in table 1, the final generated SQL statement is as follows:
SELECT id,name,password,email,image,phone,user_type,organization,status,user_role,created,updated FROM USER WHERE name LIKE‘%query:name%’ANDpassword=‘header:password’AND(email=‘query:email’OR phone=‘query:phone’ORDER BY name DESC,phone ASC)
wherein, the% query is that the name% corresponds to the 'paramName': name & query 'in the table 1, the head is that the password corresponds to the' paramName ': password & head' in the table 1, the 'query is that the email' corresponds to the 'paramName': email & query 'in the table 1, and the' query is that the phone 'corresponds to the' paramName ': phone & query' in the table 1.
According to the technical scheme of the invention, the method has the following advantages:
1. the API can be directly generated by acquiring the front-end query parameters, the back-end query parameters (SQL query expressions corresponding to the back-end database) and the mapping relation between the front-end query parameters and the back-end query parameters corresponding to the API based on the GUI.
2. The API can be generated by selecting the corresponding configuration parameter through information (e.g., form information) displayed on the GUI. The above-described apparatus implementing this scheme may be referred To as a D2A (Database To API) system. By the system, the database can be rapidly inquired into API, developers and even business personnel can construct an available API within a few seconds, codes do not need to be written in the whole process, the system does not depend on original developers, the workload of the developers is reduced, the development cost and the maintenance cost of the API are reduced, and the development efficiency of the API is greatly improved.
3. Two parts of information involved in API construction, namely database related information (corresponding to the back-end query parameters) and API related information (corresponding to the front-end query parameters), can be efficiently combined (associated) to automatically form a usable API.
4. The generated API can dynamically combine API parameters (corresponding to the front-end query parameters) with queries of database fields (corresponding to the back-end query parameters). For example, the corresponding relation between the self-defined dynamic parameters and the database fields, the database table to be queried, the fields, the conditions and the like can be combined and modularized, and the purpose of uniformly designing, managing and maintaining all SQL expressions involved in the API construction process is achieved.
5. The SQL related information (corresponding to the back-end query parameters) and the API related information (corresponding to the front-end query parameters) are isolated from each other, so that the SQL related information and the API related information are convenient to manage, maintain, upgrade and reuse.
6. The loosely-coupled expansion form is easier to add or delete queries, and does not affect other SQL queries.
7. And the module is subdivided in the extension, so that different parts of a query are processed more, and stronger functions are provided.
8. And the API information is flexibly matched and used, the production quality and efficiency of the API are improved, and the development, operation and maintenance costs are reduced.
The above-described aspects may be implemented individually or in various combinations, and such variations are within the scope of the present invention.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
Finally, it should be noted that: the above examples are only for illustrating the technical solutions of the present invention, and are not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for automatically generating an API based on a GUI, comprising:
determining front-end query parameters involved by the API based on the GUI;
determining back-end query parameters involved by the API based on the GUI;
determining a mapping relationship between the front-end query parameters and the back-end query parameters based on the GUI;
and automatically generating an API based on the front-end query parameters, the back-end query parameters and the mapping relation.
2. The method for automatically generating an API based on a GUI of claim 1, further comprising:
pre-acquiring all available front-end query parameters; and/or
Querying by pre-connecting a back-end database to obtain all available back-end query parameters; and/or
Displaying all available front-end query parameters on a GUI for selection by a user; and/or
All available backend query parameters are displayed on the GUI for selection by the user.
3. The method for automatically generating an API based on a GUI of claim 1, further comprising:
automatically generating an API document based on the front-end query parameters, the back-end query parameters, the mapping relationship, and the API.
4. The method for automatically generating an API based on a GUI of claim 1, further comprising:
storing the mapping relationship based on JSON.
5. The method for automatically generating an API based on a GUI of claim 1, wherein the back-end query parameters include at least one of: the method comprises the following steps of setting parameters of an IP address of a database, a port number of the database, a database type, a database name, a user name, a password, a schema name, a table name, a query field name, a query condition and a query result output format related to a rear-end SQL query statement, wherein the front-end query parameters comprise: the API conforms to the REST specification for parameters corresponding to the back-end query parameters,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
6. An apparatus for automatically generating an API based on a GUI, comprising:
the GUI module is used for determining front-end query parameters related to the API, determining rear-end query parameters related to the API and determining a mapping relation between the front-end query parameters and the rear-end query parameters;
and the API automatic generation module is used for automatically generating the API based on the front-end query parameters, the back-end query parameters and the mapping relation.
7. The GUI-based apparatus for automatically generating APIs according to claim 6 further comprising:
the parameter pre-acquisition module is used for pre-acquiring all available front-end query parameters; and/or
Obtaining all available backend query parameters, and/or by pre-connecting a backend database for querying
The GUI module is further to:
displaying all available front-end query parameters for selection by a user; and/or
And displaying all available back-end query parameters for selection by a user.
8. The GUI-based apparatus for automatically generating APIs according to claim 6 further comprising:
and the API document automatic generation module is used for automatically generating the API document based on the front-end query parameters, the back-end query parameters, the mapping relation and the API.
9. The GUI-based apparatus for automatically generating APIs according to claim 6 further comprising:
and the storage module is used for storing the mapping relation based on JSON.
10. The GUI-based apparatus for automatically generating APIs according to claim 6, wherein the back-end query parameters comprise at least one of the following: the method comprises the following steps of setting parameters of an IP address of a database, a port number of the database, a database type, a database name, a user name, a password, a schema name, a table name, a query field name, a query condition and a query result output format related to a rear-end SQL query statement, wherein the front-end query parameters comprise: the API conforms to the REST specification for parameters corresponding to the back-end query parameters,
wherein the database types include: oracle, MySQL, SQL Server, PostgreSQL.
CN201811643896.XA 2018-12-29 2018-12-29 Method and device for automatically generating API based on GUI Pending CN111381820A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811643896.XA CN111381820A (en) 2018-12-29 2018-12-29 Method and device for automatically generating API based on GUI

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811643896.XA CN111381820A (en) 2018-12-29 2018-12-29 Method and device for automatically generating API based on GUI

Publications (1)

Publication Number Publication Date
CN111381820A true CN111381820A (en) 2020-07-07

Family

ID=71216738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811643896.XA Pending CN111381820A (en) 2018-12-29 2018-12-29 Method and device for automatically generating API based on GUI

Country Status (1)

Country Link
CN (1) CN111381820A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113766030A (en) * 2021-09-13 2021-12-07 城云科技(中国)有限公司 Automatic parameter entering method and device for interface constant parameters
CN114153438A (en) * 2022-02-07 2022-03-08 宜科(天津)电子有限公司 API automatic generation system
WO2022048676A1 (en) * 2020-09-07 2022-03-10 华为云计算技术有限公司 Api generation method and apparatus
CN115454682A (en) * 2022-11-11 2022-12-09 成都智元汇信息技术股份有限公司 Generation method, device and system of multi-tenant API (application program interface)
CN116541455A (en) * 2023-07-06 2023-08-04 杭州美创科技股份有限公司 Interface data integration method, device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104040537A (en) * 2011-11-24 2014-09-10 瓦欧尼斯系统有限公司 Systems and methods of automatic generation and execution of database queries
CN104123331A (en) * 2013-09-26 2014-10-29 腾讯科技(深圳)有限公司 Data querying method, device and system of client end application
US20180059921A1 (en) * 2016-09-01 2018-03-01 Honeywell International Inc. Custom gui control for visualizing field data
CN107844297A (en) * 2017-10-17 2018-03-27 广东广业开元科技有限公司 A kind of data visualization realizes system and method
CN108170426A (en) * 2018-01-15 2018-06-15 浙江大学 A kind of RESTful API code automatic generation methods based on ontology

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104040537A (en) * 2011-11-24 2014-09-10 瓦欧尼斯系统有限公司 Systems and methods of automatic generation and execution of database queries
CN104123331A (en) * 2013-09-26 2014-10-29 腾讯科技(深圳)有限公司 Data querying method, device and system of client end application
US20180059921A1 (en) * 2016-09-01 2018-03-01 Honeywell International Inc. Custom gui control for visualizing field data
CN107844297A (en) * 2017-10-17 2018-03-27 广东广业开元科技有限公司 A kind of data visualization realizes system and method
CN108170426A (en) * 2018-01-15 2018-06-15 浙江大学 A kind of RESTful API code automatic generation methods based on ontology

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
BENBALTER: ""project-open-data/db-to-api"", pages 1 - 3, Retrieved from the Internet <URL:《https://github.com/project-open-data/db-to-api》> *
GISSYNC: ""一分钟"零代码"生成API,DataWorks数据服务快速上手指南"", 《HTTPS://DEVELOPER.ALIYUN.COM/ARTICLE/662126》, 31 October 2018 (2018-10-31), pages 5 - 6 *
GISSYNC: ""一分钟"零代码"生成API,DataWorks数据服务快速上手指南"", pages 5 - 6, Retrieved from the Internet <URL:《https://developer.aliyun.com/article/662126》> *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022048676A1 (en) * 2020-09-07 2022-03-10 华为云计算技术有限公司 Api generation method and apparatus
CN113766030A (en) * 2021-09-13 2021-12-07 城云科技(中国)有限公司 Automatic parameter entering method and device for interface constant parameters
CN114153438A (en) * 2022-02-07 2022-03-08 宜科(天津)电子有限公司 API automatic generation system
CN115454682A (en) * 2022-11-11 2022-12-09 成都智元汇信息技术股份有限公司 Generation method, device and system of multi-tenant API (application program interface)
CN116541455A (en) * 2023-07-06 2023-08-04 杭州美创科技股份有限公司 Interface data integration method, device, computer equipment and storage medium
CN116541455B (en) * 2023-07-06 2023-09-22 杭州美创科技股份有限公司 Interface data integration method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108228817B (en) Data processing method, device and system
CN111240763B (en) Configuration updating method, device, equipment and storage medium
CN111381820A (en) Method and device for automatically generating API based on GUI
US9672053B2 (en) Service request processing
US10044522B1 (en) Tree-oriented configuration management service
US10120886B2 (en) Database integration of originally decoupled components
US20080005623A1 (en) System and method for model-based user interface using transformation nodes
CN106033439A (en) Method and system for processing distributed transaction
US20180293257A1 (en) Method for accessing distributed database and distributed data service apparatus
US8868597B2 (en) Directory server processing requests based on hierarchical models while using backend servers operating based on relational models
CN110941634A (en) Data processing method and device, storage medium and electronic device
CN111198678A (en) Method and device for generating GraphQL front-end operation interface
CN113779452B (en) Data processing method, device, equipment and storage medium
CN116233217B (en) Page jump method and device based on route, electronic equipment and storage medium
CN112491943A (en) Data request method, device, storage medium and electronic equipment
US20230099501A1 (en) Masking shard operations in distributed database systems
CN106559454B (en) Resource access method, device and system
CN109117152B (en) Service generation system and method
CN113779068A (en) Data query method, device, equipment and storage medium
CN115017185A (en) Data processing method, device and storage medium
CN113424174A (en) Recursive data traversal model
CN116594848B (en) Task monitoring method, device, equipment, terminal equipment and storage medium
CN115994145B (en) Method and device for processing data
US11461302B1 (en) Storing multiple instances of data items to implement key overloading in database tables
WO2023050815A1 (en) Slice service configuration method, network device, network system, and storage medium

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