CN109144512A - A kind of method and system generating API - Google Patents

A kind of method and system generating API Download PDF

Info

Publication number
CN109144512A
CN109144512A CN201810962669.7A CN201810962669A CN109144512A CN 109144512 A CN109144512 A CN 109144512A CN 201810962669 A CN201810962669 A CN 201810962669A CN 109144512 A CN109144512 A CN 109144512A
Authority
CN
China
Prior art keywords
api
rule
input parameter
function engine
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.)
Granted
Application number
CN201810962669.7A
Other languages
Chinese (zh)
Other versions
CN109144512B (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.)
Hangzhou Shulan Technology Co Ltd
Original Assignee
Hangzhou Shulan 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 Hangzhou Shulan Technology Co Ltd filed Critical Hangzhou Shulan Technology Co Ltd
Priority to CN201810962669.7A priority Critical patent/CN109144512B/en
Publication of CN109144512A publication Critical patent/CN109144512A/en
Application granted granted Critical
Publication of CN109144512B publication Critical patent/CN109144512B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention relates to the generations of API, including select required function engine and bottom memory module;Definition embodies the rule of the service logic of the API;Define the input parameter and output of the API;And generate the ID of the API.The present invention is able to achieve flexible, the quick generation of API.

Description

A kind of method and system generating API
Technical field
The present invention relates to computer technology, the particularly method and system of the generation API of big data platform.
Background technique
A large amount of data source is all generating a large amount of valuable data flows daily.However, how to allow the figures in the expression of value of the linen, as an equivalent, and consequently, as a thing that is value of data In terms of present business (generating actual income), since conventional method needs to put into developer the stream such as to develop, issue Journey, therefore conventional method is time-consuming long and is unable to quick response business side demand, so that valuable data are increasingly It is difficult to quickly be used.
Some solutions have been given in the prior art regarding to the issue above.For example, patent publication No. is The technical solution of the Chinese patent application of CN105159974A discloses a kind of web services automatic generation method across data source. This method can successively dynamically production returns the result class, web services and configuration file according to the configuration of user, specifically include as Under step: (1) configuration generate web services required for information;(2) executable SQL statement is generated according to configuration;(3) it protects Deposit the web services information and SQL statement of configuration;(4) data model for saving single data record is generated;(5) clothes are generated Business returns to class;(6) web services and associated profile are generated;(7) web services are issued.
However, there are still following defects for existing technical solution: first, one can only be done due to not having function engine A little simple SQL query operations, so that the scene of customization can not be supported;Belong to second, each service creation service returns to class Extra step, this is because service return class be all it is general, the format of the data only returned is different;Third, by Lack the unified monitoring management measure of service in scheme, it is not high so as to cause service safe rank.
Summary of the invention
An aspect of of the present present invention is a kind of method for generating application programming interfaces (API), comprising: function required for selecting Engine and bottom memory module;Definition embodies the rule of the service logic of the API;Define the input parameter of the API and defeated Out;And generate the ID of the API.
Another aspect of the present invention is a kind of system of Administration API, comprising: API generation module, for allowing user to select Function engine and bottom memory module, definition embody the service logic of API, define the input parameter and output of the API, and Generate the ID of the API;And API gateway registers the API for input parameter, output and the ID according to the API.
Embodiment through the invention is enable to respond quickly the demand of business side, quickly generates API, to a certain extent Realize the automation of API generation.Embodiment through the invention can allow business side oneself to come dynamic according to oneself business demand The generation API of state, to reduce intermediate process and reduce cost.In addition, embodiment through the invention, by by API registration To API gateway, so that the functions such as API life cycle management, certification and current limliting, API monitoring are helped to realize, to reinforce API Safety guarantee.
Since the present invention can be realized quickly generating for API, further API generated quickly, neatly can be beaten Packet is service, is used for developer.
Detailed description of the invention
Fig. 1 shows the integrated stand composition according to an embodiment of the present invention for generating API system.
Fig. 2 shows the architecture diagrams of engine management system according to an embodiment of the present invention.
Fig. 3 shows the flow chart of generation and registration API according to an embodiment of the present invention.
Fig. 4 shows the schematic diagram according to an embodiment of the present invention for defining API rule and parameter.
Fig. 5 shows the schematic diagram according to an embodiment of the present invention using API.
Specific embodiment
The contents of the present invention are discussed now with reference to several exemplary embodiments.It should be appreciated that discussing these implementations Example is rather than dark merely to better understood when those of ordinary skill in the art and therefore realize the contents of the present invention Show any restrictions to the scope of the present invention.
As used herein, term " includes " and its variant will be read as meaning opening " including but not limited to " Put formula term.Term "based" will be read as " being based at least partially on ".Term " one embodiment " and " a kind of embodiment " It is read as " at least one embodiment ".Term " another embodiment " will be read as " at least one other embodiment ".
The embodiment of the present invention be it is a kind of automatically generate, the system of Administration API.As shown in Figure 1, the system includes four portions Point: API generation module, API gateway, engine management system, function engine and bottom memory module.
● API generation module: according to an embodiment of the invention, API generation module provides visual interface, it is raw for user At API.
● API gateway: API gateway (API Gateway) is a kind of API trusteeship service.API gateway is capable of providing API's Complete lifecycle management, including the operation such as creation, maintenance, publication, operation, offline.Usable API gateway encapsulates itself industry Business, data, service logic or functional safety reliably developed, to realize own system it is integrated and with cooperation partner The service connection of companion.The present invention can use the embodiment of API gateway in the prior art.In an embodiment of the present invention, API gateway can implement the life cycle management (such as registration, version management, offline etc.) of API, certification (such as based on HMCA The authentication function of the signature of algorithm), current limliting (such as user can according to requirements of service configure it is per second support call API maximum times, To ensure the stability of customer service) and monitoring (such as the detailed letter of API in operation is inquired by visual interface Breath).
● engine management system: as shown in Fig. 2, the engine management system of the embodiment of the present invention includes two functions:
Undercarriage on √ engine: the function engine that can will have been developed by restocking operation is open to be used to user.For The function engine for needing to be updated maintenance can choose undercarriage (the function engine user of undercarriage can not select to use).
√ application engine: user can apply for the function engine using restocking, after submitting application, after examination & approval pass through, and user The function engine can be used to carry out business development.
Engine management system in the prior art can be used in the present invention.In different embodiments of the invention, API is generated A part that module can be preferably integrated as engine management system, also may be completely independent of engine management system.
● function engine: function engine is the object that aforementioned engine management system is managed.According to an embodiment of the invention, Function engine can be divided according to usage scenario and functional characteristic.In big data technical field, develop a large amount of Function engine is available.For example, air control engine belongs to a kind of function engine, it is the wind based on the industries common need such as finance Control demand and be developed, to provide air control managerial ability for system.
● bottom memory module: the bottom storage form of bottom memory module includes being not limited to: relational data source module, The non-relationals module such as ES, Mongodb, big datas memory module such as Hive, Hbase etc..In addition, implementation according to the present invention Example, different function engines have the ability for accessing different bottom memory modules.
According to one embodiment of present invention, user can be used system as shown in Figure 2 and quickly generate API, process One embodiment it is as shown in Figure 3.Process shown in Fig. 3 includes following key step: applying for simultaneously function of initializing engine, generation API and registration API.
● selection function engine and bottom memory module: for example by the visualization interface of API generation module, user can be with Selection function engine (for example, query engine or air control engine), and select bottom memory module (such as: data source types, chain It is grounded location, user name, password etc.);It is needed if relevant API exists, selected function engine and bottom can also be directed to Memory module carries out the initialization of API, as described below.
● it generates API: Fig. 4 and further illustrates the one embodiment for generating API, include the following steps:
(1) user defines the rule and parameter (including input parameter and return the result) of API first.User can define more Cover the rule and parameter of API, every suit rule and the corresponding API of parameter.Such as: rule can be customized program generation Code, such as SQL statement: select*from bas_task where ctime > ' 2018-01-01', returning the result field can be with It is task_id, engine, execute_status etc..The API rule defined can be sent to engine management system.API Generation module can provide visual interface to allow the rule of API required for user " choosing " (can predefine Rule is chosen for user, these rules correspond to predefined program code such as SQL statement).User can also generate in API One section of program code such as SQL statement is directly inputted in the visual interface of module as required rule.
(2) identifier (ID) of API is generated.ID can be predefined character string, be also possible to what system generated at random Number only needs that API can be uniquely identified.
It according to one embodiment of present invention, can also include the step for initializing the API in the step of generating API It is rapid: to send engine management system for the rule of API;SQL statement corresponding to derived rule, and be persisted to bottom and deposited In storage module (persistence refer to data are saved in can be in the storage equipment (such as disk) of persistence);SQL described in prerun Sentence calls selected function engine and the result data of generation is persisted to bottom memory module.By this means, In the external call API, it may not be necessary to rerun relevant data storage and calculating operation, and can directly obtain in advance The data persisted, to improve the speed of service of system.
● API is registered in API gateway: the information of ID, rule and relating to parameters with API being published to API gateway, generated One external API, for external call.
For that can be called by outside in the API of API gateway registration.As shown in figure 5, calling the process of API can be with Include:
(1) API that (business side) user calls API gateway to register, and by public key (for example, token) to call operation It is encrypted;
(2) certification can be implemented to called API in API gateway and current limliting, API are monitored;
(3) request of the call operation is forwarded to engine management system by API gateway;
(4) engine management system decrypts the request according to the parameter (for example, ID etc. of API) of the request to obtain configuration Then information assembly parameter and is issued to function engine;
(5) function engine executes service logic, and returns the result;
(6) (business side) user receive API returned as a result, then handling subsequent business.
The method and apparatus of various embodiments of the present invention can be implemented as pure software (such as with Java and/or sql like language Come the software program write), it also can according to need and be embodied as pure hardware (such as dedicated asic chip or fpga chip), It is also implemented as combining the system (such as the fixer system for being stored with fixed code) of software and hardware.
Another aspect of the present invention is a kind of computer-readable medium, is stored thereon with computer-readable instruction, described Instruct the method for being performed implementable various embodiments of the present invention.
Various embodiments of the present invention are described above, above description is exemplary, and non-exclusive, and It is not limited to the disclosed embodiment.Without departing from the scope and spirit of illustrated each embodiment, for this skill Many modifications and changes are obvious for the those of ordinary skill in art field.The range of claimed theme only by The attached claims are defined.

