CN109144512B - Method and system for generating API - Google Patents
Method and system for generating API Download PDFInfo
- Publication number
- CN109144512B CN109144512B CN201810962669.7A CN201810962669A CN109144512B CN 109144512 B CN109144512 B CN 109144512B CN 201810962669 A CN201810962669 A CN 201810962669A CN 109144512 B CN109144512 B CN 109144512B
- Authority
- CN
- China
- Prior art keywords
- api
- generating
- rules
- defining
- engine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims description 24
- 239000008186 active pharmaceutical agent Substances 0.000 claims description 28
- 230000002085 persistent effect Effects 0.000 claims description 5
- 230000006870 function Effects 0.000 description 25
- 238000007726 management method Methods 0.000 description 17
- 238000010586 diagram Methods 0.000 description 5
- 238000012544 monitoring process Methods 0.000 description 4
- 230000000007 visual effect Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 238000012800 visualization Methods 0.000 description 2
- VUKZWUYSEFVTRB-OSWZUBHSSA-N (4r)-4-[(3r,5r,8r,9s,10s,13r,14s,17r)-3-hydroxy-7,10,13-trimethyl-2,3,4,5,6,7,8,9,11,12,14,15,16,17-tetradecahydro-1h-cyclopenta[a]phenanthren-17-yl]pentanoic acid Chemical compound C([C@H]1CC2C)[C@H](O)CC[C@]1(C)[C@@H]1[C@@H]2[C@@H]2CC[C@H]([C@@H](CCC(O)=O)C)[C@@]2(C)CC1 VUKZWUYSEFVTRB-OSWZUBHSSA-N 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013499 data model Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
Abstract
The invention relates to the generation of API, including selecting the required function engine and bottom storage module; defining rules embodying business logic of the API; defining input parameters and output of the API; and generating an ID of the API. The invention can realize the flexible and quick generation of the API.
Description
Technical Field
The invention relates to computer technology, in particular to a method and a system for generating an API of a large data platform.
Background
The large number of data sources each day produces a large number of valuable data streams. However, in terms of how to make the value of the data embodied in the business (generating practical benefits), since the traditional method needs to invest in developers to perform the processes of development, release and the like, the traditional method is time-consuming and cannot respond to the business requirements quickly, so that the valuable data is increasingly difficult to use quickly.
The prior art has given some solutions to the above-mentioned problems. For example, the technical solution of chinese patent application with patent publication No. CN105159974A discloses an automatic generation method of web services across data sources. The method can dynamically produce the return result class, the web service and the configuration file in turn according to the configuration of a user, and specifically comprises the following steps: (1) configuring information required for generating a web service; (2) generating an executable SQL statement according to the configuration; (3) saving the configured web service information and SQL statements; (4) generating a data model for maintaining a single data record; (5) generating a service return class; (6) generating a web service and a related configuration file; (7) a web service is published.
However, the prior art solutions still have the following drawbacks: firstly, because a function engine is not provided, only some simple SQL query operations can be performed, and thus a customized scene cannot be supported; secondly, each service generation service return class belongs to redundant steps, because the service return classes are all universal and only the formats of the returned data are different; thirdly, the service security level is not high due to the lack of unified monitoring management measures of the service in the scheme.
Disclosure of Invention
One aspect of the present invention is a method of generating an Application Program Interface (API), comprising: selecting a required function engine and a bottom storage module; defining rules embodying business logic of the API; defining input parameters and output of the API; and generating an ID of the API.
Another aspect of the present invention is a system for managing APIs, comprising: an API generating module, which is used for allowing a user to select a function engine and a bottom storage module, defining business logic embodying the API, defining input parameters and output of the API, and generating ID of the API; and the API gateway is used for registering the API according to the input parameters, the output and the ID of the API.
The embodiment of the invention can quickly respond to the requirement of a business party and quickly generate the API, thereby realizing the automation of API generation to a certain extent. Through the embodiment of the invention, the business side can dynamically generate the API according to the business requirement, thereby reducing intermediate processes and lowering the cost. In addition, through the embodiment of the invention, the API is registered to the API gateway, so that the functions of API life cycle management, authentication and current limitation, API monitoring and the like are facilitated to be realized, and the safety guarantee of the API is enhanced.
The invention can realize the rapid generation of the API, and can further rapidly and flexibly package the generated API into service for developers to use.
Drawings
FIG. 1 shows an overall architecture diagram of a generative API system according to an embodiment of the invention.
FIG. 2 illustrates an architecture diagram of an engine management system according to an embodiment of the present invention.
FIG. 3 shows a flow diagram for generating and registering APIs according to an embodiment of the invention.
FIG. 4 shows a schematic diagram defining API rules and parameters according to an embodiment of the present invention.
FIG. 5 shows a schematic diagram of using an API according to an embodiment of the invention.
Detailed Description
The content of the invention will now be discussed with reference to a number of exemplary embodiments. It is to be understood that these examples are discussed only to enable those of ordinary skill in the art to better understand and thus implement the teachings of the present invention, and are not meant to imply any limitations on the scope of the invention.
As used herein, the term "include" and its variants are to be read as open-ended terms meaning "including, but not limited to. The term "based on" is to be read as "based, at least in part, on". The terms "one embodiment" and "an embodiment" are to be read as "at least one embodiment". The term "another embodiment" is to be read as "at least one other embodiment".
The embodiment of the invention relates to a system for automatically generating and managing an API. As shown in fig. 1, the system includes four parts: the system comprises an API generating module, an API gateway, an engine management system, a function engine and a bottom storage module.
● API generating module: according to the embodiment of the invention, the API generating module provides a visual interface for a user to generate the API.
● API gateway: an API Gateway (API Gateway) is an API hosting service. The API gateway can provide complete lifecycle management of the API, including operations of creation, maintenance, release, run, offline, and the like. The API gateway can be used for packaging self-service, and developing safe and reliable data, service logic or functions so as to realize self-system integration and service connection with a partner. The present invention may employ embodiments of API gateways in the prior art. In embodiments of the present invention, the API gateway can implement lifecycle management (e.g., registration, version management, offline, etc.) of the API, authentication (e.g., signed authentication function based on HMCA algorithm), throttling (e.g., a maximum number of times a user can configure the API can be called per second as required by the service to ensure stability of the service) and monitoring (e.g., querying the details of the running API through a visual interface).
● Engine management System: as shown in fig. 2, the engine management system of the embodiment of the present invention includes two functions:
v, mounting and dismounting an engine: the developed function engine can be opened for the user to use through the shelf-on operation. The function engine needing updating maintenance can be selected to be off-shelf (the function engine on off-shelf cannot be selected by a user to use).
The application engine: the user can apply for using the function engine on the shelf, and after the application is submitted and approved, the user can use the function engine to develop the service.
The present invention may use prior art engine management systems. In various embodiments of the present invention, the API generation module may preferably be integrated as part of the engine management system or may be completely independent of the engine management system.
● function engine: the function engine is an object managed by the engine management system. According to embodiments of the present invention, the function engines may be divided according to usage scenarios and functional characteristics. In the field of big data technology, a large number of function engines have been developed for use. For example, the wind control engine belongs to a functional engine, which is developed based on wind control requirements commonly required by industries such as finance and the like so as to provide wind control management capability for a system.
● bottom storage Module: the underlying storage forms of the underlying storage module include, but are not limited to: a relational data source module, a non-relational module such as ES and Mongobb, a big data storage module such as Hive and Hbase, and the like. Further, according to embodiments of the present invention, different function engines have the ability to access different underlying storage modules.
According to one embodiment of the invention, a user may quickly generate an API using a system such as that shown in FIG. 2, an embodiment of which is shown in FIG. 3. The process shown in fig. 3 comprises the following main steps: apply for and initialize the function engine, generate the API, and register the API.
● select function engine and underlying storage module: for example, through the visualization interface of the API generation module, a user may select a function engine (e.g., a query engine or a wind control engine) and select an underlying storage module (e.g., a data source type, a link address, a username, a password, etc.); initialization of the API may also be performed for the selected function engine and underlying storage module if the associated API is needed, as described below.
● generates the API: FIG. 4 further illustrates one embodiment of generating an API, including the steps of:
(1) the user first defines the rules and parameters of the API (including input parameters and returned results). A user may define multiple sets of API rules and parameters, one for each set of API rules and parameters. For example: the rules may be custom program code, such as SQL statements: select from bas _ task where ctime > '2018-01-01', return result field may be task _ id, engine, execute _ status, etc. The defined API rules may be sent to the engine management system. The API generation module may provide a visual interface to allow the user to "check-in" the required API rules (i.e., some rules may be predefined for the user to check-in, which correspond to predefined program code, such as SQL statements). The user may also directly input a piece of program code, such as an SQL statement, as the required rule in the visualization interface of the API generation module.
(2) An Identifier (ID) of the API is generated. The ID may be a predefined string or a randomly generated number of the system, as long as the API can be uniquely identified.
According to an embodiment of the present invention, in the step of generating an API, the step of initializing the API may further include: sending the rules of the API to an engine management system; exporting SQL statements corresponding to the rules, and persisting the SQL statements into an underlying storage module (persisting refers to storing data into a storage device (such as a disk) capable of being permanently stored); and pre-running the SQL statement, calling the selected function engine and persisting the generated result data to the bottom storage module. By this means, when the API is called externally, the relevant data storage and calculation operation do not need to be re-run, and the data which is persisted in advance can be directly obtained, thereby improving the running speed of the system.
● registering the API with the API gateway: and issuing information related to the ID, the rule and the parameter of the API to the API gateway to generate an external API which can be called by the external.
For APIs that are already registered with the API gateway, they may be called externally. As shown in fig. 5, the process of calling the API may include:
(1) the (service side) user calls the API registered by the API gateway and encrypts the calling operation through a public key (for example, token);
(2) the API gateway can implement authentication, current limiting and API monitoring on the called API;
(3) the API gateway forwards the request of the calling operation to an engine management system;
(4) the engine management system decrypts the request according to the parameters of the request (such as the ID of the API) to obtain configuration information, and then assembles the parameters and sends the parameters to the function engine;
(5) the function engine executes the business logic and returns the result;
(6) the (service side) user receives the returned results of the API and then processes the subsequent services.
The methods and apparatus of the embodiments of the present invention may be implemented as pure software (e.g., a software program written in Java and/or SQL language), as pure hardware (e.g., a dedicated ASIC chip or FPGA chip) as desired, or as a system combining software and hardware (e.g., a firmware system storing fixed code).
Another aspect of the invention is a computer-readable medium having computer-readable instructions stored thereon that, when executed, perform a method of embodiments of the invention.
While various embodiments of the present invention have been described above, the above description is intended to be illustrative, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The scope of the claimed subject matter is limited only by the attached claims.
Claims (11)
1. A method of generating an API, comprising:
selecting a required function engine and a required bottom layer storage module from different function engines and different bottom layer storage modules;
defining rules embodying business logic of the API;
defining input parameters and output of the API; and
generating an ID of the API.
2. The method of claim 1, further comprising: and registering the API in an API gateway according to the input parameters, the output and the ID of the API.
3. The method of claim 1, further comprising: the API is initialized.
4. The method of claim 3, the initializing the API comprising:
exporting SQL sentences corresponding to the rules and persisting the SQL sentences;
and pre-running the SQL statement, calling the selected function engine and persisting the generated data.
5. The method of claim 1, the operation of defining a rule embodying business logic comprising: predefined rules are selected.
6. The method of claim 1, the operation of defining a rule embodying business logic comprising: program code embodying the rules is input.
7. A method of generating an API, comprising:
selecting a required function engine and a required bottom layer storage module from different function engines and different bottom layer storage modules;
defining rules, input parameters and output of business logic of a plurality of sets of API; and
and generating an ID of the API aiming at each set of the rules, the input parameters and the output of the business logic of the plurality of sets of APIs.
8. A method of using the API generated in accordance with claim 1, comprising:
calling the API, and encrypting the calling operation;
decrypting the request for the call operation;
the API is executed.
9. A system for managing APIs, comprising:
an API generating module, which is used for allowing a user to select a function engine and a bottom storage module from different function engines and different bottom storage modules, defining rules for reflecting the business logic of the API, defining input parameters and output of the API, and generating ID of the API; and
and the API gateway is used for registering the API according to the input parameters, the output and the ID of the API.
10. The system of claim 9, further comprising:
the different function engine is called when the API is executed;
an engine management system for managing the different function engines; and
the different underlying storage modules are used for storing data, and the different function engines can access the data when being called.
11. A computer readable medium having computer readable instructions stored thereon which, when executed by a computer, are capable of performing the method of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810962669.7A CN109144512B (en) | 2018-08-22 | 2018-08-22 | Method and system for generating API |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810962669.7A CN109144512B (en) | 2018-08-22 | 2018-08-22 | Method and system for generating API |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109144512A CN109144512A (en) | 2019-01-04 |
CN109144512B true CN109144512B (en) | 2022-05-03 |
Family
ID=64791154
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810962669.7A Active CN109144512B (en) | 2018-08-22 | 2018-08-22 | Method and system for generating API |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109144512B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112734349A (en) * | 2019-10-14 | 2021-04-30 | 珠海格力电器股份有限公司 | Interface generation method, data calling method, device and electronic equipment |
CN114153864A (en) * | 2020-09-07 | 2022-03-08 | 华为云计算技术有限公司 | Method and device for generating API |
CN113282625B (en) * | 2021-05-31 | 2022-10-04 | 重庆富民银行股份有限公司 | SQL-based API data query and processing system and method |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104598257A (en) * | 2013-10-30 | 2015-05-06 | 华为技术有限公司 | Method and device for remotely operating application program |
CN105117233A (en) * | 2015-09-14 | 2015-12-02 | 百度在线网络技术(北京)有限公司 | API calling method and device |
CN107046482A (en) * | 2017-04-25 | 2017-08-15 | 厦门集微科技有限公司 | The management method and device of a kind of API service |
CN107872484A (en) * | 2016-09-27 | 2018-04-03 | 中国电信股份有限公司 | REST API fast registration methods, devices and systems |
CN108170426A (en) * | 2018-01-15 | 2018-06-15 | 浙江大学 | A kind of RESTful API code automatic generation methods based on ontology |
CN108259432A (en) * | 2016-12-29 | 2018-07-06 | 亿阳安全技术有限公司 | A kind of management method of API Calls, equipment and system |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102542382B (en) * | 2010-12-14 | 2015-08-19 | 中国移动通信集团贵州有限公司 | The method of operating of business rule and device |
CN104732306B (en) * | 2013-12-19 | 2020-07-07 | 北京索为系统技术股份有限公司 | Rapid development system and method for business application system |
CN106648920B (en) * | 2016-09-29 | 2019-07-02 | 浪潮云信息技术有限公司 | A kind of data communications method based on interface |
-
2018
- 2018-08-22 CN CN201810962669.7A patent/CN109144512B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104598257A (en) * | 2013-10-30 | 2015-05-06 | 华为技术有限公司 | Method and device for remotely operating application program |
CN105117233A (en) * | 2015-09-14 | 2015-12-02 | 百度在线网络技术(北京)有限公司 | API calling method and device |
CN107872484A (en) * | 2016-09-27 | 2018-04-03 | 中国电信股份有限公司 | REST API fast registration methods, devices and systems |
CN108259432A (en) * | 2016-12-29 | 2018-07-06 | 亿阳安全技术有限公司 | A kind of management method of API Calls, equipment and system |
CN107046482A (en) * | 2017-04-25 | 2017-08-15 | 厦门集微科技有限公司 | The management method and device of a kind of API service |
CN108170426A (en) * | 2018-01-15 | 2018-06-15 | 浙江大学 | A kind of RESTful API code automatic generation methods based on ontology |
Also Published As
Publication number | Publication date |
---|---|
CN109144512A (en) | 2019-01-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111769957B (en) | Block chain cross-chain query method, device, equipment and storage medium | |
US11356282B2 (en) | Sending cross-chain authenticatable messages | |
CN103559118B (en) | A kind of method for auditing safely based on AOP and annotating information system | |
CN104573115B (en) | Support the realization method and system of the integrated interface of multi-type database operation | |
US8024564B2 (en) | Automating configuration of software applications | |
US9690822B2 (en) | System and method for metadata level validation of custom setup objects | |
CN110223172B (en) | Conditional receipt storage method and node combining code labeling and type dimension | |
US11521202B2 (en) | Distributed computing and storage network implementing high integrity, high bandwidth, low latency, secure processing | |
US10310828B2 (en) | System and method for providing and executing a domain-specific language for cloud services infrastructure | |
CN109144512B (en) | Method and system for generating API | |
CN110263087B (en) | Receipt storage method and node based on multi-dimensional information and with conditional restriction | |
CN110264198B (en) | Conditional receipt storage method and node combining code labeling and transaction type | |
Sun et al. | A dependability model to enhance security of cloud environment using system-level virtualization techniques | |
US11379828B2 (en) | Distributed computing and storage network implementing high integrity, high bandwidth, low latency, secure processing | |
US20080239985A1 (en) | Method and apparatus for a services model based provisioning in a multitenant environment | |
CN110263088B (en) | Conditional receipt storage method and node combining code labeling and event type | |
CN110264197B (en) | Receipt storage method and node combining event function type and judgment condition | |
CN112134956A (en) | Distributed Internet of things instruction management method and system based on block chain | |
US20220360492A1 (en) | Declarative specification based override mechanism for customizing data centers deployed on cloud platforms | |
US20230040635A1 (en) | Graph-based impact analysis of misconfigured or compromised cloud resources | |
US8627434B2 (en) | Cross security-domain identity context projection within a computing environment | |
US8166143B2 (en) | Methods, systems and computer program products for invariant representation of computer network information technology (IT) managed resources | |
US11855844B2 (en) | Cloud service component dependencies | |
US20100030805A1 (en) | Propagating information from a trust chain processing | |
CN112199079A (en) | System docking method, computing device 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: A method and system for generating APIs Effective date of registration: 20231202 Granted publication date: 20220503 Pledgee: Hangzhou High-tech Financing Guarantee Co.,Ltd. Pledgor: HANGZHOU DTWAVE TECHNOLOGY Co.,Ltd. Registration number: Y2023330002914 |
|
PE01 | Entry into force of the registration of the contract for pledge of patent right |