CN113468253A - Application program interface configuration method and device - Google Patents

Application program interface configuration method and device Download PDF

Info

Publication number
CN113468253A
CN113468253A CN202010241799.9A CN202010241799A CN113468253A CN 113468253 A CN113468253 A CN 113468253A CN 202010241799 A CN202010241799 A CN 202010241799A CN 113468253 A CN113468253 A CN 113468253A
Authority
CN
China
Prior art keywords
application program
program interface
target application
query
data table
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
CN202010241799.9A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010241799.9A priority Critical patent/CN113468253A/en
Publication of CN113468253A publication Critical patent/CN113468253A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Stored Programmes (AREA)

Abstract

An embodiment of the present specification provides an application program interface configuration method and an application program interface configuration device, where the application program interface configuration method includes: determining a target application program interface and acquiring signature information of the target application program interface; setting database statements according to the signature information; and configuring a data table to be inquired for the target application program interface by executing the database statement. The configuration process of the application program interface can be completed only according to the signature information of the target application program interface, time and labor are saved, and a standardized data table to be inquired is configured for different target application program interfaces, so that unified management and use are facilitated.

Description

Application program interface configuration method and device
Technical Field
The embodiments of the present disclosure relate to the field of computer technologies, and in particular, to an application program interface configuration method, where one or more embodiments of the present disclosure also relate to an application program interface calling method, an application program interface configuration apparatus, an application program interface calling apparatus, two types of computing devices, and two types of computer-readable storage media.
Background
With the development of computer technology, more and more users query, analyze and process Data through cloud service components based on cloud computing, and a Data Lake (Data Lake) is a centralized storage library and is a solution for solving the problem of fusion query, analysis and processing of various heterogeneous Data, databases and Data storage systems on the cloud.
The cloud service components stored in the data lake are different in form and type, for example, common cloud service components providing data services based on cloud computing, such as cloud micro services, cloud hosting service middleware, cloud service function computing interfaces and the like, in order to call each cloud service component in the data lake, customized development of a data source connector is generally required for the specific cloud service component, for example, an adapter for querying an interface and the like, and because the interfaces of each component are different, time and labor are wasted during customized development, and the efficiency and experience of service interface data access through the data lake are greatly reduced.
Therefore, how to solve the above problems becomes an urgent problem to be solved by the skilled person.
Disclosure of Invention
In view of this, the present specification provides an application program interface configuration method. One or more embodiments of the present disclosure also relate to an application program interface calling method, an application program interface configuration apparatus, an application program interface calling apparatus, two computing devices, and two computer-readable storage media, so as to solve technical deficiencies in the prior art.
According to a first aspect of embodiments of the present specification, there is provided an application program interface configuration method, including:
determining a target application program interface and acquiring signature information of the target application program interface;
setting database statements according to the signature information;
and configuring a data table to be inquired for the target application program interface by executing the database statement.
Optionally, the obtaining signature information of the target application program interface includes:
accessing an interface registration directory storing the target application program interface;
and searching the interface definition, the function name, the parameter and the return value of the target application program interface in the interface registration directory.
Optionally, setting a database statement according to the signature information includes:
setting a data definition statement according to the interface definition, the function name, the parameter, and the return value.
Optionally, setting a data definition statement according to the interface definition, the function name, the parameter, and the return value, including:
setting a generating statement of a database to be queried according to the interface definition;
and setting a generation statement of a data table to be queried according to the function name, the parameter and the return value.
Optionally, setting a generation statement of the data table to be queried according to the function name, the parameter, and the return value, including:
under the condition that the number of the function names is one, taking the parameters and the return values as field columns in a statement generated by a data table to be queried; or
And under the condition that the number of the function names is at least two, the parameters comprise fixed parameters and non-fixed parameters, the fixed parameters are used as attribute columns in the statement generated by the data table to be queried, and the non-fixed parameters and the return values are used as field columns in the statement generated by the data table to be queried.
Optionally, the method for configuring an application program interface further includes:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining the target application program interface according to the data table to be inquired;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
According to a second aspect of embodiments of the present specification, there is provided an application program interface calling method including:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
According to a third aspect of embodiments herein, there is provided an application program interface configuration apparatus including:
an acquisition module configured to determine a target application program interface and acquire signature information of the target application program interface;
a setting module configured to set a database statement according to the signature information;
and the configuration module is configured to configure a data table to be queried for the target application program interface by executing the database statement.
According to a fourth aspect of embodiments of the present specification, there is provided an application program interface calling apparatus including:
the device comprises a first receiving module, a second receiving module and a query module, wherein the first receiving module is configured to receive a query statement, and the query statement comprises a query field, a data table to be queried and a query condition;
the determining module is configured to determine a target application program interface according to the data table to be queried, wherein the data table to be queried is configured according to signature information of the target application program interface;
a sending instruction module configured to send a calling instruction to the target application program interface according to the query field and the query condition;
a second receiving module configured to receive a calling result generated by the target application program interface in response to the calling instruction;
a parsing module configured to parse the invocation result to obtain a query result.
According to a fifth aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
determining a target application program interface and acquiring signature information of the target application program interface;
setting database statements according to the signature information;
and configuring a data table to be inquired for the target application program interface by executing the database statement.
According to a sixth aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
According to a seventh aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the application program interface configuration method.
According to an eighth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the application programming interface calling method.
In one embodiment of the present description, a target application program interface is determined, signature information of the target application program interface is acquired, a database statement is set according to the signature information, and then a data table to be queried is configured for the target application program interface by executing the database statement.
Secondly, when the target application program interface is called, the standard database query statement can be directly used for calling the target application program interface, so that the method is convenient, rapid and popular and easy to understand, and the efficiency and experience of service interface data access through a data lake are greatly improved.
Drawings
FIG. 1 is a flowchart illustrating a method for configuring an application program interface according to an embodiment of the present disclosure;
FIG. 2 is a diagram of signature information for an application program interface provided by one embodiment of the present description;
FIG. 3 is a block diagram of a configuration method for a program interface according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of a processing procedure of a method for configuring an application program interface according to an embodiment of the present specification;
FIG. 5 is a diagram illustrating signature information for an application program interface, according to an embodiment of the present disclosure;
FIG. 6 is a flow diagram illustrating processing for an application program interface call according to one embodiment of the present disclosure;
FIG. 7 is a block diagram of an API configuration apparatus according to an embodiment of the present disclosure;
FIG. 8 is a block diagram of an API call apparatus according to an embodiment of the present disclosure;
FIG. 9 is a block diagram of a computing device, according to one embodiment of the present description;
fig. 10 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present specification relate are explained.
Data Lake (Data Lake): the method is a centralized repository, and original data are stored in different data pools in a classified manner, and then the data are integrated and converted into a uniform storage format which is easy to analyze in each data pool for storage. The method is greatly convenient for users to analyze and utilize the data.
Database statements: the method is a set-oriented descriptive non-procedural language, has strong functions, high efficiency, simplicity, easy learning and easy maintenance, and comprises a Data Query Language (DQL), a Data Manipulation Language (DML), a Data Definition Language (DDL) and a Data Control Language (DCL).
Application Programming Interface (API): is a predefined function that aims to provide applications and developers the ability to access a set of routines based on certain software or hardware, without having to access source code or understand the details of the internal working mechanisms.
In the present specification, an application program interface configuration method is provided, and the present specification relates to an application program interface calling method, an application program interface configuration apparatus, an application program interface calling apparatus, two kinds of computing devices, and two kinds of computer readable storage media, which are described in detail one by one in the following embodiments.
Fig. 1 shows a flowchart of a process for configuring an application program interface according to an embodiment of the present disclosure, which includes steps 102 to 106.
Step 102: determining a target application program interface and acquiring signature information of the target application program interface.
The data lake is centrally stored with a plurality of application program interfaces, corresponding adapters are required to be configured for the application program interfaces respectively, the target application program interface is the application program interface required to be configured, and the signature information of the target application program interface is acquired after the target application program interface is determined.
Optionally, the obtaining signature information of the target application program interface includes: accessing an interface registration directory storing the target application program interface; and searching the interface definition, the function name, the parameter and the return value of the target application program interface in the interface registration directory.
In practical application, each application program interface can store signature information to the interface registration directory after registration, and signature information of the application program interface which has been registered, that is, the interface definition, function name, parameter and return value of the application program interface, can be acquired by accessing the interface registration directory.
In an embodiment provided in this specification, determining that the target application program interface is "SqlIdQueryAPI", and obtaining an interface definition of the target application program interface by accessing the interface registration directory is: name ═ SqlIdQueryAPI ', property Name ═ oneservice'; value ═ com.xxx. api. sqlidquery api ', property name ═ version ', value ═ 2.0.0 ', property name ═ group ', value ═ DUBBO '; the name of the Function1 is Function1, the parameters are user, sql _ id, par 1, part 2 and part 3, and the return values are Obj1, Obj2 and Obj 3; the name of the Function2 is Function2, the parameters are user, sql _ id, par 1 and part 2, and the return values are Obj1, Obj2 and Obj 3; the name of the Function3 is Function3, the parameters are user, sql _ id and Parm1, and the return values are Obj1, Obj2 and Obj 3.
It should be noted that, for convenience of explanation, the obtained signature information in the embodiments provided in this specification is simplified information, and the format of the signature information of the target program interface is not limited in this specification.
Step 104: and setting a database statement according to the signature information.
Optionally, a data definition statement is set according to the interface definition, the function name, the parameter, and the return value, where the data definition statement is a language in the database language responsible for data structure definition and database object definition.
Specifically, step 104 may be implemented by S1041 to S1042.
And S1041, setting a generating statement of the database to be queried according to the interface definition.
In an embodiment provided in this specification, a database to be queried is set as "oneservice _ SqlIdQueryAPI" according to information "Name ═ sqldqueryapi" and "property Name ═ oneservice'" in an interface definition, where oneservice is a service logical Name; according to "property name ═ oneservice ', value ═ com.xxx.api.sqlidquery api'; property name ═ version ', value ═ 2.0.0'; property name ═ group ', value ═ DUBBO' ″ sets the property location of the database to be queried to "oneservice:// com.XXX.api.SQLIDQeryAPIversion ═ 2.0.0& group ═ DUBBO". Namely, the obtained generating statement of the database to be queried is ' creation database ' oneservice _ sqlidqueryapi ', database attribute: LOCATION ═ oneservice:// com.xxx.api.sqlidqueryappiversion ═ 2.0.0& group ═ DUBBO' ″.
S1042, setting a generation statement of the data table to be inquired according to the function name, the parameter and the return value.
There are cases where one or at least two functions exist in one target application program interface.
Specifically, when the number of the function names is one, the parameters received by the function and the return values of the function are used as field columns in the data table to be queried to generate the statement.
In a specific embodiment provided in this specification, the target application program interface has a Function of Function5, and parameters of the Function are user, sql _ id, and part 1, so that the user, sql _ id, and part 1 are used as field columns in a generating statement of a data table to be queried, the set generating statement of the data table to be queried is "create table sql id, and fields in the table are: user (string type), sql _ id (numeric type), Parm1 (string type) ".
And the application program interface defines each parameter as a fixed parameter and a non-fixed parameter, takes the fixed parameter as an attribute column in a statement generated by a data table to be queried under the condition that the number of the function names is at least two, and takes the non-fixed parameter and the return value as a field column in the statement generated by the data table to be queried.
In an embodiment provided in this specification, following the above example, referring to fig. 2, fig. 2 shows a schematic diagram of signature information of an application program interface in the embodiment of this specification, which includes a function name, parameters, and return values, as shown in fig. 2, the application program interface Pay _ Stat _10009 includes three functions, api _ method _1_1, api _ method _1_2, and api _ method _1_3, and the application program interface defines a User and a SQLid in the three functions as fixed parameters, where the User has a value of User _1, the SQLid has a value of 10009, and param 1, param 2, and param 3 are defined as non-fixed parameters, so that the fixed parameters User and SQLid are used as attribute columns in a query data table generating statement, and the non-fixed parameters param 1, param 2, and param 3 and the return values Obj1, Obj2, and Obj3 are used as statement fields in the query data table generating statement.
The generation statement of the data table to be queried is "create table 'Pay _ Stat _10009', and the fields in the table are: parm1 (string type), Parm2 (string type), Parm3 (string type), Obj1 (string type), Obj2 (string type), Obj3 (string type), and the table attributes are: the method includes that a user is equal to 'user _ 1', and an sql _ id is equal to '10009' ″, wherein values of the user is equal to 'user _ 1' and the sql _ id is equal to '10009' are used as attribute values of a data table to be queried, that is, data queried in the data table to be queried need to meet the requirements of the user is equal to 'user _ 1' and the sql _ id is equal to '10009'.
It should be noted that, in practical applications, different databases may be created according to different service types, and a to-be-queried data table of an application program interface related to a service type corresponding to a current database is created in each database, for example, for sales data and inventory data, a sales database and an inventory database may be created, and a to-be-queried data table corresponding to an application program interface related to sales data and a to-be-queried data table corresponding to an application program interface related to inventory data are stored, respectively.
Step 106: and configuring a data table to be inquired for the target application program interface by executing the database statement.
After the database statement is obtained, configuring a corresponding data table to be queried for the target application program interface by executing the database statement, wherein the data table to be queried is used as a connection adapter corresponding to the target application program interface, and the corresponding target application program can be called through the data table to be queried.
In an embodiment provided in this specification, following the above example, a generation statement of a database to be queried is executed, the database to be queried is configured for the target application program interface, then, a generation statement of a data table to be queried is executed, and the data table to be queried is configured for the target application program in the database to be queried.
The data table to be queried mentioned in this specification may be a temporary table or a table stored in a database. For an application program interface with low calling frequency, a temporary data table to be inquired can be configured and deleted after the calling is finished, so that the storage space is saved, and the temporary data table to be inquired can be created again when the calling is carried out again; for the application program interface with high calling frequency, the configured data table to be inquired can be stored in the database, so that the direct calling in the subsequent use process is facilitated, the calculation consumption caused by table creation every time is avoided, and the calculation resource is saved. The type of the data table to be queried is subject to the actual application requirement, and is not limited in this specification.
According to the application program interface configuration method provided by the embodiment of the specification, the database statement is set according to the signature information of the target application program interface, the data table to be inquired is configured for the target application program interface according to the database statement, the configuration can be completed only according to the signature information of the target application program interface in the configuration process, time and labor are saved in the configuration process, the standardized data table to be inquired is configured for different target application programs, data access is facilitated by using uniform query statements, and the configuration method is convenient and simple.
The following describes the application program interface configuration method provided in this specification further by taking an example of the application program interface configuration method in a specific target application program interface configuration with reference to fig. 3 and 4. Fig. 3 shows an architecture block diagram of a method for configuring a program interface according to an embodiment of the present disclosure, where each application program interface corresponds to a service logic, and each application program interface is registered in an interface registration directory, a service manager obtains signature information of the application program interface in the interface registration directory, and configures a corresponding data table to be queried for each application program interface according to the signature information, a user may query the data table to be queried through a query statement, the data table to be queried sends a call instruction to a corresponding target application program, the target application program obtains a call result through the service logic according to the call instruction, and then displays the query result obtained after the call result is analyzed.
Fig. 4 is a flowchart illustrating a processing procedure of a method for configuring an application program interface according to an embodiment of the present disclosure, where specific steps include step 402 to step 418.
Step 402: a target application program interface is determined.
In embodiments provided herein, the target program interface is determined to be the Pay _ Stat _ API.
Step 404: and accessing an interface registration directory storing the target application program interface, and searching the function name, the parameter and the return value of the target application program interface in the interface registration directory.
In the embodiment provided in this specification, the interface registration directory is accessed, and the function name, the parameter, and the return value corresponding to the Pay _ Stat _ API are obtained in the interface registration directory.
Step 406: and setting a generation statement of a data table to be queried according to the function name, the parameter and the return value.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating signature information of an application program interface in an embodiment provided in the present specification, where parameters user and sqlid are fixed parameters, the value of user is user _1, and the value of sqlid is 10009; the statistical date (Stat _ date), the Shop list (Shop _ list) and the statistical region (Stat _ area) are non-fixed parameters; the returned value of the Pay _ Stat _ API is the statistical sum (Stat _ amplitude), and the total number of the statistics (Stat _ No.) is 3 functions in the Pay _ Stat _ API interface, namely List1, List2 and List 3.
According to the information shown in fig. 5, the generated statement is set as "create table" Pay _ Stat _10009', and the fields in the table include: stat _ date (string type), Shop _ list (string type), Stat _ area (string type), Stat _ atom (string type), Stat _ No. (string type), the table attributes are: the user is 'user _ 1', and the sql _ id is '10009'.
Step 408: and configuring a data table to be inquired for the target application program interface by executing the generated statement.
And executing the generated statement to create a data table to be queried corresponding to the target program interface, and storing the interface name of the data table to be queried and the application program interface, the query field and the table attribute field of the data table to be queried and the object defined in the application program interface in a metadata information table in a one-to-one correspondence manner.
In the embodiment provided in this specification, following the above example, the generation statement is executed, a data table to be queried "Pay _ Stat _ 10009" is configured for an application program interface "Pay _ Stat _ API", and at the same time, a data table name "Pay _ Stat _ 10009" to be queried and an application program interface name "Pay _ Stat _ API", query fields Stat _ date, Shop _ list, Stat _ area, Stat _ amont, Stat _ No. and table attribute fields user and sql _ id in the data table to be queried are stored in the metadata information table in a one-to-one correspondence with objects Stat _ date, Shop _ list, Stat _ area, Stat _ amont, Stat _ No., user and sql id defined in the application program interface.
Step 410: receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition.
The query statement is a standard database query statement, is widely applied and uniform in format, and related information can be queried in the data table to be queried through the standard query statement.
In the embodiments provided in this specification, following the above example, the received query statement is: "in the data table to be queried with the table name of 'Pay _ Stat _10009', three shops of 'shop1, shop2 and shop3' are queried, wherein the three shops are respectively the statistical amount and the statistical total amount in the area A on the 2018-11-11 days".
Step 412: and determining the target application program interface according to the data table to be inquired.
And inquiring an application program interface corresponding to the data table to be inquired in the metadata information table according to the name of the data table to be inquired.
In the embodiment provided in this specification, following the above example, it is determined that the corresponding target application program interface is "Pay _ Stat _ API" according to the correspondence between the to-be-queried data table stored in the metadata information table and the interface name of the application program interface and the to-be-queried data table Pay _ Stat _ 10009.
Step 414: and sending a calling instruction to the target application program interface according to the query field and the query condition.
And querying objects defined in the corresponding application program interface in the metadata information table according to the query field and the query condition of the data table to be queried, and generating a call instruction, wherein the call instruction comprises query field information and query condition information.
In the embodiment provided in this specification, following the above example, a call instruction is generated according to the query fields Stat _ event and Stat _ No. and the query condition Stat _ date ═ 2018-11-11', Shop _ list ═ Shop1, Shop2, Shop3', and Stat _ area ═ a ', and the call instruction is sent to the target application program interface "Pay _ Stat _ API", so as to implement a call to the target application program interface. The query condition in the call instruction is the assignment of parameters in the call instruction of the target application program interface, the query field in the call instruction is the return value in the target application program interface, and the target application program interface 'Pay _ Stat _ API' is called through the call instruction.
Step 416: and receiving a calling result generated by the target application program interface in response to the calling instruction.
After the application program interface receives the call instruction, selecting a corresponding function according to the query condition in the call instruction, wherein if two functions are arranged in the target application program interface, the first function needs to transmit two parameters, the second function needs to transmit three parameters, the first function is called when the query condition in the call instruction contains two parameters, and the second function is called when the query condition in the call instruction contains three parameters; and acquiring corresponding calling results according to the query field, wherein if the target application program interface can acquire three calling results, and the query field only contains one calling result, only one corresponding calling result is needed to be generated.
In the embodiment provided in the present specification, following the above example, the target application program interface "Pay _ Stat _ API" determines to call the list2 function in the target application program interface according to the query condition, and generates a call result of "568423.52-element, 1654-element" in response to the call instruction. The calling result can be in a character string format or a json format according to the setting of the interface, and the format of the calling result is related to the interface. And receiving a calling result generated by the application program interface.
In another embodiment provided in this specification, if the query condition is Stat _ date ═ 2018-11-11', Shop _ list ═ Shop1, Shop2, Shop3', it is determined to call the list1 function in the target application program interface, and if the query field is Stat _ amont, the corresponding call result generated with the call instruction is "856248.18-ary".
Step 418: and analyzing the calling result to obtain a query result.
The format of the call result is related to the interface, and is not a standard database query result, so after the call result is obtained, the call result also needs to be analyzed, and the call result is converted into the standard database query result according to the corresponding relation between the query field stored in the meta information data table and the object defined in the application program interface.
In the embodiment provided in this specification, the call result is "568423.52 yuan, 1654", and the query result obtained by parsing the call result according to the correspondence between the query field stored in the meta information data table and the object defined in the application program interface is shown in table 1.
Stat_amont Stat_no.
568423.52 1654
TABLE 1
According to the application program interface configuration method provided by the embodiment of the specification, the database statement is set according to the signature information of the target application program interface, the data table to be inquired is configured for the target application program interface according to the database statement, the configuration can be completed only according to the signature information of the target application program interface in the configuration process, time and labor are saved in the configuration process, the standardized data table to be inquired is configured for different target application programs, data access is facilitated by using uniform query statements, and the configuration method is convenient and simple.
Secondly, when the application program interface is called, the database query statement can be directly used for calling the target application program interface, so that the method is convenient, fast and popular and easy to understand, and the efficiency and experience of service interface data access through a data lake are greatly improved.
Fig. 6 shows a flowchart of processing an application program interface call according to an embodiment of the present disclosure, which includes steps 602 to 610.
Step 602: receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition.
Step 604: and determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface.
Step 606: and sending a calling instruction to the target application program interface according to the query field and the query condition.
Step 608: and receiving a calling result generated by the target application program interface in response to the calling instruction.
Step 610: and analyzing the calling result to obtain a query result.
The steps 602 to 610 are the same as the steps 410 to 418, and for the specific explanation of the steps 602 to 610, refer to the details of the steps 410 to 418 in the foregoing embodiment, which will not be repeated herein.
The application program interface calling method provided in the embodiment of the present specification receives a query statement, determines a target application program interface according to a to-be-queried data table in the query statement, sends a call instruction to the target application program interface according to a query field and a query condition, receives a call result generated by the target application program interface in response to the call instruction, and analyzes the call result to obtain a final query result.
Corresponding to the foregoing embodiment of the method for configuring an application program interface, this specification further provides an embodiment of an application program interface configuration apparatus, and fig. 7 illustrates a schematic structural diagram of an application program interface configuration apparatus provided in an embodiment of this specification. As shown in fig. 7, the apparatus includes:
an obtaining module 702 configured to determine a target application program interface and obtain signature information of the target application program interface.
A setting module 704 configured to set a database statement according to the signature information.
A configuration module 706 configured to configure a data table to be queried for the target application program interface by executing the database statement.
Optionally, the obtaining module 702 is further configured to access an interface registration directory storing the target application program interface; and searching the interface definition, the function name, the parameter and the return value of the target application program interface in the interface registration directory.
Optionally, the setting module 704 is further configured to set a data definition statement according to the interface definition, the function name, the parameter, and the return value.
Optionally, the setting module 704 is further configured to set a generating statement of the database to be queried according to the interface definition; and setting a generation statement of a data table to be queried according to the function name, the parameter and the return value.
Optionally, the setting module 704 is further configured to, in a case that the number of the function names is one, use the parameters and the return values as field columns in a statement generated by a data table to be queried; or under the condition that the number of the function names is at least two, the parameters comprise fixed parameters and non-fixed parameters, the fixed parameters are used as attribute columns in the statement generated by the data table to be queried, and the non-fixed parameters and the return values are used as field columns in the statement generated by the data table to be queried.
Optionally, the apparatus for configuring an application program interface further includes:
the device comprises a first receiving module and a second receiving module, wherein the first receiving module is configured to receive a query statement, and the query statement comprises a query field, a data table to be queried and a query condition.
The determining module is configured to determine the target application program interface according to the data table to be queried.
And the sending instruction module is configured to send a calling instruction to the target application program interface according to the query field and the query condition.
A second receiving module configured to receive a call result generated by the target application program interface in response to the call instruction.
A parsing module configured to parse the invocation result to obtain a query result.
The above is an illustrative scheme of an application program interface configuration apparatus according to the present embodiment. It should be noted that the technical solution of the application program interface configuration apparatus and the technical solution of the application program interface configuration method belong to the same concept, and details that are not described in detail in the technical solution of the application program interface configuration apparatus can be referred to the description of the technical solution of the application program interface configuration method.
The application program interface configuration device provided in the embodiment of the present specification sets a database statement according to signature information of a target application program interface, and configures a data table to be queried for the target application program interface according to the database statement, and the configuration can be completed only according to the signature information of the target application program interface in a configuration process, so that time and labor are saved in the configuration process, and a standardized data table to be queried is configured for different target application programs, which facilitates data access using uniform query statements, and is convenient and simple.
Secondly, when the application program interface is called, the database query statement can be directly used for calling the target application program interface, so that the method is convenient, fast and popular and easy to understand, and the efficiency and experience of service interface data access through a data lake are greatly improved.
Corresponding to the foregoing application program interface calling method embodiment, this specification further provides an application program interface calling device embodiment, and fig. 8 shows a schematic structural diagram of an application program interface calling device provided in an embodiment of this specification. As shown in fig. 8, the apparatus includes:
a first receiving module 802 configured to receive a query statement, wherein the query statement includes a query field, a data table to be queried, and a query condition.
A determining module 804, configured to determine a target application program interface according to the data table to be queried, where the data table to be queried is configured according to the signature information of the target application program interface.
A sending instruction module 806 configured to send a call instruction to the target application program interface according to the query field and the query condition.
A second receiving module 808 configured to receive a calling result generated by the target application program interface in response to the calling instruction.
A parsing module 810 configured to parse the call result to obtain a query result.
The foregoing is an exemplary scheme of an application program interface calling apparatus according to this embodiment. It should be noted that the technical solution of the application program interface calling apparatus and the technical solution of the application program interface calling method belong to the same concept, and details that are not described in detail in the technical solution of the application program interface calling apparatus can be referred to the description of the technical solution of the application program interface calling method.
The application program interface calling device provided in the embodiment of the present specification receives a query statement, determines a target application program interface according to a to-be-queried data table in the query statement, sends a calling instruction to the target application program interface according to a query field and a query condition, receives a calling result generated by the target application program interface in response to the calling instruction, and analyzes the calling result to obtain a final query result.
FIG. 9 illustrates a block diagram of a computing device 900 provided in accordance with one embodiment of the present specification. Components of the computing device 900 include, but are not limited to, a memory 910 and a processor 920. The processor 920 is coupled to the memory 910 via a bus 930, and a database 950 is used to store data.
Computing device 900 also includes access device 940, access device 940 enabling computing device 900 to communicate via one or more networks 960. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 940 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 900, as well as other components not shown in FIG. 9, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 9 is for purposes of example only and is not limiting as to the scope of the description. Those skilled in the art may add or replace other components as desired.
Computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 900 may also be a mobile or stationary server.
Wherein the memory 910 is configured to store computer-executable instructions, and the processor 920 is configured to execute the following computer-executable instructions:
determining a target application program interface and acquiring signature information of the target application program interface;
setting database statements according to the signature information;
and configuring a data table to be inquired for the target application program interface by executing the database statement.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the foregoing application program interface configuration method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the foregoing application program interface configuration method.
FIG. 10 shows a block diagram of a computing device 1000, according to an embodiment of the present description. The components of the computing device 1000 include, but are not limited to, memory 1010 and a processor 1020. The processor 1020 is coupled to the memory 1010 via a bus 1030 and the database 1050 is used to store data.
The electronic device 1000 also includes an access device 1040, the access device 1040 enabling the electronic device 1000 to communicate via one or more networks 1060.
The access mode of the electronic device 1000 is the same as that of the electronic device 900, and is not described herein again.
Wherein, the processor 1020 is configured to execute the following computer-executable instructions:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the application program interface calling method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the application program interface calling method.
An embodiment of the present specification also provides a computer readable storage medium storing computer instructions which, when executed by a processor, are used for implementing the steps of the application program interface configuration method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the above-mentioned application program interface configuration method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above-mentioned application program interface configuration method.
An embodiment of the present specification also provides a computer readable storage medium storing computer instructions, which when executed by a processor, are used for implementing the steps of the application program interface calling method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the application program interface calling method belong to the same concept, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the application program interface calling method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for an embodiment of the specification.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.