Claims (11)

1. a kind of method for generating API, comprising:
Function engine required for selecting and bottom memory module;
Definition embodies the rule of the service logic of the API;
Define the input parameter and output of the API;And
Generate the ID of the API.
2. according to the method described in claim 1, further include: according to input parameter, output and the ID of the API, in API gateway Register the API.
3. according to the method described in claim 1, further include: initialize the API.
4. according to the method described in claim 3, the step of initialization API, includes:
SQL statement corresponding to the rule is exported, and by its persistence;
SQL statement described in prerun calls selected function engine and the data persistence by generation.
5. according to the method described in claim 1, it is described definition embody service logic rule operation include: choose it is predefined Rule.
6. according to the method described in claim 1, the operation that the definition embodies the rule of service logic includes: that input embodies institute State the program code of rule.
7. a kind of method for generating API, comprising:
Function engine required for selecting and bottom memory module;
Rule, input parameter and the output of the service logic of the more set API of definition;With
For every set rule, the input parameter and defeated in the rule, input parameter and output of the service logics of more set API Out, the ID of an API is generated.
8. a kind of method using the API generated according to claim 1, comprising:
The API is called, and the call operation is encrypted;
Decrypt the request of the call operation;
Execute the API.
9. a kind of system of Administration API, comprising:
API generation module, for allowing user's selection function engine and bottom memory module, definition embodies the service logic of API Rule, define the input parameter and output of the API, and generate the ID of the API;With
API gateway registers the API for input parameter, output and the ID according to the API.
10. system according to claim 9, further includes:
Function engine, it is called when API is executed;
Engine management system is used to manage the function engine;And
Bottom memory module, for storing data, the function engine can access the data when called.
11. a kind of computer-readable medium is stored thereon with computer-readable instruction, the computer-readable instruction is by computer The method as described in one of any in claim 1-8 is able to carry out when execution.
CN201810962669.7A 2018-08-22 2018-08-22 Method and system for generating API Active CN109144512B (en)

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 true CN109144512A (en) 2019-01-04
CN109144512B 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)

