Interface calling method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610953235.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-10-23
AI Technical Summary
[0002]目前,在应用程序中调用外部多个数据源接口,通常都是硬编码的方式接入各个数据源接口,通常都需要对当前应用程序的开发语言熟悉的人员开来实现,不仅有高昂的学习成本,还有冗长的接入流程,导致接口调用困难
[0014]本申请提供的接口调用方法、装置、电子设备及存储介质,响应于第一应用程序不存在目标功能,接收第一应用程序所在客户端发送的接口调用请求,并基于预配置的接口数据库匹配接口调用请求中的第一接口标识,得到第一接口标识的匹配结果。响应于匹配结果指示第一接口标识存在于接口数据库中,基于第一接口标识,从接口数据库中确定所关联的第二接口信息,并基于第二接口信息对第一接口信息进行过滤,得到过滤后的第三接口信息,从而可以基于第三接口信息和第一接口标识,调用第二应用程序的目标接口。由此,本方案可以实现多接口的调用,并简化接口调用的流程,实现仅需发送接口调用请求即可对不同的接口进行调用,从而可以提高对应用程序的开发效率。通过接口调用请求进行不同接口的调用,无需编写不同的调用代码,显著降低了查询数据来自于不同接口的调用复杂度。
Smart Images

Figure CN122963826A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an interface calling method, apparatus, electronic device and storage medium. Background Technology
[0002] Currently, when calling multiple external data source interfaces in an application, the connection to each data source interface is usually hard-coded. This typically requires personnel familiar with the application's development language to implement, which not only incurs a high learning cost but also involves a lengthy connection process, making interface calls difficult. Summary of the Invention
[0003] The purpose of this application is to at least partially solve one of the technical problems in the related art.
[0004] Therefore, the first objective of this application is to propose an interface calling method to enable multiple interface calls and simplify the interface calling process, so that different interfaces can be called simply by sending an interface call request.
[0005] The second objective of this application is to propose an interface calling device.
[0006] The third objective of this application is to propose an electronic device.
[0007] The fourth objective of this application is to provide a computer-readable storage medium.
[0008] The fifth objective of this application is to provide a computer program product.
[0009] To achieve the above objectives, a first aspect of this application proposes an interface invocation method, comprising: in response to a first application not having a target function, receiving an interface invocation request sent by a client of the first application; wherein the interface invocation request includes at least a first interface identifier and first interface information of a target interface to be invoked, the target interface being an interface of a second application having the target function; matching the first interface identifier against a pre-configured interface database to obtain a matching result for the first interface identifier; in response to the matching result indicating that the first interface identifier exists in the interface database, determining associated second interface information from the interface database based on the first interface identifier; filtering the first interface information based on the second interface information to obtain filtered third interface information; and invoking the target interface of the second application based on the third interface information and the first interface identifier.
[0010] To achieve the above objectives, a second aspect of this application provides an interface invocation apparatus, comprising: a receiving module, configured to receive an interface invocation request sent by a client of the first application in response to the absence of a target function in a first application; wherein the interface invocation request includes at least a first interface identifier and first interface information of a target interface to be invoked, and the target interface is an interface of a second application having the target function; a matching module, configured to match the first interface identifier based on a pre-configured interface database to obtain a matching result for the first interface identifier; a determining module, configured to determine associated second interface information from the interface database based on the first interface identifier in response to the matching result indicating that the first interface identifier exists in the interface database; a filtering module, configured to filter the first interface information based on the second interface information to obtain filtered third interface information; and an invocation module, configured to invoke the target interface of the second application based on the third interface information and the first interface identifier.
[0011] To achieve the above objectives, a third aspect of this application provides an electronic device, including: a processor; and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to enable the processor to execute the interface calling method described in the first aspect of the application.
[0012] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, the computer instructions being used to cause the computer to execute the interface calling method described in the above aspect of the embodiment.
[0013] To achieve the above objectives, a fifth aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the interface calling method described in the above aspect of the embodiment.
[0014] The interface invocation method, apparatus, electronic device, and storage medium provided in this application, in response to the absence of a target function in the first application, receive an interface invocation request sent by the client of the first application, and match the first interface identifier in the interface invocation request against a pre-configured interface database to obtain a matching result for the first interface identifier. In response to the matching result indicating that the first interface identifier exists in the interface database, based on the first interface identifier, determine the associated second interface information from the interface database, and filter the first interface information based on the second interface information to obtain filtered third interface information. Thus, the target interface of the second application can be invoked based on the third interface information and the first interface identifier. Therefore, this solution can realize multi-interface invocation and simplify the interface invocation process, enabling invocation of different interfaces simply by sending an interface invocation request, thereby improving application development efficiency. Invoking different interfaces through interface invocation requests eliminates the need to write different invocation code, significantly reducing the complexity of querying data from different interfaces.
[0015] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0016] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0017] Figure 1 A flowchart illustrating an interface calling method provided in an embodiment of this application; Figure 2 A flowchart illustrating another interface calling method provided in an embodiment of this application; Figure 3 A flowchart illustrating another interface calling method provided in an embodiment of this application; Figure 4 A logical diagram illustrating the interface calls provided in the embodiments of this application; Figure 5 A schematic diagram illustrating the interface call process provided in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of an interface calling device provided in an embodiment of this application. Detailed Implementation
[0018] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0019] The interface invocation method and apparatus of this application are described below with reference to the accompanying drawings.
[0020] Middleware is a type of software that sits between the operating system and applications. It provides a software environment that enables communication and data management between multiple applications or components of applications. The main purpose of middleware is to simplify the development of distributed applications by providing a set of services to shield developers from the complexities of the underlying operating system and network communication, allowing them to focus on implementing business logic.
[0021] Figure 1 This is a flowchart illustrating an interface calling method provided in an embodiment of this application, as shown below. Figure 1 As shown, the interface calling method in this application includes, but is not limited to, the following steps: S101, in response to the fact that the first application does not have the target function, receive the interface call request sent by the client where the first application is located.
[0022] It should be noted that the execution subject of the interface calling method provided in this application embodiment is an electronic device, which can be a terminal device or a server. Optionally, the terminal device can be a mobile electronic device or a non-mobile electronic device. Optionally, the server includes, but is not limited to, a network server, an application server, a distributed system server, or a server combined with blockchain, etc. This application embodiment does not impose specific limitations.
[0023] It should be noted that the interface call method provided in this application embodiment can also be executed by middleware. That is, the middleware can receive interface call requests and use them to call the interface. The middleware can be located between the client and the interface server; from the client's perspective, the middleware is the server; from the interface server's perspective, the middleware acts as the client. Essentially, it is a transparent request forwarding layer.
[0024] In some embodiments, different applications can reuse functionality through interface calls. That is, one application can call specific functions of another application through an interface.
[0025] In some embodiments, if a first application wants to use a target function but does not have the target function, the first application can generate an interface call request and send the interface call request to the middleware through its client.
[0026] The interface call request includes at least the first interface identifier and first interface information of the target interface to be called, whereby the target interface is the interface of a second application with the target function.
[0027] In other words, the first application can determine that the second application has the target function, and thus use the interface of the second application as the target interface, and generate the first interface identifier and first interface information of the target interface to obtain the interface call request.
[0028] In some embodiments, when receiving an API call request from a client, the middleware can also receive API call requests from the server corresponding to the client. In other words, the middleware can interact with the client through the server corresponding to the client.
[0029] In some embodiments, to improve the security of information transmission, a connection can be established between the middleware and the server, thereby transmitting interface call requests based on the connection.
[0030] In some embodiments, a connection request can be received from the server corresponding to the client through the database connection interface protocol, and a connection can be established with the server based on the connection request, so as to receive the interface call request sent by the client based on the established connection.
[0031] The established connection can be a Hypertext Transfer Protocol (HTTP) connection.
[0032] In some embodiments, the API call request can be in the format of Structured Query Language (SQL).
[0033] In some embodiments, the interface call request sent by the client can be in natural language format. After the server corresponding to the client receives the interface call request in natural language format, it can assemble SQL statements to obtain an interface call request in SQL format.
[0034] S102, Match the first interface identifier based on the pre-configured interface database to obtain the matching result of the first interface identifier.
[0035] In some embodiments, after receiving an interface call request, the SQL-formatted interface call request can be parsed first to obtain the first interface identifier and the first identifier information from the request. Optionally, the first interface identifier and the first identifier information can also be encapsulated, such as by encapsulating them into a metadata object, thereby saving resource consumption.
[0036] In some embodiments, the pre-configured interface database may be pre-established based on configuration information sent by the management terminal, wherein the management terminal is a client used by administrators; the configuration information includes interface identifiers and interface information.
[0037] There is a correlation between the interface identifier and the interface information; that is, one interface identifier is associated with one interface information.
[0038] In some embodiments, the interface identifier can be used to distinguish different interfaces, and the interface information is used to call the interface. That is, the interface information may include the method of calling the interface. Optionally, the interface information may also include input parameter information and output parameter information. The input parameter information refers to the data that the client needs to pass to the server when calling the interface; the output parameter information refers to the data returned to the client after the interface is processed, which usually includes the operation result or the requested resource.
[0039] In some embodiments, the pre-configurable interface database may include a second interface identifier. Matching the first interface identifier based on the pre-configured interface database means matching whether the first interface identifier and the second interface identifier are the same to obtain a matching result for the first interface identifier.
[0040] In other words, the matching result can include a successful match for the first interface identifier, indicating that the first interface identifier exists in the interface database; the matching result can also include a failed match for the first interface, indicating that the first interface identifier does not exist in the interface database.
[0041] In some embodiments, if the first interface identifier does not exist in the interface database, a call failure message can be displayed to the client and the interface call can be terminated; otherwise, the subsequent interface call process can proceed.
[0042] S103, in response to the matching result indicating that the first interface identifier exists in the interface database, the associated second interface information is determined from the interface database based on the first interface identifier.
[0043] In some embodiments, the matching result indicates that the first interface identifier exists in the interface database. That is, if the interface database contains a second interface identifier that is the same as the first interface identifier, then the associated second interface information can be determined from the interface database based on the first interface identifier.
[0044] In some embodiments, the interface database stores a second interface identifier and second interface information associated with the second interface identifier.
[0045] When the first interface identifier exists in the interface database, that is, when there is a second interface identifier in the interface database that is the same as the first interface identifier, the association can be queried based on the first interface identifier to determine the second interface information associated with the first interface identifier.
[0046] For example, if the first interface is identified as A, and the interface database includes a second interface identifier identified as A, it means that the first interface identifier exists in the interface database. Therefore, the interface information associated with A can be determined as the second interface information.
[0047] S104, the first interface information is filtered based on the second interface information to obtain the filtered third interface information.
[0048] In some embodiments, the interface parameters included in the first interface information are sent by the client, and their names can also be defined by the client. There may be inconsistencies in the names of different interface parameters defined by different clients. Therefore, the first interface information can be filtered based on the second interface information to standardize the name of each interface parameter so that the interface can be called using explicit interface parameters during the calling process.
[0049] In other words, the names of the interface parameters included in the second interface information can be regarded as reference names, and the custom name corresponding to each reference name can be determined. Thus, after obtaining the first interface information, the reference name of the custom name can be determined according to the correspondence between the reference name and the custom name.
[0050] For example, if the reference name of the name parameter is name, and it may be NM in the first interface information, then the second interface information can be used for filtering to obtain the interface parameter with the name name, which can then be used as the interface parameter in the third interface information.
[0051] In other words, filtering the first interface information based on the second interface information can be achieved by replacing the interface parameter names in the first interface information with the interface parameter names in the second interface information.
[0052] In some embodiments, the first interface information may also include interface parameters that are not needed when calling the target interface. For example, if calling interface A requires interface parameter 1 and interface parameter 2, the first interface information may include interface parameter 1, interface parameter 2, and interface parameter 3. In this case, interface parameter 3 can be filtered out to obtain the third interface information that includes interface parameter 1 and interface parameter 2.
[0053] In other words, filtering the first interface information based on the second interface information can mean deleting irrelevant interface parameters from the first interface information.
[0054] S105, based on the third interface information and the first interface identifier, call the target interface of the second application.
[0055] In some embodiments, a target interface can be determined from multiple interfaces of the second application based on a first interface identifier, and the target interface of the second application can be invoked based on third interface information.
[0056] In some embodiments, the third interface information may include an interface calling method, which can be used to call the target interface of the second application to use the target function of the second application and obtain the calling result.
[0057] In some embodiments, after obtaining the call result, the call result can be fed back to the first application in the client so that the first application can achieve the target function.
[0058] In the interface calling method provided in this application embodiment, in response to the absence of a target function in the first application, an interface calling request sent by the client where the first application resides is received. The method matches the first interface identifier in the interface calling request against a pre-configured interface database to obtain a matching result for the first interface identifier. In response to the matching result indicating that the first interface identifier exists in the interface database, the method determines the associated second interface information from the interface database based on the first interface identifier. The first interface information is then filtered based on the second interface information to obtain filtered third interface information. Therefore, the target interface of the second application can be called based on the third interface information and the first interface identifier. Thus, this solution can realize multi-interface calls and simplify the interface calling process, enabling different interfaces to be called simply by sending an interface calling request, thereby improving application development efficiency. Calling different interfaces through interface calling requests eliminates the need to write different calling code, significantly reducing the complexity of querying data from different interfaces.
[0059] Figure 2 This is a flowchart illustrating another interface calling method provided in an embodiment of this application, as shown below. Figure 2 As shown, the interface calling method in this application includes, but is not limited to, the following steps: S201, in response to the fact that the first application does not have the target function, receive the interface call request sent by the client where the first application is located.
[0060] S202, Match the first interface identifier based on the pre-configured interface database to obtain the matching result of the first interface identifier.
[0061] S203, in response to the matching result indicating that the first interface identifier exists in the interface database, the associated second interface information is determined from the interface database based on the first interface identifier.
[0062] In the embodiments of this application, steps S201-S203 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.
[0063] S204, Determine the interface parameter names included in the second interface information.
[0064] S205, based on the interface parameter name, filter the first interface information to obtain the third interface information.
[0065] In some embodiments, the second interface information consists of different interface parameters, each of which has its corresponding interface parameter name. By determining the interface parameter names included in the second interface information, the interface parameters in the first interface information are filtered based on the interface parameter names.
[0066] In other words, filtering the first interface information filters the interface parameters in the first interface information.
[0067] In some embodiments, the interface parameter name can clearly identify the interface parameters contained in the interface information. By filtering the first interface information based on the interface parameter name, it is possible to filter the interface parameters in the first interface information based on the interface parameter name in the second interface information.
[0068] In some embodiments, filtering the interface parameters in the first interface information may involve filtering the interface parameters in the first interface information that have different names from the interface parameter names in the second interface information. That is, in response to the inconsistency between the interface parameter names in the first interface information and the interface parameter names included in the second interface information, the interface parameter names in the first interface information are replaced with the interface parameter names included in the second interface information.
[0069] In some embodiments, if the interface parameter name in the first interface information is inconsistent with the interface parameter name included in the second interface information, the interface parameter name of each interface parameter in the first interface information can be obtained as a custom name, the interface parameter name in the second interface information can be used as a reference name, and the interface parameter name can be queried according to the relationship between the custom name and the reference name to determine the reference name corresponding to an interface parameter, that is, the interface parameter name in the second interface information, and then the name can be used for replacement to achieve interface parameter filtering.
[0070] In some embodiments, filtering interface parameters in the first interface information can also involve filtering interface parameters that are not present in the first interface information but are present in the second interface information. The presence of an interface parameter in the first interface information can be determined based on the interface parameter names in the first and second interface information, respectively.
[0071] In some embodiments, in response to the fact that the interface parameters in the first interface information do not exist in the second interface information, the interface parameters that do not exist in the second interface information are deleted.
[0072] It should be noted that the interface parameters in the second interface information are not all the interface parameters that must be used in a single interface call, so there is no need to replace all the interface parameters in the first interface information with the interface parameters in the second interface information.
[0073] For example, the second interface information includes interface parameter 1, interface parameter 2, interface parameter 3, interface parameter 4, and interface parameter 5. These interface parameters are the interface parameters that can be used when calling an interface.
[0074] If the first interface information includes interface parameter A, interface parameter 2, and interface parameter C, where interface parameter A and interface parameter 1 are the same interface parameter but have different names, then interface parameter 1 can be used to replace interface parameter A; if interface parameter C is not any of the interface parameters from interface parameter 1 to interface parameter 5, then interface parameter C is deleted, thus filtering the first interface information, and the resulting third interface information is: interface parameter 1 and interface parameter 2.
[0075] S206, based on the third interface information and the first interface identifier, call the target interface of the second application.
[0076] In the embodiments of this application, step S206 can be implemented in any of the ways described in the embodiments of this application. This is not limited here and will not be described in detail.
[0077] In the interface calling method provided in this application embodiment, by determining the interface parameter names included in the second interface information and filtering the first interface information based on the interface parameter names, the third interface information is obtained. This achieves the retention of allowed interface parameter names in the second interface information and the deletion of redundant or unknown interface parameters in the first interface information, thereby increasing the security of interface calls, avoiding call failures caused by interface parameter issues, and improving the efficiency of interface calls when using the third interface information.
[0078] Figure 3 This is a flowchart illustrating another interface calling method provided in an embodiment of this application, as shown below. Figure 3 As shown, the interface calling method in this application includes, but is not limited to, the following steps: S301, in response to the fact that the first application does not have the target function, receives the interface call request sent by the client where the first application is located.
[0079] S302, Match the first interface identifier based on the pre-configured interface database to obtain the matching result of the first interface identifier.
[0080] S303, in response to the matching result indicating that the first interface identifier exists in the interface database, the associated second interface information is determined from the interface database based on the first interface identifier.
[0081] S304, the first interface information is filtered based on the second interface information to obtain the filtered third taste information.
[0082] In the embodiments of this application, steps S301-S304 can be implemented in any of the embodiments of this application, and no limitation is made here, nor will it be described in detail.
[0083] S305, determine the target invocation method for calling the target interface from the third interface information.
[0084] S306, based on the third interface information and the first interface identifier, uses the target invocation method to invoke the target interface of the second application.
[0085] In some embodiments, the third interface information includes at least one of: interface invocation method and input parameter information. The input parameter information refers to the data that the client needs to pass to the server when invoking the interface. This data may be parameters that need to be obtained from the second application when invoking the second application.
[0086] In some embodiments, by determining the interface invocation method from the third interface information as the target invocation method for invoking the target interface, the target interface of the second application can be invoked using the target interface invocation method.
[0087] The target invocation method can be a generic invocation, an HTTP invocation, a remote procedure call (RPC) invocation, etc. There are no specific restrictions on the target invocation method.
[0088] In some embodiments, when calling the target interface, not only the target calling method is needed, but also the input parameter information in the third interface information is needed to send data to the second application, such as the parameter type that needs to be obtained from the target function of the second application.
[0089] For example, if the target function is real-name authentication, but the first application does not have real-name authentication, the first application can call the real-name authentication function of the second application to realize the real-name authentication of the user. In this case, the first application can send the parameters required for real-name authentication to the second application as input parameters and obtain the corresponding output parameters as the call result.
[0090] In other words, the third interface information also includes output parameter information. By determining the input parameter information of the target interface from the third interface information, and based on the input parameter information and the first interface identifier, the target interface of the second application is called using the target calling method to obtain the output parameter information of the target interface as the calling result.
[0091] In some embodiments, the parameters included in the input parameter information can correspond to multiple parameters in the output parameter information. That is, by calling the target interface using one parameter, the values of multiple parameters can be obtained based on that parameter as the call result.
[0092] For example, parameter a corresponds to parameters b and c. If parameter a is included in the input information, when the target interface of the second application is called using parameter a, the second application can obtain the values of parameters b and c based on parameter a and use these values as the call result.
[0093] In some embodiments, there may be multiple first applications, that is, multiple first applications do not have the target function and need to call the second application. In this case, the middleware can receive multiple interface call requests.
[0094] In some embodiments, the results of multiple API call requests can be merged and returned to improve the efficiency of API calls.
[0095] In some embodiments, in response to multiple interface call requests, candidate call results for each target interface are obtained, and the candidate call results can be merged based on the maximum number of rows corresponding to the candidate call results. Here, the maximum number of rows refers to the number of rows of output parameter information.
[0096] Since the output parameter information contains multiple parameters and their values, the same parameter and its corresponding value are on the same line, while multiple parameters correspond to multiple lines.
[0097] For example, if parameter 1 and its value occupy one line, and parameter 2 and its value occupy one line, then the output parameter information has two lines. If there are three output parameter information, with each having two, five, and three lines respectively, then the maximum number of lines is five.
[0098] In some embodiments, a merged call result is obtained by determining the maximum number of rows corresponding to the candidate call results and merging the candidate call results based on the maximum number of rows. Optionally, merging candidate call results may involve merging identical parameters.
[0099] In other words, by determining each line of output parameter information in the result of each candidate call, and the value of each line of output parameter information, the values of the output parameter information are merged in response to the existence of the same output parameter information, until the output parameter information corresponding to the maximum number of lines is merged.
[0100] For example, if parameter information 1 includes: A=1, B=2, and parameter information 2 includes: A=1, B=2, C=3, then the combined parameter information 1 and parameter information 2 will have A=1, and the combined parameter information 1 and parameter information 2 will have B=2.
[0101] In the interface calling method provided in this application embodiment, after determining the third interface information, the target calling method for calling the target interface can be determined from the third interface information. Based on the third interface information and the first interface identifier, the target calling method is used to call the target interface of the second application, thereby simplifying the interface calling process and enabling different interfaces to be called simply by sending an interface calling request, thereby improving the development efficiency of the application.
[0102] Figure 4 This is a logical diagram illustrating the interface calls provided in the embodiments of this application. Figure 4 The process includes two phases. The first phase is the configuration phase of the interface database. The middleware can receive the interface identifier and interface information sent by the administrator through the configuration center to generate the interface database.
[0103] The second stage is the API call stage. A call request can be generated on the client side of the first application and sent to the server corresponding to the first application for SQL statement assembly, resulting in an SQL-formatted API call request. The server then sends a connection request to the middleware via the database connection interface protocol to establish an HTTP connection, allowing the middleware to receive API call requests through the HTTP connection.
[0104] The middleware parses the interface call request using an SQL parser to extract the first interface identifier and first interface information of the target interface. By matching the first interface identifier with the interface database, the matching result of the first interface identifier can be determined. Furthermore, based on the matching result, the second interface information associated with the first interface identifier can be determined from the interface database, so as to call the target interface according to the second interface information.
[0105] Specifically, the first interface information can be filtered using the second interface information to obtain the third interface information, and the target interface can be called using the third interface information. The filtering of the first interface information can be found in the above embodiments, and will not be repeated here.
[0106] If there are two API call requests, and the target calling methods of the two API call requests are different, Figure 4 The text illustrates two different calling methods, Method 1 (RPC call) and Method 2 (HTTP call), for calling the target interface, and two candidate call results can be obtained.
[0107] By performing maximum row merging on the candidate call results, the merged call result is obtained and returned to the server, thus completing the call to the target function of the second application.
[0108] Figure 5 This is a schematic diagram illustrating the interface call process provided in this application embodiment. The management end establishes the interface database, and the client inputs the interface call request and sends it to the middleware end based on the database connection interface protocol. The middleware end can parse the interface call request using an SQL parser, and match the first interface identifier with the interface database using an SQL router to determine the matching result of the first interface identifier. Based on the matching result, it determines the second interface information associated with the first interface identifier from the interface database, and filters the first interface information using the second interface information to obtain third interface information, which is then used to call the target interface. Further, the SQL queryer determines the target call method from the third interface information and calls the target interface using the target call method to obtain the call result. Further, when multiple interface call requests exist, the result synthesizer merges the candidate call results corresponding to the multiple interface call requests to obtain a merged call result.
[0109] Corresponding to the interface calling methods proposed in the above embodiments, an embodiment of this application also proposes an interface calling device. Since the interface calling device proposed in this application corresponds to the interface calling methods proposed in the above embodiments, the implementation methods of the above interface calling methods are also applicable to the interface calling device proposed in this application. It will not be described in detail in the following embodiments.
[0110] Figure 6 This is a schematic diagram of the structure of an interface calling device provided in an embodiment of this application.
[0111] like Figure 6 As shown, the interface calling device 600 includes: The receiving module 601 is configured to receive an interface call request sent by the client where the first application is located in response to the first application not having a target function; wherein, the interface call request includes at least a first interface identifier and first interface information of the target interface to be called, and the target interface is an interface of a second application having the target function; The matching module 602 is used to match the first interface identifier based on a pre-configured interface database to obtain the matching result of the first interface identifier; The determining module 603 is configured to, in response to the matching result indicating that the first interface identifier exists in the interface database, determine the associated second interface information from the interface database based on the first interface identifier; The filtering module 604 is used to filter the first interface information based on the second interface information to obtain the filtered third interface information; The calling module 605 is used to call the target interface of the second application based on the third interface information and the first interface identifier.
[0112] In one possible implementation of this application embodiment, the filtering module 604 is further configured to: determine the interface parameter name included in the second interface information; and filter the first interface information based on the interface parameter name to obtain the third interface information.
[0113] In one possible implementation of this application embodiment, the filtering module 604 is further configured to: in response to the interface parameter name in the first interface information being inconsistent with the interface parameter name included in the second interface information, replace the interface parameter name in the first interface information with the interface parameter name included in the second interface information; or, in response to the parameter in the first interface information not existing in the second interface information, delete the parameter that does not exist in the second interface information.
[0114] In one possible implementation of this application, the third interface information includes at least one of the following: interface calling method and input parameter information.
[0115] In one possible implementation of this application embodiment, the calling module 605 is further configured to: determine the target calling method for calling the target interface from the third interface information; and, based on the third interface information and the first interface identifier, call the target interface of the second application using the target calling method.
[0116] In one possible implementation of this application embodiment, the third interface information further includes output parameter information, and the calling module 605 is further configured to: determine the input parameter information of the target interface from the third interface information; and, based on the input parameter information and the first interface identifier, use the target calling method to call the target interface of the second application to obtain the output parameter information of the target interface as the calling result.
[0117] In one possible implementation of this application embodiment, the calling module 605 is further configured to: in response to multiple interface calling requests, obtain candidate calling results for each target interface; determine the maximum number of rows corresponding to the candidate calling results, and merge the candidate calling results based on the maximum number of rows to obtain a merged calling result.
[0118] In one possible implementation of this application, the calling module 605 is further configured to: determine each line of output parameter information in each candidate calling result, and the value of each line of output parameter information; in response to the existence of the same output parameter information, merge the values of the output parameter information until the output parameter information corresponding to the maximum number of lines is merged.
[0119] In one possible implementation of this application, the receiving module 601 is further configured to: receive a connection request sent by the server corresponding to the client through a database connection interface protocol, and establish a connection with the server based on the connection request; and receive an interface call request sent by the client based on the established connection.
[0120] It should be noted that the foregoing explanation of the interface calling method embodiment also applies to the interface calling device of this embodiment, and will not be repeated here.
[0121] In the interface calling device provided in this application embodiment, in response to the absence of a target function in the first application, an interface calling request sent by the client where the first application resides is received. The device matches the first interface identifier in the interface calling request against a pre-configured interface database to obtain a matching result for the first interface identifier. In response to the matching result indicating that the first interface identifier exists in the interface database, the device determines the associated second interface information from the interface database based on the first interface identifier. The first interface information is then filtered based on the second interface information to obtain filtered third interface information. Therefore, the target interface of the second application can be called based on the third interface information and the first interface identifier. Thus, this solution can realize the calling of multiple interfaces and simplify the interface calling process. It allows different interfaces to be called simply by sending an interface calling request, thereby improving the development efficiency of the application. Calling different interfaces through interface calling requests eliminates the need to write different calling code, significantly reducing the complexity of querying data from different interfaces.
[0122] To implement the above embodiments, this application also proposes an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method provided in the foregoing embodiments.
[0123] To implement the above embodiments, this application also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.
[0124] To implement the above embodiments, this application also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.
[0125] The collection, storage, use, processing, transmission, provision, and application of user personal information involved in this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0126] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.
[0127] This application is intended to provide an implementation scheme for users to selectively prevent the use or access to their personal information data. Specifically, this application is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information is de-identified to protect user privacy.
[0128] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0129] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0130] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0131] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0132] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0133] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0134] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0135] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. An interface invocation method, characterized in that, The method includes: In response to the fact that the first application does not have the target function, an interface call request sent by the client where the first application is located is received; wherein, the interface call request includes at least the first interface identifier and first interface information of the target interface to be called, and the target interface is the interface of the second application that has the target function; The matching result of the first interface identifier is obtained by matching the first interface identifier with the pre-configured interface database. In response to the matching result indicating that the first interface identifier exists in the interface database, the associated second interface information is determined from the interface database based on the first interface identifier; The first interface information is filtered based on the second interface information to obtain the filtered third interface information; Based on the third interface information and the first interface identifier, the target interface of the second application is invoked.
2. The method according to claim 1, characterized in that, The step of filtering the first interface information based on the second interface information to obtain the filtered third interface information includes: Determine the names of the interface parameters included in the second interface information; Based on the interface parameter name, the first interface information is filtered to obtain the third interface information.
3. The method according to claim 2, characterized in that, The filtering of the first interface information based on the interface parameter name includes: In response to a discrepancy between the interface parameter name in the first interface information and the interface parameter name included in the second interface information, the interface parameter name in the first interface information is replaced with the interface parameter name included in the second interface information; or, In response to the fact that the parameter in the first interface information does not exist in the second interface information, the parameter that does not exist in the second interface information is deleted.
4. The method according to claim 1, characterized in that, The third interface information includes at least one of the following: interface call method and input parameter information.
5. The method according to claim 4, characterized in that, The step of invoking the target interface of the second application based on the third interface information and the first interface identifier includes: The target invocation method for calling the target interface is determined from the third interface information; Based on the third interface information and the first interface identifier, the target interface of the second application is invoked using the target invocation method.
6. The method according to claim 5, characterized in that, The third interface information also includes output parameter information. The step of invoking the target interface of the second application using the target invocation method based on the third interface information and the first interface identifier includes: The input parameter information of the target interface is determined from the third interface information; Based on the input parameter information and the first interface identifier, the target interface of the second application is invoked using the target invocation method to obtain the output parameter information of the target interface as the invocation result.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: In response to multiple interface call requests, obtain the candidate call results for each target interface; Determine the maximum number of rows corresponding to the candidate call results, and merge the candidate call results based on the maximum number of rows to obtain the merged call results.
8. The method according to claim 7, characterized in that, The merging of the candidate call results based on the maximum number of rows includes: Determine the output parameter information for each line in each candidate call result, and the value of each output parameter information; In response to the existence of identical output parameter information, the values of the output parameter information are merged until the output parameter information corresponding to the maximum number of rows is merged.
9. The method according to any one of claims 1-6, characterized in that, Receiving the interface call request sent by the client where the first application resides includes: Receive the connection request sent by the server corresponding to the client through the database connection interface protocol, and establish a connection with the server based on the connection request; Based on the established connection, receive the interface call request sent by the client.
10. An interface calling device, characterized in that, The device includes: A receiving module is configured to receive an interface call request sent by the client where the first application is located in response to the first application not having a target function; wherein, the interface call request includes at least a first interface identifier and first interface information of the target interface to be called, and the target interface is an interface of a second application having the target function; The matching module is used to match the first interface identifier based on a pre-configured interface database to obtain the matching result of the first interface identifier; The determining module is configured to, in response to the matching result indicating that the first interface identifier exists in the interface database, determine the associated second interface information from the interface database based on the first interface identifier; The filtering module is used to filter the first interface information based on the second interface information to obtain the filtered third interface information; The calling module is used to call the target interface of the second application based on the third interface information and the first interface identifier.
11. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-9.
13. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-9.