Claims (13)

1. An application program interface configuration method, comprising:
determining a target application program interface and acquiring signature information of the target application program interface;
setting database statements according to the signature information;
and configuring a data table to be inquired for the target application program interface by executing the database statement.
2. The method of claim 1, wherein obtaining signature information of the target api comprises:
accessing an interface registration directory storing the target application program interface;
and searching the interface definition, the function name, the parameter and the return value of the target application program interface in the interface registration directory.
3. The application program interface configuration method of claim 2, setting a database statement according to the signature information, comprising:
setting a data definition statement according to the interface definition, the function name, the parameter, and the return value.
4. The application program interface configuration method of claim 3, setting a data definition statement according to the interface definition, the function name, the parameter, and the return value, comprising:
setting a generating statement of a database to be queried according to the interface definition;
and setting a generation statement of a data table to be queried according to the function name, the parameter and the return value.
5. The application program interface configuration method according to claim 4, wherein setting a generation statement of a data table to be queried according to the function name, the parameter and the return value comprises:
under the condition that the number of the function names is one, taking the parameters and the return values as field columns in a statement generated by a data table to be queried; or
And under the condition that the number of the function names is at least two, the parameters comprise fixed parameters and non-fixed parameters, the fixed parameters are used as attribute columns in the statement generated by the data table to be queried, and the non-fixed parameters and the return values are used as field columns in the statement generated by the data table to be queried.
6. The application program interface configuration method of claim 1, further comprising:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining the target application program interface according to the data table to be inquired;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
7. An application program interface calling method, comprising:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
8. An application program interface configuration apparatus comprising:
an acquisition module configured to determine a target application program interface and acquire signature information of the target application program interface;
a setting module configured to set a database statement according to the signature information;
and the configuration module is configured to configure a data table to be queried for the target application program interface by executing the database statement.
9. An application program interface calling apparatus comprising:
the device comprises a first receiving module, a second receiving module and a query module, wherein the first receiving module is configured to receive a query statement, and the query statement comprises a query field, a data table to be queried and a query condition;
the determining module is configured to determine a target application program interface according to the data table to be queried, wherein the data table to be queried is configured according to signature information of the target application program interface;
a sending instruction module configured to send a calling instruction to the target application program interface according to the query field and the query condition;
a second receiving module configured to receive a calling result generated by the target application program interface in response to the calling instruction;
a parsing module configured to parse the invocation result to obtain a query result.
10. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
determining a target application program interface and acquiring signature information of the target application program interface;
setting database statements according to the signature information;
and configuring a data table to be inquired for the target application program interface by executing the database statement.
11. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
receiving a query statement, wherein the query statement comprises a query field, a data table to be queried and a query condition;
determining a target application program interface according to the data table to be queried, wherein the data table to be queried is obtained according to the signature information configuration of the target application program interface;
sending a calling instruction to the target application program interface according to the query field and the query condition;
receiving a calling result generated by the target application program interface in response to the calling instruction;
and analyzing the calling result to obtain a query result.
12. A computer readable storage medium storing computer instructions which, when executed by a processor, carry out the steps of the application program interface configuration method of any one of claims 1 to 6.
13. A computer readable storage medium storing computer instructions which, when executed by a processor, perform the steps of the application programming interface calling method of claim 7.
CN202010241799.9A 2020-03-31 2020-03-31 Application program interface configuration method and device Pending CN113468253A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010241799.9A CN113468253A (en) 2020-03-31 2020-03-31 Application program interface configuration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010241799.9A CN113468253A (en) 2020-03-31 2020-03-31 Application program interface configuration method and device

