WO2017101727A1 - 调用应用编程接口的方法和系统 - Google Patents

调用应用编程接口的方法和系统 Download PDF

Info

Publication number
WO2017101727A1
WO2017101727A1 PCT/CN2016/108979 CN2016108979W WO2017101727A1 WO 2017101727 A1 WO2017101727 A1 WO 2017101727A1 CN 2016108979 W CN2016108979 W CN 2016108979W WO 2017101727 A1 WO2017101727 A1 WO 2017101727A1
Authority
WO
WIPO (PCT)
Prior art keywords
data information
information
metadata file
programming interface
application programming
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.)
Ceased
Application number
PCT/CN2016/108979
Other languages
English (en)
French (fr)
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
Publication of WO2017101727A1 publication Critical patent/WO2017101727A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications

Definitions

  • the present application relates to the field of application programming interface calling, and in particular, to a method and system for calling an application programming interface API based on a metadata (Metadata) command line tool.
  • API application programming interfaces
  • SDK software development kit
  • the system that uses the command line tool to call the API is shown in Figure 1.
  • the interactive interface 110 receives the command input by the user and parses the command, and sends the parsed command to the SDK parsing and calling module 120; the SDK parsing and calling module calls the corresponding interface in the SDK package 130, and performs all the interfaces and the parsed commands.
  • Match when any interface of all interfaces matches the parsed command, the SDK parsing and calling module verifies and generates a request according to the parsed command, and calls the matching interface to send the request to the remote server for use in The remote server returns the result based on the request.
  • command line tool since the command line tool that calls the API is completed by the secondary encapsulation of the SDK package, the command line tool has a strong dependency on the SDK package.
  • the command line tool has poor adaptability to the service, and it is easy to cause the command line tool to update the SDK package due to the API update, but it cannot work.
  • the command line tool when there are multiple different services on a remote server, the command line tool must rely on multiple SDKs (each service needs a specific SDK to match), and each SDK is The implementation of the command line tool must adopt a consistent method.
  • the command line tool needs to adapt the SDK of different services one by one; or the command line tool when there are multiple APIs for the same service. Need to be compatible with different versions, and need to install multiple versions of the SDK to implement API calls.
  • the method and device for invoking an application programming interface provided by the embodiment of the present application, by calling all the application program interfaces from the metadata file, the command line tool for calling the API no longer depends on the SDK package, and the command line tool is improved for the service. Matching.
  • an embodiment of the present application provides a method for calling an application programming interface, where the method includes:
  • Parsing a call operation request input by the user acquiring at least one first data information in the call operation request; calling the corresponding application programming interface according to the at least one first data information, acquiring at least one second data information from the metadata file; The first data information and the at least one second data information are legally verified by the at least one first data information; when the at least one first data information is legally verified, the at least one first data information is generated according to the at least one first data information and the at least one second data information Request message; send a request message to the remote server for the remote server to return result information according to the request message.
  • the embodiment of the present application further provides a system, including: a command parsing module, a metadata parsing module, a metadata description module, a generating request module, and a public networking module;
  • a command parsing module configured to parse a call operation request input by the user, and obtain at least one first data information in the call operation request;
  • the metadata parsing module is further configured to describe the metadata of the module from the metadata according to the at least one first data information Acquiring at least one second data information in the file;
  • the command parsing module is further configured to perform legal verification (or matching) on the at least one first data information according to the at least one first data information and the at least one second data information, to determine that the call needs to be invoked
  • An application programming interface configured to generate a request message according to the at least one first data information and the at least one second data information when the at least one first data information is legally verified;
  • the public networking module is configured to be invoked
  • the application programming interface sends a request message to the remote server for the remote server to return result information based on the request message.
  • the method and system for invoking an application programming interface acquires the first data information according to the call operation request input by the parsing user, invokes the corresponding application programming interface according to the first data information, and acquires the second data from the metadata file. And matching the first data information according to the first data information and the second data information to determine an invoked application programming interface, generating a request message according to the first data information and the second data information, and calling the application programming interface Sent to the remote server, avoiding the command line tool dependencies of calling APIs in the prior art
  • the SDK package improves the adaptability of the command line tools to the service.
  • FIG. 1 is a schematic diagram of a system for invoking an API of a command line tool in the prior art
  • FIG. 2 is a schematic structural diagram of a system according to an embodiment of the present application.
  • FIG. 3 is a flowchart of a method for calling an application programming interface according to an embodiment of the present application
  • FIG. 4 is a flowchart of a method for updating a metadata file according to an embodiment of the present application
  • FIG. 5 is a flowchart of a method for updating a metadata file according to another embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a system according to an embodiment of the present application.
  • the system 200 shown in FIG. 2 includes an interaction module 210, a command parsing module 220, a metadata parsing module 230, a metadata description module 240, a generation request module 250, a signature module 260, and a public networking module 270.
  • the interaction module 210 in the system 200 is configured to receive a command line input by a user, where the command line may be an instruction to invoke an operation request, to instruct the system to call an Application Programming Interface (API), and perform a corresponding operation, for example, Sending a request message to the remote server, so that the remote server returns corresponding resource information according to the request message.
  • the command line can also be a metadata file update request for instructing the system to update the metadata file in the metadata description module 240.
  • the command line input by the user may include a service name, an application programming interface name, and an application programming interface parameter.
  • the command entered by the user is:
  • aliyuncli indicates the name of the tool
  • ecs indicates the service name
  • StartInstance/StopInstance indicates the operation
  • InstanceId and port indicate the application programming interface parameters
  • 12345 and 80/43 are the parameters of the InstanceId and port respectively
  • port 80 indicates the http network
  • port 443 Indicates the https network protocol.
  • the service name, the application programming interface name and the application programming interface parameter in the above command line are for the purpose of describing the solution of the present application in detail, and the command line input by the user may also include other information, for example, an application programming interface.
  • the style, the signature mode, and the like call related information of the application programming interface, and the content of the above examples does not limit the technical solution of the present application.
  • the interaction module 210 When the interaction module 210 receives the command line input by the user, the interaction module 210 "assembles" the command line input by the user, and the “assembly" processes the parameter names and values in the command line, for example, the parameter name can be The value is placed in a data structure, typically into a dictionary type or a map type data structure, so that the information entered by the user continues to be passed through the system.
  • the interaction module 210 assembles the command line as:
  • aliyuncli is generally the name of the tool; ecs indicates the service name; StartInstance indicates the operation; InstanceId, port and region are the application programming interface parameters; 12345, 80 and cn-hangzhou are the parameters of the InstanceId, port, and region application programming interface parameters. content;.
  • the interaction module 210 may further convert the received command line, and may name the function that may be called in an uppercase manner in the application, for example, the function name is “CreateInstance”, during the function call process, The user inputs "createinstance”.
  • the interaction module 210 converts the "createinstance” input by the user into "CreateInstance” for calling the function.
  • the command parsing module 220 is configured to parse the command line input by the user received by the interaction module 210, and determine whether the command line received by the interaction module 210 is a call operation request or a metadata file update request.
  • the parsing command behavior invokes the operation request, so as to be based on the application programming interface name in the command line, the application programming interface parameters and the like, and the corresponding application programming interface name obtained from the metadata file
  • the application programming interface Information such as parameters are matched one by one to determine the application programming interface that needs to be called, and the command line is sent to the generation request module 250 and the information obtained from the original data file.
  • the metadata file update request is sent to the public networking module 270, so that the public network module 270 sends the metadata file update request to the remote server, and the remote server updates according to the metadata file.
  • the request returns the version information of the remote server side metadata file, so that the system updates according to the version information of the metadata file in the metadata description module 240.
  • the metadata file of the system does not need to be updated; when the remote server returns the remote server.
  • the system downloads the metadata file from the remote server through the public networking module 270, and overwrites the metadata description module 240. The original metadata file to complete the update of the metadata file.
  • the original file of the system may also be updated or upgraded by using other information than the version information, for example, matching the remote server with any original system.
  • the information of the file is different, the date of the original file version and other information.
  • the metadata parsing module 230 is configured to parse the data in the metadata file in the metadata description module 240.
  • the command parsing module 220 parses the metadata file acquired from the metadata description module 240 through the metadata parsing module 230 according to the command line input by the user, the data information corresponding to the command line input by the user is obtained, for example, the command line input by the user includes The service name (or the product name), the name of the API, the parameters of the API, the API interface information, and the like
  • the command parsing module 220 passes the metadata parsing module 230 from the metadata description module 240 according to the API interface information input by the user.
  • the information corresponding to the service name, API name, API parameters, API interface information, and the like included in the command line input by the user is obtained.
  • the command line input by the user may further include information such as an API style, a signature method, version information of a metadata file, and an Independent Software Vendors (ISV) protocol.
  • information such as an API style, a signature method, version information of a metadata file, and an Independent Software Vendors (ISV) protocol.
  • ISV Independent Software Vendors
  • the metadata description module 240 includes a plurality of metadata files.
  • Each metadata file includes the name, type, style, and version information of the metadata file; the name, type, required, default value, etc. of the interface input parameter; the parameter name, type, and possible of the return value.
  • the error message and so on. Metadata files can be saved in a generic way such as xml or JSON.
  • the metadata description file includes API attribute information, API entry information, ISV protocol (IsvProtocol) description, and return parameter (ResultMapping) description.
  • the API attribute information includes the service (or product) information of the API, the name of the API, the status of the API, the version, the rule or the policy, the style of the API, and the like. . API attribute information can also add other fields as needed. According to API attribute information can be used as a match Rules, used when generating calls.
  • API entry information that is, each parameter in the example, defines its name (name), display name (tagName), type (type), position (position, determines how the parameters are assembled) for each parameter, and is required ( Required), default (default), value conversion (Switch & Case) and other information.
  • the ISV protocol description describes the protocol used to invoke the API and is used to determine how the API is invoked.
  • information about an access point, an invocation rule, and the like may be defined in an ISV protocol description.
  • the return parameter description is for each parameter of the return value, defining its name (name), type (type), display name (tagName), consisting of an array (Array) and a structure (Struct), a description of the complex data type, Whether null is converted to information such as null tags (nullToEmpty).
  • the return parameter describes the object that can be used to return the value after the call.
  • the description of the API attributes and the complete content can be completed, and the description requirements of the API of the general metadata file can be satisfied.
  • the new attribute in the description of the API in the metadata description file, the new attribute may be extended, and the description of the API feature may be added, which is not limited in the embodiment of the present application.
  • the system shown in FIG. 2 of the present application, and the method for calling the application programming interface shown in FIG. 3 below and the method for updating the metadata file shown in FIG. 4 and FIG. API calls can be easily implemented, compatibility between different services (or products) and compatibility of different versions of the same service (or product) can be solved, and common metadata files can be used to make command line tools extremely compatible. And scalability.
  • the generation request module 250 is configured to receive the parsed command line sent by the command parsing module 220 (input by the user); determine the type of the generated request according to the API style in the parsed command line, according to the type of the generated request and the signature in the command line. In the manner, the signature is calculated by the signature module 260, and finally the request message is generated.
  • the type of the generated request is determined according to the API style in the parsed command line.
  • the command line can be assembled into a uniquely determined string by using the format and parameter order of the command line, and the string is used for signature.
  • the order of parameters corresponding to different API styles may be inconsistent, and the order of the parameters is to ensure consistency with the signed string for signing.
  • the request message sent to the remote server after the signature for example, the order of the parameters of the http/https request may be arranged in any order.
  • the signature module 260 is configured to be invoked by the generation request module 250 to generate a signature required for the request message. It should be noted that when the command line tool calls the API, the signature verification mechanism is used for verification.
  • the public networking module 270 is responsible for sending a request message to the remote server, for example: http/https request; or The remote server sends a metadata file update request for updating the metadata file in the metadata description module 240.
  • the command parsing module acquires the first data information according to the calling operation request input by the parsing user, and obtains the second data information from the metadata file of the metadata description module according to the first data information, according to the first a data information and a second data information for the first data information, determining that the application programming interface generation requesting module to be invoked generates a request message according to the first data information and the second data information, and sends the request message to the remote server through the public networking module.
  • the command line tool that implements the calling API no longer relies on the SDK package to improve the suitability of the command line tool for the service.
  • FIG. 3 is a flowchart of a method for calling an application programming interface according to an embodiment of the present application. As shown in FIG. 3, the execution body of the method 300 is the system 200 shown in FIG. 2, and the method 300 includes the following steps:
  • the call operation request is a parsed command line, and the command acts as a command input by the user.
  • This command line is used to instruct the system to call the corresponding application programming interface.
  • the at least one first data information may be information included in the command line, such as one or more of information related to API calls such as a service name, an application programming interface name, and an application programming interface parameter.
  • the at least one second data information includes information corresponding to a command line input by the user, such as one or more of information such as a service name, an application programming interface name, and an application programming interface parameter.
  • the at least one first data information in S310 and the at least one second data information in S320 may be the same information, or may be different information.
  • first and second in the first data information and the second data information are only used to distinguish the source of the data information, and the scope of protection of the embodiments of the present application does not constitute any limitation.
  • S310 and S320 may be executed by the command parsing module 220 shown in FIG. 2.
  • the command line parsing module parses the command line input by the user, and obtains at least one first data information included in the command line, and according to the at least one first data information, for example, the application programming in the at least one first data information
  • the port name obtains, by the metadata parsing module, at least one second data information corresponding to the at least one first data information from the corresponding metadata file, wherein the metadata file is obtained from the metadata description module.
  • S330 Determine an invoked application programming interface according to the at least one first data information and the at least one second data information.
  • the command parsing module is configured to: at least one of the acquired at least one first data information and at least one of the at least one second data information obtained from the metadata file Performing a one-to-one match, for example, matching the first data information service name with the service name in the second data information; matching the first data information API name with the API name in the second data information; and using the first data information API
  • the parameter is matched with the API parameter in the second data information, etc., to verify whether the first data information input by the user has an application programming interface that can be called.
  • the command parsing module may first obtain the service name, the API name, and the API parameter corresponding to the at least one first data information from the metadata file according to the at least one first data information acquired by the parsing command line.
  • the data information to be acquired has an application programming interface that can be called, further information required by the API is further called from the metadata file, for example, version information of the metadata file, API style, signature method, and the like.
  • the call of the system API ends, and the information error information is returned, and the information can be passed through the system shown in FIG.
  • the interactive interface 210 performs information display.
  • the specific process may be: when the S330 matches the at least one first data information input by the user, the generation requesting module receives all the second data information and the at least one first data information that are obtained from the metadata file and sent by the command parsing module.
  • the generation request module invokes the signature module 260 shown in the system of FIG. 2 to calculate the signature based on the received information.
  • the generation request module generates a request message with the calculated signature and the at least one first data information.
  • generating the request message according to the at least one first data information and the at least one second data information may include: calculating a signature according to the at least one first data information and an application programming interface style and a signature manner; The signature, the at least one first data information, and the at least first second data information generation request message.
  • the parameter content of the application programming interface parameter in the first data information and the ISV protocol in the second data information and the calculated signature are required to be spliced, and the request information is organized and generated.
  • calculating the signature according to the at least one first data information and the application programming interface style and signature manner may include:
  • Determining a type of the generated request message according to the application programming interface style Determining a type of the generated request message according to the application programming interface style; organizing an order of the application programming interface parameters in the at least one first data information according to the type of the request message, generating the unique data string by the first data information; according to the at least one first data The signature method in the message and the unique string calculation signature.
  • signature is a necessary step in the process of API calls to improve the security of data transmission.
  • the request message is sent to the remote server, the API call is completed, and the result information returned by the remote server is obtained.
  • S350 can be implemented by the public networking module 270 in the system shown in FIG. 2, specifically, when the generation requesting module assembles the signature calculated by the signature module and the first data information to generate a request message, and is remotely connected through the public networking module.
  • the server sends the request message so that the remote server returns result information according to the request message.
  • the result information returned by the remote terminal can be displayed on the display interface of the system.
  • the result information can be displayed through the interactive interface of the system shown in FIG. 2 .
  • the method 300 before parsing the call operation request input by the user, the method 300 further includes S360 receiving an operation request input by the user.
  • This step can be implemented by the interaction module 210 in the system shown in FIG. 2.
  • the interaction module 210 is further configured to display result information returned by the remote server.
  • the method for invoking an application programming interface acquires the first data information according to the calling operation request input by the parsing user, invokes the corresponding application programming interface according to the first data information, and acquires the second data information from the metadata file. And performing legal verification on the first data information according to the first data information and the second data information. When the first data information is legally verified, the request message is generated according to the first data information and the second data information, and sent to the remote server. .
  • the command line tool that implements the calling API no longer relies on the SDK package to improve the adaptability of the command line tool to the service.
  • the “first” and “second” in the “first data information” and the “second data information” are only used to distinguish the data information input by the user from the data file obtained from the metadata file.
  • the data information does not constitute a limitation on the technical solution of the present application.
  • FIG. 4 is a flowchart of a method for updating a metadata file according to an embodiment of the present application.
  • the execution body of the method 400 is the system 200 shown in FIG. 2, and the method 400 includes the following steps:
  • the metadata file update request may be a command input for the user to check for an update, and is used to instruct the system to determine whether the metadata file is the latest version of the metadata file.
  • This step can be implemented by the command parsing module 210 of the system shown in FIG.
  • the first version information is version information of the metadata file in the current remote server, for example, the version information is V20250505.
  • the step may be implemented by the public networking module 270 in the system shown in FIG. 2, specifically, the command parsing module sends a metadata file update request to the remote server through the public networking module, so that the remote server returns according to the metadata file update request. Version information of the current metadata file in the remote server.
  • the updated metadata file is the metadata file of the current system.
  • updating the metadata file of the current system according to the first version information may include:
  • the metadata file corresponding to the first version information is downloaded from the remote server; the metadata file corresponding to the first version information is overwritten with the metadata file corresponding to the second version information.
  • This step can be implemented by the command parsing module 220 of the system shown in FIG. Specifically, the metadata file corresponding to the first version information is downloaded from the remote server through the public networking module, and the metadata file corresponding to the downloaded first version information is overwritten by the current metadata file of the system, so as to implement the metadata file update. Or upgrade.
  • the metadata file update method parses the metadata file update request input by the user through the command parsing module, and sends a metadata file update request to the remote server to receive the remote server returned by the remote server.
  • the version information of the metadata file, and the metadata file of the current system is updated according to the version information, and the metadata file is updated or upgraded, so as to avoid the command line tool in the prior art, the SDK package cannot be updated synchronously due to the API update, and the The problem of work.
  • the method further includes:
  • this step can be implemented by the interaction module 210 in the system shown in FIG. 2.
  • the interaction module 210 is further configured to display a metadata file corresponding to the first version information downloaded by the remote server.
  • the method further includes: 400 further comprising:
  • the second version information is version information of the current system metadata file, for example, the version information is V20240526.
  • This step can be completed by the command parsing module 220 in the system shown in FIG. 2, and the command parsing module obtains version information from the metadata file of the metadata description module according to the metadata file update request.
  • the method 400 further includes:
  • the second version information when the second version information is the same as the first version information, it is not necessary to update the metadata file of the current system.
  • the metadata file of the current system needs to be updated according to the first version information.
  • This step can be implemented by the command parsing module 220 in the system shown in FIG.
  • the metadata file update method parses the metadata file update request input by the user through the command parsing module, and sends a metadata file update request to the remote server to receive the remote server returned by the remote server.
  • the version information of the metadata file, and the metadata file of the current system is updated according to the version information, and the metadata file is updated or upgraded, so as to avoid the command line tool in the prior art, the SDK package cannot be updated synchronously due to the API update, and the The problem of work.
  • the command parsing module determines whether the version information of the metadata file of the current system is consistent with the version information of the remote server metadata file, saves the power consumption of updating or upgrading the system metadata file, and reduces the update or upgrade of the metadata file through the metadata file. It is time consumption.
  • the size of the sequence numbers of the foregoing processes does not mean the order of execution sequence, and the execution order of each process should be determined by its function and internal logic, and should not be implemented in the embodiment of the present invention. Form any limit.
  • the steps of a method or algorithm described in connection with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Telephonic Communication Services (AREA)