Cited By (3)

* Cited by examiner, † Cited by third party
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
CN113282625A (en) * 2021-05-31 2021-08-20 重庆富民银行股份有限公司 SQL-based API data query and processing system and method
WO2022048676A1 (en) * 2020-09-07 2022-03-10 华为云计算技术有限公司 Api generation method and apparatus

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102542382A (en) * 2010-12-14 2012-07-04 中国移动通信集团贵州有限公司 Method and device for managing business rule
CN104598257A (en) * 2013-10-30 2015-05-06 华为技术有限公司 Method and device for remotely operating application program
CN104732306A (en) * 2013-12-19 2015-06-24 北京索为高科系统技术有限公司 Rapid development system for service application system and method
CN105117233A (en) * 2015-09-14 2015-12-02 百度在线网络技术(北京)有限公司 API calling method and device
CN106648920A (en) * 2016-09-29 2017-05-10 山东浪潮云服务信息科技有限公司 Interface-based data communication method
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

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102542382A (en) * 2010-12-14 2012-07-04 中国移动通信集团贵州有限公司 Method and device for managing business rule
CN104598257A (en) * 2013-10-30 2015-05-06 华为技术有限公司 Method and device for remotely operating application program
CN104732306A (en) * 2013-12-19 2015-06-24 北京索为高科系统技术有限公司 Rapid development system for service application system and method
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
CN106648920A (en) * 2016-09-29 2017-05-10 山东浪潮云服务信息科技有限公司 Interface-based data communication method
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

