Interface calling method and device, equipment, storage medium and product
By dynamically selecting asynchronous or synchronous processing mechanisms and generating processing identifiers during the interface call process, the problem of long interface call response time is solved, efficiency and flexibility are improved, and reasonable resource allocation and security are achieved.
Patent Information
- Application Number
- CN202510823103.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-26
AI Technical Summary
In the process of interface calls, the existing technology has a long response time, especially when the call volume demand is large or interaction with external services is required, resulting in low efficiency, lack of flexibility and waste of resources.
After obtaining the interface call request, the asynchronous or synchronous processing mechanism is determined, and an asynchronous processing identifier is generated, allowing users to query the processing results, optimize the interface call process, and adapt to the needs of different scenarios.
It improves the efficiency and flexibility of interface calls, realizes the rational allocation of resources, avoids resource waste, and enhances security and reliability.
Smart Images

Figure CN120704770A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to an interface calling method, device, equipment, storage medium and product. Background Art
[0002] During the production and R&D process, interfaces serve as a bridge connecting different modules, services, and systems, greatly improving development efficiency, system scalability, and maintainability.
[0003] Existing interface call and processing technologies can result in long response times for high-volume interface call tasks. This is especially true in scenarios where the interface relies on multiple resources or interacts with external services. The synchronous execution of interfaces can lead to long wait times. However, in certain scenarios, interface calls can respond quickly, eliminating the need for long wait times.
[0004] Therefore, how to dynamically call interfaces in specific business scenarios to improve interface calling efficiency and flexibility has become an urgent problem to be solved. Summary of the Invention
[0005] The present invention provides an interface calling method, apparatus, device, storage medium and product to realize dynamic calling of interfaces in different interface calling scenarios, thereby improving interface calling efficiency and interface calling flexibility.
[0006] According to one aspect of the present invention, there is provided an interface calling method, the method comprising:
[0007] Obtain the interface call request sent by the target user;
[0008] Determining an interface processing mechanism according to the interface call request;
[0009] If the interface processing mechanism is an asynchronous interface processing mechanism, feedback confirmation information to the target user, and at the same time process the interface call request based on the pre-established asynchronous processing process and generate an asynchronous processing identifier;
[0010] The asynchronous processing identifier is fed back to the target user, so that the target user can query the request processing result of the asynchronous processing process on the interface call request based on the asynchronous processing identifier.
[0011] According to another aspect of the present invention, there is provided an interface calling device, the device comprising:
[0012] The call request acquisition module is used to obtain the interface call request sent by the target user;
[0013] A processing mechanism determination module, configured to determine an interface processing mechanism according to the interface call request;
[0014] a processing identifier generating module, configured to feed back confirmation information to the target user if the interface processing mechanism is an asynchronous interface processing mechanism, and simultaneously process the interface call request based on a pre-established asynchronous processing process and generate an asynchronous processing identifier;
[0015] The asynchronous processing request module is used to feed back the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process on the interface call request based on the asynchronous processing identifier.
[0016] According to another aspect of the present invention, an electronic device is provided, comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the interface calling method described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface calling method described in any embodiment of the present invention when executed.
[0021] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the interface calling method according to any embodiment of the present invention is implemented.
[0022] The technical solution of the embodiment of the present invention obtains the interface call request sent by the target user, and determines the interface processing mechanism according to the interface call request; if the interface processing mechanism is an asynchronous interface processing mechanism, the confirmation information is fed back to the target user, and the interface call request is processed based on the pre-established asynchronous processing process, and an asynchronous processing identifier is generated; the asynchronous processing identifier is fed back to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier. The above technical solution determines the interface processing mechanism for the interface call request according to the request characteristics after receiving the interface call request, thereby realizing dynamic interface calls in different interface call scenarios, such as scenarios with a large number of interface requests or a large number of interface responses, improving the interface call efficiency and interface call flexibility, realizing the rational use and allocation of interface call resources, and avoiding the waste of interface call resources.
[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 This is a flowchart of an interface calling method provided according to the first embodiment of the present invention;
[0026] Figure 2 This is a flowchart of an interface calling method provided according to the second embodiment of the present invention;
[0027] Figure 3 This is a flowchart of an interface calling method provided according to the third embodiment of the present invention;
[0028] Figure 4 This is a structural diagram of an interface calling device provided according to a fourth embodiment of the present invention;
[0029] Figure 5 The present invention is a schematic diagram of an electronic device that implements the interface calling method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Example 1
[0033] Figure 1 This is a flowchart of an interface calling method provided in the first embodiment of the present invention. This embodiment is applicable to the case of dynamic interface calling of interface calling requests in different interface calling scenarios. The method can be executed by an interface calling device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0034] S110: Obtain an interface call request sent by a target user.
[0035] S120: Determine an interface processing mechanism according to the interface call request.
[0036] S130: If the interface processing mechanism is an asynchronous interface processing mechanism, feedback confirmation information to the target user, and at the same time process the interface call request based on the pre-established asynchronous processing process and generate an asynchronous processing identifier.
[0037] S140: Feedback the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier.
[0038] It should be noted that the execution subject of this embodiment can be a management platform. A large number of interfaces that can be called can be maintained in the management platform. All interfaces that can be called in the current time period can be displayed on the front page of the management platform.
[0039] The target user may be a user with an interface call requirement. The interface call request may be generated by the target user selecting an interface to call based on the front-end interface of the management platform. After the selection is confirmed, the management platform automatically generates an interface call request based on the call interface selected by the target user.
[0040] It should be noted that, in order to further ensure the security of the interface call, the user identity of the target user may be verified after the interface call request is obtained.
[0041] In an optional embodiment, before determining the interface processing mechanism based on the interface call request, it also includes: parsing the interface call request to obtain the user identification information of the target user; performing signature verification on the user identification information; if the result of the signature verification passes, performing validity period verification on the user identification information; if the result of the validity period verification passes, performing permission verification on the user identification information; if the result of the permission verification passes, executing the interface processing mechanism determined according to the interface call request.
[0042] The user identification information can be used to represent the unique identity of the target user; the user identification information can be an access key (Accesskey), which can be obtained by parsing the interface call request.
[0043] Exemplarily, after the server of the management platform receives the interface call request sent by the front end, it parses the interface call request to obtain user identification information, that is, the access key; and queries the corresponding secret access key based on the key identifier (ID, Identity) of the access key. It should be noted that when initiating an interface call request, the client of the management platform will first splice the content of the interface call request, such as the request path, query parameters and header information, to form a standard string to be signed. The client uses its own secret access key to encrypt the string to be signed, and writes the encrypted result into the interface call request and sends it to the server of the management platform. After parsing the interface call request, the server reconstructs the string to be signed and uses the secret access key to regenerate the signature based on the same encryption algorithm; the regenerated signature is compared for consistency with the signature obtained by parsing the interface call request. If they are consistent, it is determined that the signature verification result of the user identification information has passed; if they are inconsistent, it is determined that the signature verification result of the user identification information has failed.
[0044] If the signature verification result passes, the user identification information is then validated for validity. Specifically, temporary credential verification, credential expiration verification, or a regular rotation and expiration mechanism can be used to verify whether the access key has expired. The expiration time of the access key can be specified by the client using a timestamp.
[0045] If the result of the validity period verification passes, the user identification information is subjected to permission verification. Specifically, a role permission data table may be pre-stored in the server side of the management platform. The role permission data table may record the user identification information of users with access rights, thereby preventing users from unauthorized access. Specifically, based on the user identification information, determine whether the user identification of the target user is stored in the role permission data table; if so, determine that the permission verification result of the user identification information passes; if not, determine that the permission verification result of the user identification information fails. If the result of the permission verification passes, subsequent operations may be performed to determine the interface processing mechanism based on the interface call request.
[0046] The above technical solution performs signature verification based on the user identification information of the target user obtained through analysis, and performs validity period verification on the user identification information when the result of the signature verification passes. If the result of the validity period verification passes, the user identification information is subjected to permission verification. If the result of the permission verification passes, the interface processing mechanism is determined according to the interface call request. By performing signature verification, validity period verification and access permission verification, the security of the user calling the interface is further improved, effectively preventing the user from unauthorized access, ensuring the security of the called data, preventing user identity theft, abuse or malicious attacks, and improving the reliability of the interface calling operation.
[0047] It should be noted that the user identification information collected or parsed above is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0048] The interface processing mechanism may be a method for processing an interface call request, and may specifically include an asynchronous interface processing mechanism and a synchronous interface processing mechanism.
[0049] It is understandable that when the amount of data in the called interface response is large, the call data may not be returned in a timely or fast enough, resulting in low interface response speed and response efficiency. However, when the amount of data in the called interface response is small, the interface can respond quickly and provide timely feedback. Therefore, for scenarios with large amounts of interface response data, an asynchronous interface processing mechanism can be used to process interface call requests; and for scenarios with small amounts of interface response data, a synchronous interface processing mechanism can be used to process interface call requests.
[0050] In addition, when the number of interface call requests under the same interface call timeline is large, an asynchronous interface processing mechanism can be used; when the number of interface call requests under the same interface call timeline is small, a synchronous interface processing mechanism can be used.
[0051] Specifically, the interface processing mechanism is determined based on the number of interface call requests and the amount of data returned in the request responses. When the number of interface call requests is large and / or the amount of data returned in the request responses is large, the asynchronous interface processing mechanism is adopted; when the number of interface call requests is small and / or the amount of data returned in the request responses is small, the synchronous interface processing mechanism is adopted.
[0052] If the interface processing mechanism is an asynchronous interface processing mechanism, the called interface will immediately feedback confirmation information to the target user after receiving the interface call request. At the same time, the asynchronous task processing program is started, and the interface call request is asynchronously processed based on the pre-built asynchronous processing process or thread, and an asynchronous processing identifier for the asynchronous processing task is generated. The asynchronous processing identifier is fed back to the target user so that the target user can query the request processing result of the asynchronous processing process for the interface call request in the form of callback or message queue based on the asynchronous processing identifier. Among them, the asynchronous processing identifier is used to characterize the task uniqueness of the asynchronous processing task.
[0053] If the interface processing mechanism is a synchronous interface processing medium, the corresponding interface is directly called to process the interface call request, and after the interface processing is completed, the request processing result or the request response result is fed back to the target user.
[0054] The technical solution of the embodiment of the present invention obtains the interface call request sent by the target user, and determines the interface processing mechanism according to the interface call request; if the interface processing mechanism is an asynchronous interface processing mechanism, the confirmation information is fed back to the target user, and the interface call request is processed based on the pre-established asynchronous processing process, and an asynchronous processing identifier is generated; the asynchronous processing identifier is fed back to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier. The above technical solution determines the interface processing mechanism for the interface call request according to the request characteristics after receiving the interface call request, thereby realizing dynamic interface calls in different interface call scenarios, such as scenarios with a large number of interface requests or a large number of interface responses, improving the interface call efficiency and interface call flexibility, realizing the rational use and allocation of interface call resources, and avoiding the waste of interface call resources.
[0055] Furthermore, it should be noted that for large-scale automated deployment clusters in production, there is a high demand for host management. When a single cluster needs to manage multiple hosts, calling multiple interfaces to achieve management will consume a lot of manpower due to the high degree of parameter overlap, and may also cause high concurrency problems.
[0056] Therefore, in order to further improve the efficiency and flexibility of interface calls and facilitate the batch processing of similar or identical interface call requests by the interface provider, this embodiment also provides a method for processing interface call requests in specific scenarios.
[0057] In an optional embodiment, after obtaining the interface call request sent by the target user, if the target user sends multiple interface call requests and each interface call request is a host management request, then each host management request is parsed to obtain the necessary request parameters and other request parameters of each host management request; based on the necessary request parameters and other request parameters, a target interface call request is generated, and the interface processing mechanism of the target interface call request is determined to be an asynchronous processing mechanism.
[0058] The host management request can be a request to manage, monitor, deploy, or control virtual machines, containers, or other computing resources in an automated deployment cluster. A host is a physical server that can host multiple virtual machines, containers, and other resources.
[0059] It should be noted that when managing multiple hosts in the same cluster, the required parameters in the interface call request can include the host's IP (Internet Protocol) address, host name, and unique label assigned to the host. These parameters will vary for different host management requests. Other parameters in the interface call request, such as the interface address, cluster name, and management policy, remain unchanged.
[0060] When constructing a target interface call request, the required parameters for each request can be written to the request body. This can be expressed as a JSON object. The body contains a JSON (JavaScript Object Notation) object, each representing the required parameters for a host. The remaining parameters for each host's request remain unchanged and can be specified in the URL (Uniform Resource Locator) or at the top level of the body.
[0061] Since cluster hosts are managed in batches, the interface processing mechanism corresponding to the target interface call request can be directly determined as an asynchronous processing mechanism.
[0062] The above technical solution parses the request of each host management request when it is determined that the number of interface call requests is multiple and each interface call request is a host management request, obtains the necessary request parameters and other request parameters of each host management request, generates a target interface call request based on the necessary request parameters and other request parameters, and determines the interface processing mechanism of the target interface call request as an asynchronous processing mechanism, thereby realizing batch processing of requests in special scenarios of host management, improving the interface call efficiency by request merging, solving the problem of high human resources consumption due to high parameter overlap in multiple interface calls, and solving the high concurrency problem that may be caused by a large number of interface calls. It can flexibly adapt to various scenarios and further improve the flexibility of interface calls.
[0063] To further improve the security and flexibility of interface calls, an environment variable control mechanism can also be used to dynamically configure the execution parameters of the interface according to different environments. In an optional embodiment, the interface configuration information and environment configuration information of at least one management interface are pre-stored in a local database; accordingly, after obtaining the interface call request sent by the target user, the environment configuration information of the interface called by the interface call request is determined, and the environment configuration information of the called interface is compared with the environment configuration information stored in the local database. If the comparison is consistent, it is determined whether the interface call request has interface configuration information; if so, the interface configuration information associated with the interface call request is obtained from the local database, and the interface call request is updated according to the interface configuration information.
[0064] The management interface may be a call interface maintained by the management platform. The interface configuration information may be configuration information required for the interface call, and the interface configuration information stored in the database may be configuration information with a certain degree of privacy, such as the host user name and password in the host management request.
[0065] If this interface configuration information is written directly into the interface call request during the interface call, there is a risk of information leakage during the interface call process, resulting in information loss or malicious tampering. Therefore, interface configuration information with a certain degree of privacy or privacy-related security protection is pre-stored in the management platform's database. When the management platform receives an interface call request, the interface configuration information involved in the request is rewritten into the request to ensure the security protection of private information.
[0066] The environment configuration information may be the environments allowed for interface calls. For example, the interface used for a certain interface call request is only allowed to be called in environment A, while the interface used for another interface call request is only allowed to be called in environment B. The management platform maintains environment configuration information for each management interface that is allowed to be called.
[0067] Specifically, after receiving the interface call request, the first environment configuration information corresponding to the interface called by the interface call request is determined, and the first environment configuration information of the called interface is compared with the second environment configuration information stored in the local database. If the comparison is consistent, it is determined that the interface call request can be called in the corresponding environment; if the comparison is inconsistent, it is determined that the interface call request cannot be called in the corresponding environment.
[0068] If the comparison is consistent, it is determined whether the interface call request contains interface configuration information. For example, the host management request contains interface configuration information, specifically the host username and password. If so, the interface configuration information associated with the interface call request is obtained from the local database, and the interface call request is updated based on the interface configuration information. To ensure the security of the interface configuration information associated with the interface call request stored in the local database, the interface configuration information can be encrypted and stored, and then decrypted when used.
[0069] The above technical solution determines the environment configuration information of the interface called by the interface call request after obtaining the interface call request sent by the target user, and compares the environment configuration information of the called interface with the environment configuration information stored in the local database. If the comparison is consistent, it determines whether the interface configuration information exists in the interface call request; if so, the interface configuration information associated with the interface call request is obtained from the local database, and the interface call request is updated according to the interface configuration information. The calling environment is taken into consideration during the interface call process, and the privacy interface configuration information is written into the interface call request after the interface call during the interface call process, thereby further improving the security and flexibility of the interface call.
[0070] Example 2
[0071] Figure 2 This is a flowchart of an interface calling method provided in the second embodiment of the present invention. This embodiment is optimized and improved on the basis of the above technical solutions.
[0072] Furthermore, the step of "determining the interface processing mechanism based on the interface call request" is refined into "extracting request features of the interface call request to obtain request attribute feature information; inputting the request attribute feature information into the pre-trained interface processing mechanism decision model to obtain the interface processing mechanism output by the model." This improves the method of determining the interface processing mechanism for the interface call request.
[0073] It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the descriptions of other embodiments. Figure 2 As shown, the method includes the following specific steps:
[0074] S210: Obtain an interface call request sent by a target user.
[0075] S220: Extract request features from the interface call request to obtain request attribute feature information.
[0076] S230: Input the request attribute feature information into the pre-trained interface processing mechanism decision model to obtain the interface processing mechanism output by the model.
[0077] S240: If the interface processing mechanism is an asynchronous interface processing mechanism, feedback confirmation information to the target user, and at the same time process the interface call request based on the pre-established asynchronous processing process and generate an asynchronous processing identifier.
[0078] S250: Feedback the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier.
[0079] Among them, the request attribute characteristic information is used to describe the request characteristics of the interface call request, which may specifically include the request task time consumption, request resource dependency, request business importance, request front-end tolerance and request frequency, etc.
[0080] The interface processing medium decision model is used to predict the interface processing mechanism of the interface call request, and can be obtained by pre-training by relevant technical personnel.
[0081] This embodiment also provides a model training method for the interface processing mechanism decision model. In an optional embodiment, the model training method for the interface processing mechanism decision model is as follows:
[0082] Obtain historical attribute feature information of historical interface requests under historical time periods; the historical attribute feature information includes at least one of request task time consumption, request resource dependency, request business importance, request front-end tolerance and request frequency; use the historical attribute feature information of historical interface requests as sample training data, and construct sample label values of the sample training data; the sample label values include an exception handling mechanism and a normal handling mechanism; input the sample training data with the sample label values into a pre-constructed network model to obtain a prediction processing mechanism output by the network model; perform model training on the network model according to the sample label values and the prediction processing mechanism until the preset model training end conditions are met, and obtain an interface processing mechanism decision model.
[0083] For any sample training data, the historical attribute feature information request task time, request resource dependency, request business importance, request front-end tolerance, and request frequency are annotated with sample label values. Sample label values include exception handling mechanisms and normal handling mechanisms. In the process of labeling sample label values, manual labeling can be used, or automated or semi-automated labeling can be used. It is understandable that the sample data set used for training the interface processing mechanism decision model comprehensively considers a variety of request attribute characteristics, thereby improving the accuracy of the model training process.
[0084] The sample training data with sample label values are input into the pre-built network model to obtain the prediction processing mechanism of the network model output under the current iteration time period; according to the sample label value and the prediction processing mechanism, based on the preset loss function, the current loss value under the current iteration time period is determined; according to the current loss value, the network model is trained until the preset model training end condition is met, and the interface processing mechanism decision model is obtained. Among them, the network model can be a machine learning model or a neural network model for making binary classification decisions. For example, the machine learning model can be a logistic regression model, etc.; the neural network model can be a feedforward neural network model, etc. The model training end condition can be pre-set by relevant technical personnel according to actual needs. For example, the model training end condition can be that the current loss value tends to be stable or the current loss value reaches a set loss threshold or the current number of iterations reaches a set number of iterations threshold, etc. This implementation does not limit this.
[0085] During the above-mentioned model training process, the interface processing mechanism decision model is trained by adopting historical attribute information under historical time periods, such as request task duration, request resource dependency, request business importance, request front-end tolerance and request frequency. The richness and diversity of the sample data structure characteristics improve the model training accuracy of the interface processing mechanism decision model, thereby making the interface processing mechanism decision model's processing mechanism decision-making ability stronger, thereby improving the model prediction accuracy.
[0086] The technical solution of this embodiment obtains request attribute feature information by extracting request features from interface call requests, and inputs the request attribute feature information into a pre-trained interface processing mechanism decision model to obtain an interface processing mechanism output by the model. In the process of making decisions on the interface processing mechanism, multi-dimensional request attribute feature information is considered, thereby achieving a comprehensive analysis of the interface processing mechanism in combination with multi-dimensional features, and adopting the interface processing mechanism decision model trained based on multi-dimensional request attribute feature information to make mechanism decisions, thereby improving the prediction accuracy of the interface processing mechanism.
[0087] Example 3
[0088] Figure 3 This is a flow chart of an interface calling method provided in the second embodiment of the present invention. This embodiment provides a preferred example based on the above embodiment.
[0089] like Figure 3 As shown, the method includes the following specific steps:
[0090] S301: Obtain an interface call request sent by a target user.
[0091] S302: Parse the interface call request to obtain user identification information of the target user.
[0092] S303: Perform signature verification on the user identification information. If the result of the signature verification passes, perform validity period verification on the user identification information. If the result of the validity period verification passes, perform permission verification on the user identification information.
[0093] S304: If the result of the permission check passes, determine the environment configuration information of the interface called by the interface call request.
[0094] S305: Compare the environment configuration information of the called interface with the environment configuration information stored in the local database. If the comparison is consistent, determine whether the interface call request contains interface configuration information.
[0095] Wherein, interface configuration information and environment configuration information of at least one management interface are pre-stored in the local database.
[0096] S306: If yes, obtain the interface configuration information associated with the interface call request from the local database, and update the interface call request according to the interface configuration information.
[0097] S307: Extract request features from the interface call request to obtain request attribute feature information.
[0098] The request attribute characteristic information includes at least one of request task time consumption, request resource dependency, request business importance, request front-end tolerance and request frequency.
[0099] S308: Input the request attribute feature information into the pre-trained interface processing mechanism decision model to obtain the interface processing mechanism output by the model.
[0100] The model training method of the interface processing mechanism decision model is as follows:
[0101] Obtain historical attribute feature information of historical interface requests under historical time periods; the historical attribute feature information includes at least one of request task time consumption, request resource dependency, request business importance, request front-end tolerance and request frequency; use the historical attribute feature information of historical interface requests as sample training data, and construct sample label values of the sample training data; the sample label values include an exception handling mechanism and a normal handling mechanism; input the sample training data with the sample label values into a pre-constructed network model to obtain a prediction processing mechanism output by the network model; perform model training on the network model according to the sample label values and the prediction processing mechanism until the preset model training end conditions are met, and obtain an interface processing mechanism decision model.
[0102] S309: If the interface processing mechanism is an asynchronous interface processing mechanism, feedback confirmation information to the target user, and at the same time process the interface call request based on the pre-established asynchronous processing process and generate an asynchronous processing identifier.
[0103] S310: Feedback the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier.
[0104] Example 4
[0105] Figure 4 This is a structural diagram of an interface calling device provided in the fourth embodiment of the present invention. The interface calling device provided in the embodiment of the present invention is applicable to the case of dynamic interface calling of interface calling requests in different interface calling scenarios. The interface calling device can be implemented in the form of hardware and / or software, such as Figure 4 As shown, the device includes: a call request acquisition module 401, a processing mechanism determination module 402, a processing identifier generation module 403 and a request asynchronous processing module 404.
[0106] The call request acquisition module 401 is used to acquire the interface call request sent by the target user;
[0107] The processing mechanism determination module 402 is used to determine the interface processing mechanism according to the interface call request;
[0108] The processing identifier generating module 403 is configured to feed back confirmation information to the target user if the interface processing mechanism is an asynchronous interface processing mechanism, and to process the interface call request based on a pre-established asynchronous processing process and generate an asynchronous processing identifier;
[0109] The asynchronous processing request module 404 is configured to feed back the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process on the interface call request based on the asynchronous processing identifier.
[0110] The technical solution of the embodiment of the present invention obtains the interface call request sent by the target user, and determines the interface processing mechanism according to the interface call request; if the interface processing mechanism is an asynchronous interface processing mechanism, the confirmation information is fed back to the target user, and the interface call request is processed based on the pre-established asynchronous processing process, and an asynchronous processing identifier is generated; the asynchronous processing identifier is fed back to the target user, so that the target user can query the request processing result of the asynchronous processing process for the interface call request based on the asynchronous processing identifier. The above technical solution determines the interface processing mechanism for the interface call request according to the request characteristics after receiving the interface call request, thereby realizing dynamic interface calls in different interface call scenarios, such as scenarios with a large number of interface requests or a large number of interface responses, improving the interface call efficiency and interface call flexibility, realizing the rational use and allocation of interface call resources, and avoiding the waste of interface call resources.
[0111] Optionally, the processing mechanism determination module 402 includes:
[0112] an attribute characteristic information determining unit, configured to extract request characteristics from the interface call request to obtain request attribute characteristic information;
[0113] The first processing mechanism determination unit is used to input the request attribute feature information into a pre-trained interface processing mechanism decision model to obtain the interface processing mechanism output by the model.
[0114] Optionally, the model training method of the interface processing mechanism decision model is as follows:
[0115] Obtain historical attribute feature information of historical interface requests within a historical time period; the historical attribute feature information includes at least one of request task duration, request resource dependency, request business importance, request front-end tolerance, and request frequency;
[0116] Using the historical attribute feature information of the historical interface request as sample training data, and constructing a sample label value of the sample training data; the sample label value includes an abnormal processing mechanism and a normal processing mechanism;
[0117] Inputting sample training data with sample label values into a pre-built network model to obtain a prediction processing mechanism for the output of the network model;
[0118] According to the sample label value and the prediction processing mechanism, the network model is trained until a preset model training end condition is met to obtain an interface processing mechanism decision model.
[0119] Optionally, the device further includes:
[0120] a parameter determination module for, after obtaining the interface call request sent by the target user, if the target user sends multiple interface call requests and each of the interface call requests is a host management request, performing request parsing on each of the host management requests to obtain necessary request parameters and other request parameters of each host management request;
[0121] A target call request generating module, configured to generate a target interface call request according to each of the required request parameters and other request parameters;
[0122] Accordingly, the processing mechanism determination module 402 includes:
[0123] The second processing mechanism determining unit is configured to determine that the interface processing mechanism of the target interface call request is an asynchronous processing mechanism.
[0124] Optionally, the device further includes:
[0125] A configuration information storage module, configured to pre-store interface configuration information and environment configuration information of at least one management interface in a local database;
[0126] Accordingly, the device further includes:
[0127] An information comparison module is used to, after obtaining the interface call request sent by the target user, determine the environment configuration information of the interface called by the interface call request, compare the environment configuration information of the called interface with the environment configuration information stored in the local database, and if the comparison is consistent, determine whether the interface configuration information exists in the interface call request;
[0128] The calling request updating module is used to obtain the interface configuration information associated with the interface calling request from the local database if it is determined that the interface calling request has interface configuration information, and update the interface calling request according to the interface configuration information.
[0129] Optionally, the device further includes:
[0130] A request parsing module, configured to parse the interface call request to obtain user identification information of the target user before determining the interface processing mechanism according to the interface call request;
[0131] A signature verification module, used to perform signature verification on the user identification information;
[0132] A validity period verification module, configured to verify the validity period of the user identification information if the signature verification result passes;
[0133] An authority verification module is used to perform an authority verification on the user identification information if the result of the validity period verification passes;
[0134] The interface processing mechanism determination module is used to execute the interface processing mechanism according to the interface call request if the result of the permission check is passed.
[0135] The interface calling device provided in the embodiment of the present invention can execute the interface calling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0136] Example 5
[0137] Figure 5 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0138] like Figure 5As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., which is communicatively connected to the at least one processor 41. The memory stores a computer program that can be executed by the at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 into the random access memory (RAM) 43. Various programs and data required for the operation of the electronic device 40 can also be stored in the RAM 43. The processor 41, ROM 42, and RAM 43 are connected to each other via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0139] Multiple components in the electronic device 40 are connected to the I / O interface 45, including an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a magnetic disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0140] The processor 41 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as the interface call method.
[0141] In some embodiments, the interface calling method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the interface calling method described above can be performed. Alternatively, in other embodiments, the processor 41 can be configured to execute the interface calling method by any other appropriate means (for example, by means of firmware).
[0142] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0143] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0144] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0146] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0147] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0148] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0149] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. An interface calling method, characterized in that: include: Obtain the interface call request sent by the target user; Determining an interface processing mechanism according to the interface call request; If the interface processing mechanism is an asynchronous interface processing mechanism, feedback confirmation information to the target user, and at the same time process the interface call request based on the pre-established asynchronous processing process and generate an asynchronous processing identifier; The asynchronous processing identifier is fed back to the target user, so that the target user can query the request processing result of the asynchronous processing process on the interface call request based on the asynchronous processing identifier.
2. The method according to claim 1, characterized in that The determining of the interface processing mechanism according to the interface call request includes: Extracting request features from the interface call request to obtain request attribute feature information; The request attribute feature information is input into a pre-trained interface processing mechanism decision model to obtain the interface processing mechanism output by the model.
3. The method according to claim 2, characterized in that The model training method of the interface processing mechanism decision model is as follows: Obtain historical attribute feature information of historical interface requests within a historical time period; the historical attribute feature information includes at least one of request task duration, request resource dependency, request business importance, request front-end tolerance, and request frequency; Using the historical attribute feature information of the historical interface request as sample training data, and constructing a sample label value of the sample training data; the sample label value includes an abnormal processing mechanism and a normal processing mechanism; Inputting sample training data with sample label values into a pre-built network model to obtain a prediction processing mechanism for the output of the network model; According to the sample label value and the prediction processing mechanism, the network model is trained until a preset model training end condition is met to obtain an interface processing mechanism decision model.
4. The method according to claim 1, wherein After obtaining the interface call request sent by the target user, the method further includes: If the target user sends multiple interface call requests, and each of the interface call requests is a host management request, then each of the host management requests is parsed to obtain the necessary request parameters and other request parameters of each host management request; Generate a target interface call request based on the required request parameters and other request parameters; Accordingly, determining the interface processing mechanism according to the interface call request includes: Determine that the interface processing mechanism of the target interface call request is an asynchronous processing mechanism.
5. The method according to claim 1, wherein The method further comprises: Pre-storing interface configuration information and environment configuration information of at least one management interface in a local database; Accordingly, after obtaining the interface call request sent by the target user, the method further includes: Determine the environment configuration information of the interface called by the interface call request, compare the environment configuration information of the called interface with the environment configuration information stored in the local database, and if the comparison is consistent, determine whether the interface configuration information exists in the interface call request; If so, the interface configuration information associated with the interface call request is obtained from the local database, and the interface call request is updated according to the interface configuration information.
6. The method according to claim 1, characterized in that Before determining the interface processing mechanism according to the interface call request, the method further includes: Parsing the interface call request to obtain user identification information of the target user; Performing signature verification on the user identification information; If the result of the signature verification is passed, the validity period of the user identification information is verified; If the validity period verification result is passed, the user identification information is subjected to permission verification; If the result of the permission check is passed, the interface processing mechanism is determined according to the interface call request.
7. An interface calling device, characterized in that: include: The call request acquisition module is used to obtain the interface call request sent by the target user; A processing mechanism determination module, configured to determine an interface processing mechanism according to the interface call request; a processing identifier generating module, configured to feed back confirmation information to the target user if the interface processing mechanism is an asynchronous interface processing mechanism, and simultaneously process the interface call request based on a pre-established asynchronous processing process and generate an asynchronous processing identifier; The asynchronous processing request module is used to feed back the asynchronous processing identifier to the target user, so that the target user can query the request processing result of the asynchronous processing process on the interface call request based on the asynchronous processing identifier.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the interface calling method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface calling method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the interface calling method according to any one of claims 1 to 6.
Citation Information
Cited By
Interface calling method and device based on real-time traffic feature perception and electronic equipment
CN121217719A