Abstract

一种调用应用编程接口的方法和系统,该方法包括:解析用户输入的调用操作请求,获取调用操作请求中的至少一个第一数据信息(310);根据至少一个第一数据信息从元数据文件中获取至少一个第二数据信息(320);根据至少一个第一数据信息和至少一个第二数据信息确定调用的应用编程接口,并生成请求消息(330,340);通过调用应用编程接口向远程服务器发送请求消息,以用于远程服务器根据请求消息返回结果信息(350)。所述方法避免了现有技术中调用API的命令行工具依赖SDK包的问题,提高了命令行工具对服务的适配性。

Description

调用应用编程接口的方法和系统
本申请要求2015年12月18日递交的申请号为201510956283.1、发明名称为“调用应用编程接口的方法和系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及应用编程接口调用领域,尤其涉及一种基于元数据(Metadata)的命令行工具调用应用编程接口API的方法和系统。
背景技术
一个网站提供一个服务时,不会直接提供服务的源代码,或者称为业务的源代码。服务商会将需要提供的网站服务封装成一系列的应用编程接口(Application Programming Interface,API),以API的方式将该服务提供出去,以供第三方开发者使用,这种行为叫做开放网站的API,被开放的API称作OpenAPI,或称作开放API,也可以称作开放平台。
第三方开发者可以通过网站服务提供API的软件开发工具包(Software Development Kit,SDK)进行二次开发和调用,以完成用户的各种需求。用户在使用网站服务时,利用命令行工具,通过SDK调用API完成通信和交互。
而目前采用命令行工具调用API的系统如图1所示。交互界面110接收用户输入的命令并解析,将解析后的命令发送给SDK解析和调用模块120;SDK解析和调用模块调用SDK包130中的相应的接口,并将所有接口与解析后的命令进行匹配,当所有接口中的任一接口与解析后的命令相匹配时,SDK解析和调用模块根据解析后的命令校验并生成请求,调用相匹配的接口向远程服务器发送该请求,以用于远程服务器根据该请求返回结果。
但是,通过现有的命令行工具调用API,存在至少以下缺点:由于调用API的命令行工具是通过SDK包的二次封装来完成的,所以命令行工具对SDK包具有很强的依赖性,命令行工具对服务的适配性差,且容易造成命令行工具由于API更新,SDK包不能同步更新,而不能工作的情况。比如:当远程服务器存在多个不同的服务时,命令行工具必须依赖多个SDK(每一个服务都需要一个特定的SDK与之匹配),且每个SDK与 命令行工具的实现必须采用一致的方法,如果无法保证SDK与命令行工具的实现流程一致,那么命令行工具就需要逐个适配不同服务的SDK;或者相同服务存在多个API时,命令行工具需要兼容不同版本,且需要安装多个版本的SDK,以实现API的调用。
发明内容
本申请实施例提供的调用应用编程接口的方法和装置,通过从元数据文件中调用所有的应用程序接口,以实现调用API的命令行工具不再依赖SDK包,提高命令行工具对服务的适配性。
为实现上述目的,本申请实施例提供了一种调用应用编程接口的方法,该方法包括:
解析用户输入的调用操作请求,获取调用操作请求中的至少一个第一数据信息;根据至少一个第一数据信息调用相应的应用编程接口,从元数据文件中获取至少一个第二数据信息;根据至少一个第一数据信息与至少一个第二数据信息对至少一个第一数据信息进行合法验证;当至少一个第一数据信息合法验证通过时,根据至少一个第一数据信息和至少一个第二数据信息生成请求消息;向远程服务器发送请求消息,以用于远程服务器根据请求消息返回结果信息。
本申请实施例还提供了一种系统,该系统包括:包括命令解析模块、元数据解析模块、元数据描述模块、生成请求模块和公共连网模块;
命令解析模块,用于解析用户输入的调用操作请求,获取调用操作请求中的至少一个第一数据信息;元数据解析模块还用于,根据至少一个第一数据信息从元数据描述模块的元数据文件中获取至少一个第二数据信息;命令解析模块还用于,根据至少一个第一数据信息与至少一个第二数据信息对至少一个第一数据信息进行合法验证(或匹配),以确定需要调用的应用编程接口;生成请求模块,用于当至少一个第一数据信息合法验证通过时,根据至少一个第一数据信息和至少一个第二数据信息生成请求消息;公共连网模块,用于通过调用的应用编程接口向远程服务器发送请求消息,以用于远程服务器根据请求消息返回结果信息。
本申请实施例提供的调用应用编程接口的方法和系统,根据解析用户输入的调用操作请求获取第一数据信息,根据第一数据信息调用相应的应用编程接口,从元数据文件中获取第二数据信息,并根据第一数据信息和第二数据信息对第一数据信息进行匹配,以确定调用的应用编程接口,根据第一数据信息和第二数据信息生成请求消息,并通过调用的应用编程接口发送给远程服务器,避免了现有技术中调用API的命令行工具依赖 SDK包,提高了命令行工具对服务的适配性。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例中所需要使用的附图作简单地介绍,显而易见地,下面所描述的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为现有技术中命令行工具调用API的系统示意图;
图2为本申请实施例提供的系统结构示意图;
图3为本申请实施例提供的调用应用编程接口的方法的流程图;
图4为本申请实施例提供的元数据文件更新方法的流程图;
图5为本申请另一实施例提供的元数据文件更新方法的流程图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请的一部分实施例,而不是全部实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都应属于本申请保护的范围。
图2为本申请实施例提供的系统结构示意图。如图2所示的系统200包括交互模块210、命令解析模块220、元数据解析模块230、元数据描述模块240、生成请求模块250、签名模块260和公共连网模块270。
该系统200中的交互模块210用于接收用户输入的命令行,该命令行可以为指示调用操作请求,用于指示系统调用应用编程接口(Application Programming Interface,API),并执行相应的操作,例如向远程服务器发送请求消息,以便于远端服务器根据请求消息返回相应的资源信息。该命令行还可以为元数据文件更新请求,用于指示系统更新元数据描述模块240中的元数据文件。
其中,用户输入的命令行可以包括服务名称、应用编程接口名称、应用编程接口参数。例如用户输入的命令为:
aliyuncli ecs StartInstance—InstanceId 12345—port 80
或者
aliyuncli ecs StopInstance—instanceId 12345—port 443
其中,aliyuncli表示工具的名称;ecs表示服务名称;StartInstance/StopInstance表示操作;InstanceId、port表示应用编程接口参数;12345和80/43分别为InstanceId、port的参数内容,port 80表示http网络,port 443表示https网络协议。
例如,在用户数据的其他命令行中包括应用编程接口名称,例如CreateInstance等。
应理解,以上命令行中的服务名称、应用编程接口名称和应用编程接口参数是为了详细描述本申请的方案进行的举例说明,且用户输入的命令行还可以包括其他信息,例如,应用编程接口风格、签名方式等调用应用编程接口的相关信息,以上示例的内容并不限制本申请的技术方案。
但为了提高用户的体验,在本申请实施例中,以用户输入的命令行包括服务名称、应用编程接口名称和应用编程接口参数为例对本申请的技术方案进行详细说明。
当交互模块210接收到用户输入的命令行时,交互模块210会对用户输入的命令行进行“拼装”,该“拼装”将命令行中的参数名称和值进行处理,例如,可以将参数名称和值放到某个数据结构,典型的入字典类型或者map类型的数据结构,以便于用户输入的信息在系统中继续传递。
假设用户输入的命令行为:
aliyuncli ecs StartInstance—InstanceId 12345—port 80—region cn-hangzhou-----;
交互模块210会将命令行拼装为:
{“InstanceId”:“12345”,“port”:“80”,“region”:“cn-hangzhou”}
其中,aliyuncli一般是工具的名称;ecs表示服务名称;StartInstance表示操作;InstanceId、port和region均为应用编程接口参数;12345、80和cn-hangzhou依次为InstanceId、port、region应用编程接口参数的参数内容;。
在本申请实施例中,交互模块210还可以对接收到命令行进行转换,在应用中可能以大写的方式为可能被调用的函数命名,比如函数名称为“CreateInstance”,在函数调用过程中,用户输入了“createinstance”,在命令行工具做大小写兼容的情况下,交互模块210将用户输入的“createinstance”转换为“CreateInstance”,以进行函数的调用。
命令解析模块220用于解析交互模块210接收的用户输入的命令行,确定交互模块210接收到的命令行是调用操作请求还是元数据文件更新请求。
当解析命令行为调用操作请求时,以便于根据命令行中的应用编程接口名称,应用编程接口参数等信息与从元数据文件中获取的相应的应用编程接口名称,应用编程接口 参数等信息逐一匹配,以确定需要调用的应用编程接口,并向生成请求模块250发送该命令行和从原数据文件中获取的信息。
当解析命令行为元数据文件更新请求时,向公共连网模块270发送元数据文件更新请求,以便于公共连网模块270将该元数据文件更新请求发送给远程服务器,远程服务器根据元数据文件更新请求返回远程服务器端元数据文件的版本信息,以便于系统根据元数据描述模块240中的元数据文件的版本信息进行更新。
当远程服务器返回的远程服务器的元数据文件的版本信息与系统中元数据描述模块240中的元数据文件的版本信息一致时,该系统的元数据文件不需要更新;当远程服务器返回的远程服务器的元数据文件的版本信息与系统中元数据描述模块240中的元数据文件的版本信息不一致时,系统通过公共连网模块270从远程服务器下载元数据文件,并覆盖元数据描述模块240中的原有的元数据文件,以完成元数据文件的更新。
应理解,在本申请实施例中,当系统需要更新或升级时,也可以通过除版本信息之外的其他信息对系统的原文件进行更新或升级,例如匹配远程服务端与系统中任一原文件的信息不相同时,原文件版本的上线日期等信息。
元数据解析模块230用于解析元数据描述模块240中的元数据文件中的数据。当命令解析模块220根据用户输入的命令行通过元数据解析模块230解析从元数据描述模块240中获取的元数据文件,获取与用户输入的命令行相应的数据信息,例如用户输入的命令行包括服务名称(或称为产品名称),API的名称,API的参数,API接口信息等其他信息,那么命令解析模块220根据用户输入的API接口信息,通过元数据解析模块230从元数据描述模块240中的元数据文件中获取与用户输入的命令行包括的服务名称,API的名称,API的参数,API接口信息等其他信息相应的信息。
其中,用户输入的命令行还可以包括API风格、签名方式、元数据文件的版本信息、独立软件开发商(Independent Software Vendors,ISV)协议等信息。
元数据描述模块240包括多个元数据文件。每个元数据文件中都包括一个接口的名称、类型、风格、元数据文件的版本信息;接口入参的名称、类型、是否必填、默认值等信息;返回值的参数名称、类型以及可能的报错信息等。元数据文件可以以xml或JSON等通用方式保存。
下面以xml格式的元数据(Matedate)文件为例,详细阐述元数据文件对API描述的方式:
Figure PCTCN2016108979-appb-000001
Figure PCTCN2016108979-appb-000002
Figure PCTCN2016108979-appb-000003
在该示例中,元数据描述文件包括API属性信息、API入参信息、ISV协议(IsvProtocol)描述和返回参数(ResultMapping)描述。
API属性信息包括API所属服务(或产品)信息(product)、API的名称(name)、API状态(status)、版本(version)、规则或者称作协议(policy)、API风格(style)等信息。API属性信息还可以根据需要增加其他字段。根据API属性信息可以作为匹配 规则,在生成调用时使用。
API入参信息,即示例中每一个参数,为每一个参数定义了其名称(name),展示名(tagName),类型(type),位置(position,决定参数被如何拼装),是否必填(required),默认值(default),数值转换(Switch&Case)等信息。通过以上信息可以将入参进行全面描述,还可以根据需要增加例如最大最小值等属性,进一步对入参进行约束.以上信息用于在生成调用时对入参进行定义,影响API调用时入参的拼装方式和约束。
ISV协议描述是对调用该API使用的协议进行描述,用于确定API的调用方式。在本申请实施例中关于接入点,调用规则等信息可以在ISV协议描述中进行定义。
返回参数描述是对返回值的每个参数,定义其名称(name),类型(type),展示名(tagName),由数组(Array)以及结构体(Struct)组成的,复杂数据类型的描述,null是否转化为空标签(nullToEmpty)等信息。返回参数描述可用于调用后返回值的对象。
通过以上示例,可以完成API属性及完整内容的描述,满足通用元数据文件对API的描述需求。在本申请实施例中,在元数据描述文件对API的描述中,还可以扩展新的属性,增加更多API特征的描述,在本申请实施例中对此不作限制。
采用本申请示例所示的元数据文件,通过本申请图2所示的系统,以及下文图3所示的调用应用编程接口的方法和图4、图5所示的元数据文件更新的方法,可以轻松实现API的调用,解决了不同服务(或产品)的兼容性和相同服务(或产品)的不同版本的兼容性,利用通用的元数据文件,可以使得命令行工具具有极大的兼容性和可扩展性。
生成请求模块250用于接收命令解析模块220发送的解析后的命令行,(用户输入的);根据解析后的命令行中API风格确定生成请求的类型,根据生成请求的类型和命令行中签名方式,通过签名模块260计算签名,最终生成请求消息。
根据解析后的命令行中API风格确定生成请求的类型可以通过组织命令行的格式和参数顺序,将命令行拼成一个唯一确定的字符串,该字符串用于签名。在本申请实施例中,不同的API风格对应的参数顺序可能不一致,该参数的顺序就是为了签名时保证与被签名的字符串一致。
应理解,签名过后向远程服务器发送的请求消息,例如:http/https请求的参数顺序可以任一排列。
签名模块260用于被生成请求模块250调用,生成请求消息需要的签名。需要说明的是,在命令行工具调用API时,都会采用签名校验机制进行验证。
公共连网模块270负责向远程服务器发送请求消息,例如:http/https请求;或者向 远程服务器发送元数据文件更新请求,以用于更新元数据描述模块240中的元数据文件。
通过本申请实施例提供的系统,命令解析模块根据解析用户输入的调用操作请求获取第一数据信息,并根据第一数据信息从元数据描述模块的元数据文件中获取第二数据信息,根据第一数据信息和第二数据信息对第一数据信息,确定需要调用的应用编程接口生成请求模块根据第一数据信息和二数据信息生成请求消息,并通过公共连网模块发送给远程服务器。以实现调用API的命令行工具不再依赖SDK包,提高命令行工具对服务的适配性。
以上描述了本申请实施例提供的系统,下面结合图3对图2所示系统调用应用编程接口的方法进行详细的描述。
图3为本申请实施例提供的一种调用应用编程接口方法的流程图。如图3所示,该方法300的执行主体为图2所示的系统200,该方法300包括以下步骤:
S310,解析用户输入的调用操作请求,获取调用操作请求中的至少一个第一数据信息。
该调用操作请求为解析后的命令行,命令行为用户输入的命令。该命令行用于指示系统调用相应的应用编程接口。至少一个第一数据信息可以为命令行中包括的信息,例如:服务名称、应用编程接口名称和应用编程接口参数等API调用的相关信息中的一个或多个信息。
S320,根据至少一个第一数据信息,从元数据文件中获取与至少一个第一数据信息相对应的至少一个第二数据信息。
至少一个第二数据信息包括与用户输入的命令行相对应的信息,例如:服务名称、应用编程接口名称和应用编程接口参数等信息中的一个或多个信息。在本申请实施例中,S310中的至少一个第一数据信息与S320中的至少一个第二数据信息可以为相同的信息,也可以为不相同的信息。
应理解,在该实施例中,第一数据信息和第二数据信息中的“第一”和“第二”只是为了区别数据信息的来源不同,对本申请实施例的保护范围不构成任何限制。
需要说明的是,在本申请实施例的方案中,S310和S320可以通过图2所示的命令解析模块220来执行。
具体的,命令行解析模块解析用户输入的命令行,获取命令行中包括的至少一个第一数据信息,根据至少一个第一数据信息,例如至少一个第一数据信息中的应用编程接 口名称,通过元数据解析模块从相对应元数据文件中获取与至少一个第一数据信息相对应的至少一个第二数据信息,其中,元数据文件是从元数据描述模块中获取的。
S330,根据至少一个第一数据信息与至少一个第二数据信息确定调用的应用编程接口。
确定调用的应用编程接口可以为:命令解析模块将获取到的至少一个第一数据信息中的至少一个数据信息与从元数据文件中获取到的至少一个第二数据信息中相应的至少一个数据信息进行一一匹配,例如将第一数据信息服务名称与第二数据信息中的服务名称进行匹配;将第一数据信息API名称与第二数据信息中的API名称进行匹配;将第一数据信息API参数与第二数据信息中的API参数进行匹配等等,以验证用户输入的第一数据信息是否有可以调用的应用编程接口。
在本申请实施例中,命令解析模块可以先根据解析命令行获取的至少一个第一数据信息,从元数据文件中获取与至少一个第一数据信息相对应的服务名称,API名称和API参数,待获取的数据信息存在可以调用的应用编程接口时,再从元数据文件中进一步API调用需要的其他信息,例如:元数据文件的版本信息、API风格,签名方法等信息。
在本申请实施例中,当至少一个第一数据信息中的任一数据信息未通过合法匹配时,该系统API的调用都会结束,并返回信息错误信息,该信息可以通过图2所示系统中的交互界面210进行信息显示。
S340,根据至少一个第一数据信息和至少一个第二数据信息生成请求消息。
当S330中对用户输入的至少一个第一数据信息中每一数据信息都匹配成功时,对用户输入的至少一个第一数据信息和从与数据文件中获取的所有的信息进行组织生成请求消息,该步骤可以通过图2所示系统中的生成请求模块250来执行。
具体过程可以为,当S330对用户输入的至少一个第一数据信息匹配成功时,生成请求模块接收命令解析模块发送的从元数据文件中获取的所有的第二数据信息和至少一个第一数据信息,生成请求模块根据接收到的信息调用图2系统所示的签名模块260计算签名。生成请求模块将计算的签名和至少一个第一数据信息生成请求消息。
可选地,在本申请实施例中,根据至少一个第一数据信息和至少一个第二数据信息生成请求消息可以包括:根据至少一个第一数据信息和应用编程接口风格、签名方式计算签名;根据签名、至少一个第一数据信息和至少第一第二数据信息生成请求消息。
例如,需要第一数据信息中的应用编程接口参数的参数内容和第二数据信息中的ISV协议以及计算的签名进行拼接,组织生成请求信息。
可选地,在本申请实施例中,根据至少一个第一数据信息和应用编程接口风格、签名方式计算签名可以包括:
根据应用编程接口风格确定生成请求消息的类型;根据请求消息的类型组织至少一个第一数据信息中的应用编程接口参数的顺序,将第一数据信息生成唯一的字符串;根据至少一个第一数据信息中的签名方式和唯一的字符串计算签名。
应理解,在API调用的过程中,签名是一个必须的步骤,以提高数据传输的安全性。
S350,通过调用应用编程接口向远程服务器发送请求消息,以用于远程服务器根据请求消息返回结果信息。
当S340生成请求消息之后,将请求消息发送给远程服务器,完成API的调用,并获取远程服务器返回的结果信息。
S350可以通过图2所述系统中的公共连网模块270连实现,具体为当生成请求模块将调用签名模块计算的签名和第一数据信息进行拼装生成请求消息时,通过公共连网模块向远程服务器发送该请求消息,以便于远程服务器根据该请求消息返回结果信息。
远程终端返回的结果信息可以通过在系统的显示界面上进行显示,在本申请实施例中,结果信息可以通过图2所示系统的交互界面进行显示。
可选地,在本申请实施例中,在解析用户输入的调用操作请求之前,该方法300还包括S360接收用户输入的操作请求。
该步骤可以通过图2所示的系统中的交互模块210实现。在本申请实施例中,交互模块210还用于显示远程服务器返回的结果信息。
通过本申请实施例提供的调用应用编程接口的方法,根据解析用户输入的调用操作请求获取第一数据信息,根据第一数据信息调用相应的应用编程接口,从元数据文件中获取第二数据信息,并根据第一数据信息和第二数据信息对第一数据信息进行合法验证,当第一数据信息合法验证通过时,根据第一数据信息和第二数据信息生成请求消息,并发送给远程服务器。实现了调用API的命令行工具不再依赖SDK包,提高命令行工具对服务的适配性。
应理解,在本申请实施例中,“第一数据信息”和“第二数据信息”中的“第一”和“第二”只是为了区别用户输入的数据信息与从元数据文件中获取的数据信息,并不构成对本申请技术方案的限制。
通过图2所示的系统,还可以实现元数据文件的更新升级,下面结合图4所示的元 数据文件更新的方法的流程图,对本申请实施例的技术方案进行详细的说明。
图4为本申请实施例提供的元数据文件更新方法的流程图。如图4所示,在方法400的执行主体为图2所示的系统200,该方法400包括以下步骤:
S410,解析用户输入的元数据文件更新请求。
元数据文件更新请求可以为用户输入的检查更新的命令,用于指示系统确定元数据文件是否为最新版本的元数据文件。
该步骤可以由图2所示系统的命令解析模块210来实现。
S420,向远程服务器发送元数据文件更新请求,以用于远程服务器根据元数据文件更新请求返回第一版本信息,第一版本信息为远程服务器中元数据文件的版本信息。
第一版本信息为当前远程服务器中元数据文件的版本信息,例如版本信息为V20250505。该步骤可以通过图2所示系统中的公共连网模块270来实现,具体为命令解析模块通过公共连网模块向远程服务器发送元数据文件更新请求,以便于远程服务器根据元数据文件更新请求返回远程服务器中当前元数据文件的版本信息。
S430,根据第一版本信息更新元数据文件。
更新的元数据文件为当前系统的元数据文件。
可选地,在本申请实施例中,根据第一版本信息更新当前系统的元数据文件可以包括:
从远程服务器下载第一版本信息相对应的元数据文件;将第一版本信息对应的元数据文件覆盖第二版本信息对应的元数据文件。
该步骤可以通过图2所示系统的命令解析模块220来实现。具体为,通过公共连网模块从远程服务器下载第一版本信息对应的元数据文件,并将下载的第一版本信息对应的元数据文件覆盖系统当前的元数据文件,以实现元数据文件的更新或升级。
通过本申请实施例提供的元数据文件更新的方法或系统,通过命令解析模块解析用户输入的元数据文件更新请求,并向远程服务器发送元数据文件更新请求,以接收远程服务器返回的远程服务器的元数据文件的版本信息,并根据版本信息更新当前系统的元数据文件,实现了元数据文件的更新或升级,避免先有技术中命令行工具由于API更新,SDK包不能同步更新,造成的不能工作的问题。
可选地,在本申请实施例中,如图5所示,该方法还包括:
S440,接收用户输入的元数据文件更新请求。
具体的,该步骤可以通过图2所示系统中的交互模块210来实现。
在本申请实施例中,交互模块210还可以用来显示远程服务器下载的第一版本信息对应的元数据文件。
可选地,在本申请另一实施例中,如图5所示,该方法还包括400还包括:
S450,根据元数据文件更新请求获取第二版本信息,第二版本信息为当前元数据文件的版本信息。
第二版本信息为当前系统的元数据文件的版本信息,例如版本信息为V20240526。该步骤可以通过图2所示的系统中的命令解析模块220来完成,命令解析模块根据元数据文件更新请求从元数据描述模块的元数据文件中获取版本信息。
应理解,在本申请实施例中,执行S420和S450的先后顺序可以互换,在本申请实施例中执行S420和S450的先后顺序不作任何限制。
可选地,在本申请实施例中,如图5所示,所述方法400还包括:
S460,确定第二版本信息是否为第一版本信息。
在本申请实施例中,当第二版本信息与第一版本信息相同时,不需要更新当前系统的元数据文件。当第二版本信息与第一版本信息不相同时,需要根据第一版本信息更新当前系统的元数据文件。
该步骤可以由图2所示系统中的命令解析模块220来实现。
通过本申请实施例提供的元数据文件更新的方法或系统,通过命令解析模块解析用户输入的元数据文件更新请求,并向远程服务器发送元数据文件更新请求,以接收远程服务器返回的远程服务器的元数据文件的版本信息,并根据版本信息更新当前系统的元数据文件,实现了元数据文件的更新或升级,避免先有技术中命令行工具由于API更新,SDK包不能同步更新,造成的不能工作的问题。同时通过命令解析模块确定当前系统的元数据文件的版本信息与远程服务器元数据文件的版本信息是否一致,节省了系统元数据文件更新或升级的功耗,降低了系通过元数据文件更新或升级的是时间消耗。
应理解,在本申请实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。
专业人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束 条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本申请的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本申请的具体实施方式而已,并不用于限定本申请的保护范围,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (27)

  1. 一种调用应用编程接口的方法,其特征在于,所述方法包括:解析用户输入的调用操作请求,获取所述调用操作请求中的至少一个第一数据信息,所述至少一个第一数据信息为调用应用编程接口的信息;
    根据所述至少一个第一数据信息从元数据文件中获取与所述至少一个第一数据信息对应的至少一个第二数据信息;
    根据所述至少一个第一数据信息和所述至少一个第二数据信息确定调用的应用编程接口;
    根据所述至少一个第一数据信息和所述至少一个第二数据信息生成请求消息;
    通过所述应用编程接口向远程服务器发送所述请求消息,以用于所述远程服务器根据所述请求消息返回结果信息。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述至少一个第一数据信息确定调动的应用编程接口,包括:
    将所述至少一个第一数据信息中的至少一个数据信息与所述至少一个第二数据信息中相对应的至少一个数据信息进行逐一匹配,当所述至少一个第一数据信息与相对应的所述至少一个第二数据信息分别匹配时,确定调用的应用编程接口。
  3. 根据权利要求1或2所述的方法,其特征在于,所述至少一个第一数据信息和所述至少一个第二数据信息分别包括服务名称、应用编程接口名称、应用编程接口参数中的一个或多个信息。
  4. 根据权利要求3所述的方法,其特征在于,所述至少一个第二数据信息还包括应用编程接口风格和签名方式。
  5. 根据权利要求4所述的方法,其特征在于,生成请求消息包括:
    根据所述至少一个第一数据信息和所述应用编程接口风格、所述签名方式计算签名;
    根据所述签名、所述至少一个第一数据信息和所述至少一个第二数据信息生成所述请求消息。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述至少一个第一数据信息和应用编程接口风格、所述签名方式计算签名,包括:
    根据所述应用编程接口风格确定生成所述请求消息的类型;
    根据所述请求消息的类型组织所述至少一个第一数据信息中的应用编程接口参数 的顺序,将所述第一数据信息生成唯一的字符串;
    根据所述签名方式和所述唯一的字符串计算签名。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    接收用户输入的所述调用操作请求。
  8. 根据权利要求1-7任一项权利要求所述的方法,其特征在于,所述方法还包括:
    解析用户输入的元数据文件更新请求;
    向所述远程服务器发送所述元数据文件更新请求,以用于所述远程服务器根据所述元数据文件更新请求返回第一版本信息,所述第一版本信息为所述远程服务器中元数据文件的版本信息;
    根据所述第一版本信息更新元数据文件。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    根据所述元数据文件更新请求获取第二版本信息,所述第二版本信息为当前元数据文件的版本信息。
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:
    确定所述第二版本信息是否为第一版本信息。
  11. 根据权利要求10所述的方法,其特征在于,当确定所述第二版本信息与所述第一版本信息不同时,更新所述第二版本信息对应的元数据文件。
  12. 根据权利要求11所述的方法,其特征在于,所述更新所述第二版本信息对应的元数据文件,包括:
    从所述远程服务器下载所述第一版本信息相对应的元数据文件;
    将所述第一版本信息对应的元数据文件覆盖所述第二版本信息对应的元数据文件。
  13. 根据权利要求8-12任一项所述的方法,其特征在于,所述方法还包括:
    接收用户输入的所述元数据文件更新请求。
  14. 一种系统,其特征在于,所述系统包括命令解析模块、元数据解析模块、元数据描述模块、生成请求模块和公共连网模块;
    所述命令解析模块,用于解析用户输入的调用操作请求,获取所述调用操作请求中的至少一个第一数据信息,所述至少一个第一数据信息为调用应用编程接口的信息;
    所述元数据解析模块用于,根据所述至少一个第一数据信息,从所述元数据描述模块的元数据文件中获取与所述至少一个第一数据信息对应的至少一个第二数据信息;
    所述命令解析模块还用于,根据所述至少一个第一数据信息与所述至少一个第二数 据信息确定调用的应用编程接口;
    所述生成请求模块,用于根据所述至少一个第一数据信息和所述至少一个第二数据信息生成请求消息;
    所述公共连网模块,用于通过所述应用编程接口向远程服务器发送所述请求消息,以用于所述远程服务器根据所述请求消息返回结果信息。
  15. 根据权利要求14所述的系统,其特征在于,所述命令解析模块具体用于,将所述至少一个第一数据信息中的至少一个数据信息与所述至少一个第二数据信息中相对应的至少一个数据信息进行逐一匹配,当所述至少一个第一数据信息与相对应的所示至少一个第二数据信息分别匹配时,确定调用的应用编程接口。
  16. 根据权利要求14或15所述的系统,其特征在于,所述至少一个第一数据信息和所述至少一个第二数据信息分别包括服务名称、应用编程接口名称和应用编程接口参数中的一个或多个信息。
  17. 根据权利要求14所述的系统,其特征在于,所述至少一个第二数据信息还包括应用编程接口风格和签名方式。
  18. 根据权利要求17所述的系统,其特征在于,所述系统还包括签名模块,所述生成请求模块具体用于,
    根据所述至少一个第一数据信息和所述应用编程接口风格、所述签名方式调用所述签名模块计算签名;
    根据所述签名、所述至少一个第一数据信息和所述至少一个第二数据信息生成所述请求消息。
  19. 根据权利要求18所述的系统,其特征在于,所述生成请求模块具体用于,
    根据所述应用编程接口风格确定生成所述请求消息的类型;
    根据所述请求消息的类型组织所述至少一个第一数据信息中的应用编程接口参数的顺序,将所述第一数据信息生成唯一的字符串;
    根据所述签名方式和所述唯一的字符串计算签名。
  20. 根据权利要求14所述的系统,其特征在于,所述系统还包括交互模块,用于接收用户输入的所述调用操作请求。
  21. 根据权利要求14所述的系统,所述元数据描述模块用于存储至少一个所述元数据文件。
  22. 根据权利要求14-21任一项权利要求所述的系统,其特征在于,
    所述命令解析模块还用于,解析用户输入的元数据文件更新请求;
    所述公共连网模块还用于,向所述远程服务器发送所述元数据文件更新请求,以用于所述远程服务器根据所述元数据文件更新请求返回第一版本信息,所述第一版本信息为所述远程服务器中元数据文件的版本信息;
    所述命令解析模块还用于,根据所述第一版本信息更新元数据文件。
  23. 根据权利要求22所述的系统,其特征在于,所述命令解析模块还用于,根据所述元数据文件更新请求获取第二版本信息,所述第二版本信息为当前元数据文件的版本信息。
  24. 根据权利要求22所述的系统,其特征在于,所述命令解析模块还用于,确定所述第二版本信息是否为第一版本信息。
  25. 根据权利要求24所述的系统,其特征在于,当确定所述第二版本信息与所述第一版本信息不同时,所述命令解析模块还用于更新所述第二版本信息对应的元数据文件。
  26. 根据权利要求25所述的系统,其特征在于,所述命令解析模块具体用于,
    通过所述公用连网模块从所述远程服务器下载所述第一版本信息相对应的元数据文件;
    将所述第一版本信息对应的元数据文件覆盖所述元数据描述模块中的所述第二版本信息对应的元数据文件。
  27. 根据权利要求22-25任一项所述的系统,其特征在于,所述交互模块还用于接收用户输入的元数据文件更新请求。