Publications (1)

Publication Number Publication Date
CN113468253A true CN113468253A (en) 2021-10-01

Family

ID=77865199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010241799.9A Pending CN113468253A (en) 2020-03-31 2020-03-31 Application program interface configuration method and device

Country Status (1)

Country Link
CN (1) CN113468253A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191699A1 (en) * 2010-02-02 2011-08-04 Dynavox Systems, Llc System and method of interfacing interactive content items and shared data variables
CN103136095A (en) * 2011-11-28 2013-06-05 阿里巴巴集团控股有限公司 Method, device and system of test application program interface
US20160171051A1 (en) * 2014-12-15 2016-06-16 National Tsing Hua University Synchronization system for transforming database and method thereof
CN106855889A (en) * 2016-12-29 2017-06-16 深圳市华傲数据技术有限公司 The development approach and device of the extemporaneous query function of the tables of data of different data sources
CN107025253A (en) * 2016-09-19 2017-08-08 阿里巴巴集团控股有限公司 A kind of method, database operation method and device for creating database interface
US9760571B1 (en) * 2013-07-23 2017-09-12 jSonar Inc. Tabular DB interface for unstructured data
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
US20180096032A1 (en) * 2016-09-30 2018-04-05 Sap Se Metadata application programming interface for ad hoc database queries
CN109165039A (en) * 2018-04-28 2019-01-08 北京数聚鑫云信息技术有限公司 A kind of configuration and execution method, system and medium of web API
CN109241388A (en) * 2018-08-28 2019-01-18 广州品唯软件有限公司 A kind of application programming interfaces behavior analysis method and system
CN110309334A (en) * 2018-04-20 2019-10-08 腾讯科技(深圳)有限公司 Querying method, system, computer equipment and the readable storage medium storing program for executing of chart database
CN110569299A (en) * 2018-01-29 2019-12-13 北京数聚鑫云信息技术有限公司 management system and management method based on API

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191699A1 (en) * 2010-02-02 2011-08-04 Dynavox Systems, Llc System and method of interfacing interactive content items and shared data variables
CN103136095A (en) * 2011-11-28 2013-06-05 阿里巴巴集团控股有限公司 Method, device and system of test application program interface
US9760571B1 (en) * 2013-07-23 2017-09-12 jSonar Inc. Tabular DB interface for unstructured data
US20160171051A1 (en) * 2014-12-15 2016-06-16 National Tsing Hua University Synchronization system for transforming database and method thereof
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
CN107025253A (en) * 2016-09-19 2017-08-08 阿里巴巴集团控股有限公司 A kind of method, database operation method and device for creating database interface
US20180096032A1 (en) * 2016-09-30 2018-04-05 Sap Se Metadata application programming interface for ad hoc database queries
CN106855889A (en) * 2016-12-29 2017-06-16 深圳市华傲数据技术有限公司 The development approach and device of the extemporaneous query function of the tables of data of different data sources
CN110569299A (en) * 2018-01-29 2019-12-13 北京数聚鑫云信息技术有限公司 management system and management method based on API
CN110309334A (en) * 2018-04-20 2019-10-08 腾讯科技(深圳)有限公司 Querying method, system, computer equipment and the readable storage medium storing program for executing of chart database
CN109165039A (en) * 2018-04-28 2019-01-08 北京数聚鑫云信息技术有限公司 A kind of configuration and execution method, system and medium of web API
CN109241388A (en) * 2018-08-28 2019-01-18 广州品唯软件有限公司 A kind of application programming interfaces behavior analysis method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GHULE, S.; VADALI, R.: "Transformation of SQL system to NoSQL system and performing data analytics using SVM", 《 2017 INTERNATIONAL CONFERENCE ON TRENDS IN ELECTRONICS AND INFORMATICS》, 1 January 2017 (2017-01-01), pages 883 - 887 *
贾小卫: "基于J2EE的工作流引擎的设计与实现", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, 15 April 2005 (2005-04-15), pages 139 - 85 *