Cited By (4)

* Cited by examiner, † Cited by third party
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
WO2022048676A1 (en) * 2020-09-07 2022-03-10 华为云计算技术有限公司 Api generation method and apparatus
CN113282625A (en) * 2021-05-31 2021-08-20 重庆富民银行股份有限公司 SQL-based API data query and processing system and method
CN113282625B (en) * 2021-05-31 2022-10-04 重庆富民银行股份有限公司 SQL-based API data query and processing system and method

Also Published As

Publication number Publication date
CN109144512B (en) 2022-05-03

Similar Documents

Publication Publication Date Title
US9639338B2 (en) Computer-implemented method, system and computer program product for deploying an application on a computing resource
US10564938B2 (en) Method and device of resource orchestration using an object-oriented language
Rademacher et al. Graphical and textual model-driven microservice development
CN106547681B (en) Method and device for testing data automatic loading and multiplexing simulation service
CN109144512A (en) A kind of method and system generating API
US10254986B2 (en) Implicit coordination for deployment of computing systems using a data sharing service
CN111399853A (en) Templated deployment method of machine learning model and custom operator
Di Martino et al. A rule‐based procedure for automatic recognition of design patterns in UML diagrams
Izquierdo et al. API2MoL: Automating the building of bridges between APIs and Model-Driven Engineering
CN112148278A (en) Visual block chain intelligent contract framework and intelligent contract development and deployment method
US10387124B2 (en) System and method for creating domain specific language
CN112947914A (en) Code generation method and device based on model, computer equipment and medium
CN104699503A (en) Method and device for replacing function execution logic in Android system
US20110231178A1 (en) Modeling and generating computer software product line variants
US8219966B2 (en) Method and system for integrating an application floorplan and an external service
Coullon et al. Integrated model-checking for the design of safe and efficient distributed software commissioning
CN111722598B (en) System and method for modular engineering of industrial processes
KR101216916B1 (en) Method and system for converting fbn based plc code into a general program code
JP5377522B2 (en) Efficiently correlate nominally incompatible types
US10657476B2 (en) Just in time compilation (JIT) for business process execution
CN113342399A (en) Application structure configuration method and device and readable storage medium
CN107239484A (en) Database operation method, device and computer equipment
CN106293680A (en) A kind of assembly management method and device
CN106506209B (en) The management method and system of service
US20210255838A1 (en) Extensible user defined functions via object properties

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