PCT/CN2016/108979 2015-12-18 2016-12-08 调用应用编程接口的方法和系统 Ceased WO2017101727A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510956283.1 2015-12-18
CN201510956283.1A CN106897153B (zh) 2015-12-18 2015-12-18 调用应用编程接口的方法和系统

Publications (1)

Publication Number Publication Date
WO2017101727A1 true WO2017101727A1 (zh) 2017-06-22

Family

ID=59055819

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/108979 Ceased WO2017101727A1 (zh) 2015-12-18 2016-12-08 调用应用编程接口的方法和系统

Country Status (2)

Country Link
CN (1) CN106897153B (zh)
WO (1) WO2017101727A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110855745A (zh) * 2019-10-10 2020-02-28 上海瀚之友信息技术服务有限公司 一种通讯软件的程序的接入方法
CN111143094A (zh) * 2020-01-02 2020-05-12 上海卓易科技股份有限公司 一种信息流聚合系统及其控制方法
CN114051058A (zh) * 2021-09-27 2022-02-15 北京旷视科技有限公司 接口调用方法、平台、电子设备及计算机存储介质
CN115695555A (zh) * 2022-09-06 2023-02-03 恒生电子股份有限公司 接口调用方法、系统、处理设备及存储介质
CN116301736A (zh) * 2022-09-07 2023-06-23 优刻得科技股份有限公司 数据处理方法、装置、介质及电子设备

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190641B (zh) * 2020-01-23 2021-08-17 复旦大学 基于API分析的Java第三方库版本统一推荐方法
CN111400016B (zh) * 2020-03-25 2023-05-16 新华三信息安全技术有限公司 一种调用应用程序接口函数的方法和设备
CN112860225A (zh) * 2021-01-15 2021-05-28 哈尔滨鸿德亦泰数码科技有限责任公司 一种可扩展性优越的智慧灌区e平台及其二次开发结构构建方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100057784A1 (en) * 2008-08-28 2010-03-04 Microsoft Corporation Dynamic Metadata
CN102739631A (zh) * 2011-09-23 2012-10-17 新奥特(北京)视频技术有限公司 一种api接口支持多协议格式文件获取的方法及装置
CN102866910A (zh) * 2011-08-31 2013-01-09 微软公司 用元数据描述操作系统的本机应用编程接口
CN104158856A (zh) * 2014-07-23 2014-11-19 武汉理工大学 无需预先构建安全会话的本地api调用方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101562621B (zh) * 2009-05-25 2013-05-22 阿里巴巴集团控股有限公司 一种用户授权的方法、系统和装置
CN102281311B (zh) * 2010-06-10 2014-06-04 阿里巴巴集团控股有限公司 一种基于开放应用编程接口实现网络业务的方法、系统及装置
CN104077179B (zh) * 2014-06-16 2017-06-06 武汉理工大学 一种面向Web浏览器的本地API调用方法
CN110049012B (zh) * 2014-06-23 2022-01-18 华为技术有限公司 一种路由设备的操作方法、路由设备和终端设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100057784A1 (en) * 2008-08-28 2010-03-04 Microsoft Corporation Dynamic Metadata
CN102866910A (zh) * 2011-08-31 2013-01-09 微软公司 用元数据描述操作系统的本机应用编程接口
CN102739631A (zh) * 2011-09-23 2012-10-17 新奥特(北京)视频技术有限公司 一种api接口支持多协议格式文件获取的方法及装置
CN104158856A (zh) * 2014-07-23 2014-11-19 武汉理工大学 无需预先构建安全会话的本地api调用方法

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110855745A (zh) * 2019-10-10 2020-02-28 上海瀚之友信息技术服务有限公司 一种通讯软件的程序的接入方法
CN111143094A (zh) * 2020-01-02 2020-05-12 上海卓易科技股份有限公司 一种信息流聚合系统及其控制方法
CN111143094B (zh) * 2020-01-02 2023-05-16 上海卓易科技股份有限公司 一种信息流聚合系统及其控制方法
CN114051058A (zh) * 2021-09-27 2022-02-15 北京旷视科技有限公司 接口调用方法、平台、电子设备及计算机存储介质
CN114051058B (zh) * 2021-09-27 2024-03-26 北京旷视科技有限公司 接口调用方法、平台、电子设备及计算机存储介质
CN115695555A (zh) * 2022-09-06 2023-02-03 恒生电子股份有限公司 接口调用方法、系统、处理设备及存储介质
CN115695555B (zh) * 2022-09-06 2023-09-12 恒生电子股份有限公司 接口调用方法、系统、处理设备及存储介质
CN116301736A (zh) * 2022-09-07 2023-06-23 优刻得科技股份有限公司 数据处理方法、装置、介质及电子设备

