Search

CN-122027448-A - Self-adaptive adaptation method, device, equipment and medium for third party service

CN122027448ACN 122027448 ACN122027448 ACN 122027448ACN-122027448-A

Abstract

The application relates to a self-adaptive adaptation method, device, equipment and medium of a third party service, wherein the method comprises the steps of analyzing an API document in the access request to obtain interface characteristic data under the condition that the access request sent by a target service of the third party is received, generating an adaptation rule according to the interface characteristic data, initiating a simulation call according to the adaptation rule to verify the validity of the adaptation rule, accessing the target service under the condition that the adaptation rule is verified, monitoring the real-time running state of the target service after the access, and automatically switching the call request processed by the target service to a standby service when the real-time running state is abnormal. The problem of third party service access APP inefficiency is solved.

Inventors

  • NIE YAO
  • YANG FAN

Assignees

  • 重庆蓝电汽车科技有限公司

Dates

Publication Date
20260512
Application Date
20251231

Claims (10)

  1. 1. A method for adaptive adaptation of a third party service, comprising: Under the condition that an access request sent by a target service of a third party is received, analyzing an API document in the access request to obtain interface characteristic data; Generating an adaptation rule according to the interface characteristic data, and initiating a simulation call according to the adaptation rule so as to verify the validity of the adaptation rule; Accessing the target service under the condition that the adaptation rule passes the verification; And monitoring the real-time running state of the target service after being accessed, and automatically switching the calling request which is being processed by the target service to the standby service when the real-time running state is an abnormal state.
  2. 2. The method of claim 1, wherein parsing the API document in the access request to obtain interface feature data comprises: Extracting the API document from the access request; carrying out format recognition on the API document, and converting each format into an intermediate description structure; extracting basic elements of an interface from the intermediate description structure, and carrying out structural storage on the basic elements to obtain an interface data table; And carrying out semantic analysis on the interface data table to obtain the interface characteristic data, wherein the interface characteristic data comprises a protocol type, a request parameter, a return field and a constraint condition of an interface.
  3. 3. The method of claim 2, wherein prior to generating adaptation rules from the interface feature data, the method further comprises registering the target service in the following manner: Extracting service information from the access request, and storing the service information into a service information base; Generating a calling key for the target service, and authenticating with the target service through the calling key; after the authentication is passed, the service information is bound with the interface characteristic data to complete the registration of the target service.
  4. 4. The method of claim 2, wherein the generating an adaptation rule from the interface feature data comprises: Performing semantic matching on each field in the interface characteristic data and a standard field to generate a field mapping relation, wherein the standard field is a field used in a system; Acquiring the protocol type in the interface characteristic data, and converting the heterogeneous protocol of the target service into a standard protocol according to the protocol type, wherein the standard protocol is a unified protocol used by a system; And carrying out structural storage on the field mapping relation and the standard protocol to obtain the adaptation rule.
  5. 5. The method of claim 4, wherein the initiating a simulation call according to the adaptation rule to verify the validity of the adaptation rule comprises: Sending test parameters to the target service; receiving response data returned by the target service, and attempting to map the response data to the standard field according to the field mapping relation; And under the condition that the response data mapping is successful, judging that the adaptation rule passes the verification.
  6. 6. The method of claim 1, wherein monitoring the real-time operational status after the target service access comprises: collecting interface call data of the target service, wherein the interface call data comprises interface response time and call success rate; Calculating the health degree of the target service according to the interface call data; the real-time running state of the target service is determined to be an abnormal state when the health degree of the target service is less than a target threshold value, and is determined to be a normal state when the health degree of the target service is greater than or equal to the target threshold value.
  7. 7. The method of claim 1, wherein after generating the adaptation rule, the method further comprises optimizing the adaptation rule in the following manner: Collecting log data of the adaptation rule, wherein the log data comprises a correction record of the adaptation rule in a calling process; obtaining an initial model, wherein model parameters of the initial model comprise a reward function; Training the initial model by using the log data, and updating an action value table according to the reward function when each training is completed, wherein the action value table comprises expected accumulated rewards after each action is executed in different states; And determining a new adaptation rule according to the updated action value table so as to complete the optimization of the adaptation rule.
  8. 8. An adaptive adaptation device for a third party service, comprising: The analysis module is used for analyzing the API document in the access request to obtain interface characteristic data under the condition that the access request sent by the target service of the third party is received; the generation module is used for generating an adaptation rule according to the interface characteristic data, and initiating a simulation call according to the adaptation rule so as to verify the validity of the adaptation rule; The access module is used for accessing the target service under the condition that the adaptation rule check passes; And the switching module is used for monitoring the real-time running state of the target service after being accessed, and automatically switching the calling request processed by the target service to the standby service when the real-time running state is an abnormal state.
  9. 9. An electronic device comprising a memory, a processor, a communication interface and a communication bus, said memory storing a computer program executable on said processor, said memory, said processor communicating with said communication interface via said communication bus, characterized in that said processor, when executing said computer program, implements the steps of the method according to any of the preceding claims 1 to 7.
  10. 10. A computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the method of any one of claims 1 to 7.