Similar Documents

Publication Publication Date Title
CN111552678A (en) Data permission configuration method and device and computer equipment
CN106649630A (en) Data query method and device
US9378458B2 (en) Method and apparatus for operating a finite state machine
CN111324343B (en) Code generation method and device
CN113467972B (en) Communication interface construction method and device, computer equipment and storage medium
CN111596902B (en) Method, device, equipment and storage medium for building front-end and back-end development framework
CN111767047A (en) Micro-service component management method and device
CN112799659A (en) Method, device and terminal for automatically generating data interface without programming
CN113515564B (en) J2 EE-based data access method, device, equipment and storage medium
CN111259067A (en) Method, device and equipment for realizing DAO interface based on Spring
CN113312374A (en) Data query method, device, equipment and storage medium
CN113535749A (en) Query statement generation method and device
CN109597825B (en) Rule engine calling method, device, equipment and computer readable storage medium
CN111475492B (en) Data processing method and device
CN105653334B (en) MIS system rapid development framework based on SAAS mode
CN113468253A (en) Application program interface configuration method and device
US11687503B2 (en) Maintaining foreign key references across domains
CN115934537A (en) Interface test tool generation method, device, equipment, medium and product
CN115357606A (en) Data source query method, system, computer equipment and storage medium
CN114296696A (en) Business function operation method and device, storage medium and electronic equipment
CN114265866A (en) Streaming data processing method, rule plug-in, streaming data processing module and system
CN112445811A (en) Data service method, device, storage medium and component based on SQL configuration
CN115145911A (en) Synchronous writing method of database, method for acquiring change information and respective devices
CN115017185A (en) Data processing method, device and storage medium
US9338248B2 (en) Parameter driven value conversion framework in client/server architectures

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40063916

Country of ref document: HK