Also Published As

Publication number Publication date
CN106897153A (zh) 2017-06-27
CN106897153B (zh) 2021-07-30

Similar Documents

Publication Publication Date Title
WO2017101727A1 (zh) 调用应用编程接口的方法和系统
CN111033468B (zh) 实施不同类型的区块链合约的系统和方法
CN110428216B (zh) 业务流程管控方法、装置、计算机设备和存储介质
KR102243793B1 (ko) 코드 가상화 및 원격 프로세스 호출 생성을 위한 방법 및 장치
CN105389191B (zh) 一种基于局域网的软件升级方法、装置和系统
CN108228810B (zh) 表单联动配置方法和系统以及表单更新方法和系统
CN111897520A (zh) 前端项目框架的构建方法、装置、计算机设备及存储介质
CN108170740A (zh) 数据迁移方法、系统和计算机可读存储介质
CN101656623B (zh) 软件安装的方法、服务器及系统
US9892021B2 (en) Injection of code modifications in a two session debug scripting environment
US20150378714A1 (en) Providing Context-Specific Software Updates to Client Applications
CN112612452B (zh) 一种api平台实现方法、装置、设备及存储介质
CN111580926A (zh) 模型发布方法、模型部署方法、装置、设备及存储介质
US6804773B1 (en) System and method for transferring information over a network
CN113407194B (zh) 一种部署软件的方法和装置
WO2018210096A1 (zh) 一种基于规则引擎的规则配置方法、终端、设备以及存储介质
CN108427642A (zh) 一种界面中控件测试的方法和装置
WO2022099913A1 (zh) 界面配置方法、装置、设备及介质
CN104009994A (zh) 实现服务端与客户端通讯的方法和装置
CN114675820A (zh) 服务编排数据的处理方法、装置、电子设备和存储介质
CN113703781B (zh) 存储系统接口生成方法、装置、电子设备及可读存储介质
US20140033167A1 (en) Method and system for generating a manifestation of a model in actionscript
KR101437943B1 (ko) 스마트 플랫폼 장치, 시스템 및 제어 방법
CN109739655A (zh) 一种gRPC请求的参数设置方法及装置
CN107239265B (zh) Java函数与C函数的绑定方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16874784

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16874784

Country of ref document: EP

Kind code of ref document: A1