Description

Self-adaptive adaptation method, device, equipment and medium for third party service Technical Field The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for adaptive adaptation of a third party service. Background Along with the development of the integration of the mobile internet and the internet of things, the third party services to be integrated of the APP (Mobile Application ) platform are increasing, and the API (Application Programming Interface ) protocols, data formats and interface field definitions of different third party services have significant differences. In the related technology, the third party service docking mainly relies on manual development of a dedicated adaptation module, so that the access efficiency is low, and the user experience is affected. Aiming at the problem that the efficiency of third party service access APP is low due to the fact that an adaptation rule is formulated manually, no effective solution is proposed at present. Disclosure of Invention The application provides a self-adaptive adaptation method, device, equipment and medium for a third party service, which are used for solving the technical problem of low efficiency of accessing the third party service into an APP. According to one aspect of the embodiment of the application, the application provides a self-adaptive adaptation method of a third party service, which comprises the steps of analyzing an API document in an access request to obtain interface characteristic data under the condition that the access request sent by a target service of the third party is received, generating an adaptation rule according to the interface characteristic data, initiating a simulation call according to the adaptation rule to verify the validity of the adaptation rule, accessing the target service under the condition that the adaptation rule is verified, monitoring the real-time running state of the target service after the access, and automatically switching the call request which is being processed by the target service to a standby service when the real-time running state is abnormal. The method comprises the steps of analyzing an API document in an access request to obtain interface characteristic data, wherein the interface characteristic data comprises an API document extracted from the access request, format identification of the API document, conversion of each format into an intermediate description structure, extraction of basic elements of an interface from the intermediate description structure, structural storage of the basic elements to obtain an interface data table, and semantic analysis of the interface data table to obtain the interface characteristic data, wherein the interface characteristic data comprises protocol types, request parameters, return fields and constraint conditions of the interface. Optionally, before generating the adaptation rule according to the interface characteristic data, the method further comprises registering the target service in a manner of extracting service information from the access request and storing the service information in a service information base, generating a call key for the target service and authenticating the call key with the target service, and binding the service information with the interface characteristic data after the authentication is passed so as to finish registering the target service. Optionally, generating the adaptation rule according to the interface feature data comprises the steps of performing semantic matching on each field in the interface feature data and a standard field to generate a field mapping relation, wherein the standard field is a field used in a system, acquiring a protocol type in the interface feature data, converting a heterogeneous protocol of a target service into a standard protocol according to the protocol type, wherein the standard protocol is a unified protocol used by the system, and performing structural storage on the field mapping relation and the standard protocol to obtain the adaptation rule. Optionally, a simulation call is initiated according to the adaptation rule to verify the validity of the adaptation rule, and the simulation call comprises the steps of sending test parameters to the target service, receiving response data returned by the target service, attempting to map the response data to a standard field according to a field mapping relation, and judging that the adaptation rule passes the verification under the condition that the response data is successfully mapped. The method comprises the steps of monitoring a real-time running state of a target service after access, wherein the interface calling data comprise interface response time and calling success rate, calculating the health degree of the target service according to the interface calling data, judging the real-time running state of the target servic