CN112948723A - Interface calling method and device and related equipment - Google Patents

Interface calling method and device and related equipment Download PDF

Info

Publication number
CN112948723A
CN112948723A CN202110219988.0A CN202110219988A CN112948723A CN 112948723 A CN112948723 A CN 112948723A CN 202110219988 A CN202110219988 A CN 202110219988A CN 112948723 A CN112948723 A CN 112948723A
Authority
CN
China
Prior art keywords
interface
target
data
information
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110219988.0A
Other languages
Chinese (zh)
Inventor
周锋恒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202110219988.0A priority Critical patent/CN112948723A/en
Publication of CN112948723A publication Critical patent/CN112948723A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/972Access to data in other repository systems, e.g. legacy data or dynamic Web page generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a data processing technology, and provides an interface calling method, an interface calling device, computer equipment and a storage medium, wherein the interface calling method comprises the following steps: receiving request information output by a target service system; the data conversion processes the request information to obtain structured target request information, wherein the target request information comprises target service, an interface structure and request parameters; determining a target server according to the target service; controlling the target server to call preset interface description information and obtaining interface return data according to the preset interface description information and the request parameters; adjusting the interface return data according to the interface structure to obtain target structure data; and outputting the target structure data to the target business system. This application can improve the efficiency that the interface was called, promotes the rapid development in wisdom city.

Description

Interface calling method and device and related equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to an interface calling method and apparatus, a computer device, and a medium.
Background
With the development of communication technology, the applications of various service systems become more and more extensive, and different service systems perform data interaction with a server system in an interface docking manner. In the interface docking process, data conversion between a business system and a service end system is often involved.
In the process of implementing the present application, the inventor finds that the prior art has at least the following problems: the existing schemes are generally two, one scheme is that a plurality of sets of interfaces are defined to adapt to different service requirements according to different service scenes, and the method causes more and more interfaces defined by a server-side system and is difficult to maintain; the other method is to use the same interface to adapt to different service scenes, the method can cause the data acquired by the service system to be excessively redundant, the service system is required to independently process the acquired data, the complexity of processing the data by the service system is increased, the maintenance cost and the development cost of the service system are higher and higher as time passes, and the interface calling efficiency is greatly reduced.
Therefore, it is necessary to provide an interface calling method, which can reduce the maintenance cost of the service system and improve the development efficiency and the interface calling efficiency of the service system.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an interface calling method, an interface calling apparatus, a computer device, and a medium, which can improve the efficiency of interface calling.
A first aspect of an embodiment of the present application provides an interface calling method, where the interface calling method includes:
receiving request information output by a target service system;
the data conversion processes the request information to obtain structured target request information, wherein the target request information comprises target service, an interface structure and request parameters;
determining a target server according to the target service;
controlling the target server to call preset interface description information and obtaining interface return data according to the preset interface description information and the request parameters;
adjusting the interface return data according to the interface structure to obtain target structure data;
and outputting the target structure data to the target business system.
Further, in the interface invoking method provided in the embodiment of the present application, the data conversion processing the request information to obtain the structured target request information includes:
acquiring a preset parameter description set;
starting double processes, wherein the double processes comprise a first information acquisition process and a second information acquisition process;
calling the first information acquisition process to acquire a first information item in the request information;
calling the second information acquisition process to acquire a second information item in the description information of the preset interface;
and structurally combining the first information item and the second information item to obtain target request information.
Further, in the interface invoking method provided in the embodiment of the present application, the obtaining a preset parameter description set includes:
determining a target business system;
acquiring an interface calling attribute set of the target service system;
calculating the contribution rate of each interface calling attribute in the interface calling attribute set;
and acquiring the target interface calling attribute with the contribution rate larger than a preset contribution rate threshold value as a preset parameter description.
Further, in the interface invoking method provided in the embodiment of the present application, the method further includes:
acquiring a simulation data request instruction set corresponding to the target service system;
determining interface return data corresponding to each simulation data request instruction in the simulation data request instruction set;
and acquiring the target attribute of the interface return data, and determining the interface description information corresponding to the simulation data request instruction based on the target attribute.
Further, in the interface invoking method provided in the embodiment of the present application, the obtaining interface return data according to the preset interface description information and the request parameter includes:
controlling the target server to obtain first interface return data based on the request parameters;
acquiring target attributes corresponding to the first interface return data in the preset interface description information;
and adjusting the first interface return data according to the target attribute to obtain second interface return data.
Further, in the interface calling method provided in the embodiment of the present application, the adjusting the interface return data according to the interface structure to obtain the target structure data includes:
acquiring an initial data structure of the interface return data;
matching the initial data structure with the interface structure to obtain a differentiated interface structure;
determining an optimal adjustment path according to the differentiated interface structure;
and adjusting the data structure based on the optimal adjustment path to obtain target structure data.
Further, in the interface invoking method provided in the embodiment of the present application, the method further includes:
acquiring the interface return data set;
determining interface information corresponding to each interface return data in the interface return data set;
determining the dependency relationship between the interfaces according to the interface information;
and combining the interface return data sets based on the dependency relationship to obtain target structure data.
A second aspect of the embodiments of the present application further provides an interface invoking device, where the interface invoking device includes:
the request receiving module is used for receiving request information output by the target business system;
the data conversion module is used for performing data conversion processing on the request information to obtain structured target request information, and the target request information comprises target service, an interface structure and request parameters;
the server determining module is used for determining a target server according to the target service;
the information calling module is used for controlling the target server to call preset interface description information and obtaining interface return data according to the preset interface description information and the request parameters;
the data adjusting module is used for adjusting the interface return data according to the interface structure to obtain target structure data;
and the data output module is used for outputting the target structure data to the target service system.
The third aspect of the embodiments of the present application further provides a computer device, where the computer device includes a processor, and the processor is configured to implement the interface calling method according to any one of the above when executing the computer program stored in the memory.
The fourth aspect of the embodiments of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the interface calling methods described above.
The interface calling method, the interface calling device, the computer equipment and the computer readable storage medium provided by the embodiment of the application provide a set of easily understood complete description for calling of the service end, so that the service end can accurately acquire target structure data, query returns a predictable result, redundancy is not generated, the service end is more easily evolved along with changes of service scenes and different clients, and the desired data query is flexibly and quickly supported; in addition, for the condition of requesting a plurality of resources (namely loading a plurality of URLs), the method and the device can acquire all data required by the service end by one request, and can improve the efficiency of interface calling; in addition, the method and the device can avoid the reprocessing of the obtained data by the service end, reduce the maintenance cost of the service end and improve the development efficiency and the interface calling rate of the service end. The application can be applied to each function module in wisdom cities such as wisdom government affairs, wisdom traffic, for example the interface of wisdom government affairs calls module etc. can promote the rapid development in wisdom city.
Drawings
Fig. 1 is a flowchart of an interface calling method according to an embodiment of the present application.
Fig. 2 is a structural diagram of an interface invoking device according to the second embodiment of the present application.
Fig. 3 is a schematic structural diagram of a computer device provided in the third embodiment of the present application.
The following detailed description will further illustrate the present application in conjunction with the above-described figures.
Detailed Description
In order that the above objects, features and advantages of the present application can be more clearly understood, a detailed description of the present application will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth to provide a thorough understanding of the present application, and the described embodiments are a part, but not all, of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
The interface calling method provided by the embodiment of the invention is executed by the computer equipment, and correspondingly, the interface calling device runs in the computer equipment.
Fig. 1 is a flowchart of an interface calling method according to a first embodiment of the present application. As shown in fig. 1, the interface calling method may include the following steps, and the order of the steps in the flowchart may be changed and some may be omitted according to different requirements:
and S11, receiving the request information output by the target business system.
In at least one embodiment of the present application, the interface calling method may be applied to an aggregation service platform, where the aggregation service platform is used to connect a target business system and a plurality of server-side systems, and the target business system is associated with the plurality of server-side systems through interfaces and performs data communication through the interfaces. The aggregation service platform is used for receiving the request information of the target service system, calling interface data from the service system after carrying out a series of processing on the request information, and returning the interface data to the target service system. The target service system may refer to an APP end, a web front end, or a java back end, which is not limited herein. The number of the target service systems can be 1 or more. For each target business system, the number of the server-side systems to be called can be 1 or more. According to the method and the system, the aggregation service platform is provided for uniformly processing the interface calling process of the target service system and the corresponding service end system, the target service system does not need to independently adjust interface data returned by the service end system, the maintenance cost and the development cost of the service system can be reduced, and the interface calling efficiency is improved.
The request information may be http request information, get request information, or other forms of request information. Illustratively, the request information may be as follows:
{
bookByid(id:100){
id,
title,
pageCount,
price
}
}
by analyzing the request information, the request information is used to request the book name, the number of pages of the book, and the price of the book with id 100.
In at least one embodiment of the present application, the request message may include a URL address or a plurality of URL addresses. When the request information contains a URL address, the target service system only needs to call the resource of a service end system; when the request information contains a plurality of URL addresses, the target service system needs to call resources corresponding to a plurality of service end systems.
And S12, converting the request information to obtain structured target request information, wherein the target request information comprises target service, interface structure and request parameters.
In at least one embodiment of the present application, the data conversion processing refers to performing information extraction on the request information according to a preset data format to obtain structured target request information, where the target request information may include information such as a target service, an interface structure, a request parameter, a request type, and a request manner, and is not limited herein. The target service is used for identifying target server information which needs to be called by the request information, the interface structure is used for identifying a target structure of returned interface data, the request type can be a type such as Get, and the request mode can be a mode such as MICROROSEVICE.
Optionally, the data conversion processing the request information to obtain the structured target request information includes:
acquiring a preset parameter description set;
starting double processes according to the preset parameter description set, wherein the double processes comprise a first information acquisition process and a second information acquisition process;
calling the first information acquisition process to acquire a first information item in the request information;
calling the second information acquisition process to acquire a second information item in the description information of the preset interface;
and structurally combining the first information item and the second information item to obtain target request information.
The preset parameter description set comprises a plurality of preset parameter descriptions, the preset parameter descriptions are preset parameter descriptions required by interface calling, and the preset parameter descriptions can be one or more of a request mode, a request type, a request interface, a request parameter, a target service and an interface structure. Starting a double process according to the preset parameter description set, namely calling the double process to learn the parameter description required by interface calling in the preset parameter description set, and then respectively calling the first information acquisition process to traverse the request information to obtain an information item matched with the preset parameter description in the request information as a first information item; and calling the second information acquisition process to traverse the description information of the preset interface to obtain an information item matched with the preset parameter description in the description information of the preset interface as a second information item. The double processes are used for simultaneously collecting the request information and the information items carried in the preset interface description information, and the information collection rate can be improved by starting the double processes to simultaneously collect information, so that the interface calling efficiency is improved.
In an embodiment, the preset parameter description set may be set by a system worker according to an actual situation, or may be set by the aggregation service platform according to interface call data learning. Optionally, when the preset parameter description set is set for the aggregated service platform to invoke data learning according to an interface, the method further includes:
determining a target business system;
acquiring an interface calling attribute set of the target service system;
calculating the contribution rate of each interface calling attribute in the interface calling attribute set;
and acquiring the target interface calling attribute with the contribution rate larger than a preset contribution rate threshold value as a preset parameter description.
The interface calling attribute may be a calling attribute such as an interface request mode, an interface request type, an interface data structure, a target service, and the like, and in an embodiment, the interface calling attribute may be obtained by querying an interface document. The contribution rate of the interface calling attribute can be determined according to the importance degree of the interface calling attribute in the interface document, and the higher the importance degree is, the higher the corresponding contribution rate is; the less important the interface calls the attribute, the lower its corresponding contribution rate. The importance degree can process the query interface document through a TF-IDF algorithm to obtain the importance degree of each interface calling attribute, and then determine the contribution rate of each interface calling attribute, without limitation.
In at least one embodiment of the present application, the preset interface description information refers to a pre-stored exact description about each interface data, and is also referred to as preset schema information, where the preset schema information may include interface information, entry information of an interface, a return type of the interface, and the like. Illustratively, the server-side system provides a query of a bookmark style corresponding to certain interface description information, the returned type is Book, and the type of Book is defined by ID, Book name, page number and price. CallWay; string, URL; string, reqType; string, serverName; string, code; string and the like are fixed parameters, value assignment is carried out during schema definition, a mode for acquiring interface data is described, the aggregation service platform completes analysis, and a service system does not need to concern and transmit the fixed parameters.
Optionally, the method further comprises:
acquiring a simulation data request instruction set corresponding to the target service system;
determining interface return data corresponding to each simulation data request instruction in the simulation data request instruction set;
and acquiring the target attribute of the interface return data, and determining the interface description information corresponding to the simulation data request instruction based on the target attribute.
The simulation data request instruction set comprises all simulation data request instructions which are sent by the target service system and are associated with the service scene of the target service system. For each simulated data request instruction, the target attribute of the interface return data corresponding to the simulated data request instruction is obtained by adopting the method, and the interface description information corresponding to the simulated data request instruction can be obtained by combining the target attributes. The target attribute may include attributes such as a data type and a data length of the interface return data.
In an embodiment, the preset interface description information is constructed based on the simulation data request instruction set, and in an actual application process, a requirement for the interface of the target service system to return data may be changed. Optionally, the method further comprises:
establishing a monitoring process, wherein the monitoring process is used for regularly monitoring the attribute state of data returned by an interface of the target service system;
and when the monitoring process monitors that the attribute state of the interface returned data is changed, outputting a prompt to update the interface description information in time.
In an embodiment, the request information may include one URL address or a plurality of URL addresses, and when the request information includes a plurality of URL addresses, the target service system needs to invoke resources corresponding to a plurality of server-side systems. Optionally, before the determining, for each emulated data request instruction in the set of emulated data request instructions, interface return data corresponding to the emulated data request instruction, further includes:
acquiring the number of interfaces to be called contained in each analog data request instruction;
detecting whether the number of the interfaces to be called exceeds 1;
when the number of the interfaces to be called exceeds 1 as a detection result, determining the interfaces to be called;
and acquiring the dependency relationship among the interfaces to be called, and determining interface description information based on the dependency relationship.
For example, for a certain request message, the number of interfaces to be called is 2, namely, an interface a and an interface B, and in order to obtain interface return data corresponding to the request message, the interface a needs to be called according to the request message to obtain interface intermediate return data, and then the interface B needs to be called according to the interface intermediate return data to obtain interface return data corresponding to the request message. The determining interface description information based on the dependency relationship may include: according to the dependency relationship, traversing a mapping relationship between a preset dependency relationship and a dependency formula, and determining a target dependency formula corresponding to the dependency relationship; and combining the interface information according to the target dependent formula to obtain interface description information. The dependency formula refers to a data storage form of the interface information determined according to a dependency relationship (e.g., a front-back call relationship) between the interfaces, and the data storage form is not limited.
And S13, determining a target server according to the target service.
In at least one embodiment of the present application, the target request information includes data such as a target service, an interface structure, and a request parameter, where the target service is used to identify target server information that needs to be called by the request information, an identifier included in the target service may be a digital identifier, an alphabetic identifier, or a color identifier, and the target server may be determined by querying an identifier corresponding to the target service. The number of the target servers may be 1 or multiple, and the number of the target servers may be determined according to the number of the URL addresses carried in the request information.
And S14, controlling the target server to call preset interface description information, and obtaining interface return data according to the preset interface description information and the request parameters.
In at least one embodiment of the present application, for each target server, there is corresponding preset interface description information, and in order to improve security and privacy of the preset interface description information, the preset interface description information may be stored in a target node of a block chain. The target request information comprises data such as target service, interface structure and request parameters, first interface return data can be obtained according to the request parameters, and interface return data which does not contain redundant information can be obtained only by calling the preset interface description information to adjust the first interface return data.
Optionally, the obtaining interface return data according to the preset interface description information and the request parameter includes:
controlling the target server to obtain first interface return data based on the request parameters;
acquiring target attributes corresponding to the first interface return data in the preset interface description information;
and adjusting the first interface return data according to the target attribute to obtain second interface return data.
And controlling the target server to obtain the first interface return data based on the request parameter, wherein the process of obtaining the first interface return data is the prior art and is not described herein again. Each piece of data in the first interface return data has a target attribute in the preset interface description information corresponding to the data, and the target attribute can be a data type attribute or a data length attribute. And adjusting the first interface return data according to the target attribute, namely adjusting the type data or the length attribute of the first interface return data.
And S15, adjusting the interface return data according to the interface structure to obtain target structure data.
In at least one embodiment of the present application, the target request information includes data such as a target service, an interface structure, and a request parameter, where the interface structure is used to identify a target structure of returned interface data, and the target structure data corresponding to the request information is obtained by adjusting the interface structure of the interface returned data, so that the target service system directly calls the target structure data, and the target service system does not need to separately perform structure adjustment on the interface returned data, which can improve the efficiency of interface calling.
Optionally, the adjusting the interface return data according to the interface structure to obtain the target structure data includes:
acquiring an initial data structure of the interface return data;
matching the initial data structure with the interface structure to obtain a differentiated interface structure;
determining an optimal adjustment path according to the differentiated interface structure;
and adjusting the data structure based on the optimal adjustment path to obtain target structure data.
The initial data structure refers to a current data structure of the interface return data, and the difference between the initial data structure and the interface structure, namely the differentiated interface structure, can be obtained by comparing the initial data structure with the interface structure.
In an embodiment, in order to improve the comparison rate of the data structure and the calculation rate of the optimal adjustment path, optionally, the method further includes: and digitally processing the interface return data. Each piece of data in the interface return data is identified in a numerical value adding mode, so that the comparison rate of the data structure and the calculation rate of the optimal adjustment path can be improved. The optimal adjustment path refers to an adjustment path with the highest adjustment efficiency of the data structure, and can be obtained in a machine learning mode. And adjusting the data structure based on the optimal adjustment path to obtain target structure data, so that the adjustment rate of the structure data can be improved, and the interface calling rate is further improved.
In at least one embodiment of the present application, the request information may include one URL address or a plurality of URL addresses, and when the request information includes a plurality of URL addresses, the target service system needs to invoke resources corresponding to a plurality of service systems. The different service systems return the corresponding interface return data, and at this time, the number of the interface return data may also be multiple. Optionally, the method further comprises:
acquiring the interface return data set;
determining interface information corresponding to each interface return data in the interface return data set;
determining the dependency relationship between the interfaces according to the interface information;
and combining the interface return data sets based on the dependency relationship to obtain target structure data.
And S16, outputting the target structure data to the target business system.
In at least one embodiment of the present application, the target structure data is output to the target business system, so that the target business system processes the target structure data.
The interface calling method provided by the embodiment of the application provides a set of easily understood complete description for calling of the service end, so that the service end can accurately acquire target structure data, query returns a predictable result, redundancy is not generated, the service end is more easily evolved along with changes of service scenes and different clients, and the desired data query is flexibly and quickly supported; in addition, for the condition of requesting a plurality of resources (namely loading a plurality of URLs), the method and the device can acquire all data required by the service end by one request, and can improve the efficiency of interface calling; in addition, the method and the device can avoid the reprocessing of the obtained data by the service end, reduce the maintenance cost of the service end and improve the development efficiency and the interface calling rate of the service end.
Fig. 2 is a structural diagram of an interface invoking device according to the second embodiment of the present application.
In some embodiments, the interface calling device 20 may include a plurality of functional modules composed of computer program segments. The computer program of each program segment in the interface invocation means 20 may be stored in a memory of the computer device and executed by at least one processor to perform (see detailed description of fig. 1) the function invoked by the interface.
In this embodiment, the interface calling device 20 may be divided into a plurality of functional modules according to the functions executed by the interface calling device. The functional module may include: a request receiving module 201, a data conversion module 202, a server determination module 203, an information calling module 204, a data adjusting module 205, and a data output module 206. A module as referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in a memory. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The request receiving module 201 may be configured to receive request information output by a target business system.
In at least one embodiment of the present application, the interface calling method may be applied to an aggregation service platform, where the aggregation service platform is used to connect a target business system and a plurality of server-side systems, and the target business system is associated with the plurality of server-side systems through interfaces and performs data communication through the interfaces. The aggregation service platform is used for receiving the request information of the target service system, calling interface data from the service system after carrying out a series of processing on the request information, and returning the interface data to the target service system. The target service system may refer to an APP end, a web front end, or a java back end, which is not limited herein. The number of the target service systems can be 1 or more. For each target business system, the number of the server-side systems to be called can be 1 or more. According to the method and the system, the aggregation service platform is provided for uniformly processing the interface calling process of the target service system and the corresponding service end system, the target service system does not need to independently adjust interface data returned by the service end system, the maintenance cost and the development cost of the service system can be reduced, and the interface calling efficiency is improved.
The request information may be http request information, get request information, or other forms of request information. Illustratively, the request information may be as follows:
{
bookByid(id:100){
id,
title,
pageCount,
price
}
}
by analyzing the request information, the request information is used to request the book name, the number of pages of the book, and the price of the book with id 100.
In at least one embodiment of the present application, the request message may include a URL address or a plurality of URL addresses. When the request information contains a URL address, the target service system only needs to call the resource of a service end system; when the request information contains a plurality of URL addresses, the target service system needs to call resources corresponding to a plurality of service end systems.
The data conversion module 202 may be configured to perform data conversion to process the request information to obtain structured target request information, where the target request information includes a target service, an interface structure, and a request parameter.
In at least one embodiment of the present application, the data conversion processing refers to performing information extraction on the request information according to a preset data format to obtain structured target request information, where the target request information may include information such as a target service, an interface structure, a request parameter, a request type, and a request manner, and is not limited herein. The target service is used for identifying target server information which needs to be called by the request information, the interface structure is used for identifying a target structure of returned interface data, the request type can be a type such as Get, and the request mode can be a mode such as MICROROSEVICE.
Optionally, the data conversion processing the request information to obtain the structured target request information includes:
acquiring a preset parameter description set;
starting double processes according to the preset parameter description set, wherein the double processes comprise a first information acquisition process and a second information acquisition process;
calling the first information acquisition process to acquire a first information item in the request information;
calling the second information acquisition process to acquire a second information item in the description information of the preset interface;
and structurally combining the first information item and the second information item to obtain target request information.
The preset parameter description set comprises a plurality of preset parameter descriptions, the preset parameter descriptions are preset parameter descriptions required by interface calling, and the preset parameter descriptions can be one or more of a request mode, a request type, a request interface, a request parameter, a target service and an interface structure. Starting a double process according to the preset parameter description set, namely calling the double process to learn the parameter description required by interface calling in the preset parameter description set, and then respectively calling the first information acquisition process to traverse the request information to obtain an information item matched with the preset parameter description in the request information as a first information item; and calling the second information acquisition process to traverse preset interface description information to obtain an information item matched with the preset parameter description in the interface description information as a second information item. The double processes are used for simultaneously collecting the request information and the information items carried in the interface description information, and the information collection speed can be improved by starting the double processes to simultaneously collect the information, so that the interface calling efficiency is improved.
In an embodiment, the preset parameter description set may be set by a system worker according to an actual situation, or may be set by the aggregation service platform according to interface call data learning. Optionally, when the preset parameter description set is a setting for the aggregated service platform to invoke data learning according to an interface, the data conversion module 202 further includes:
determining a target business system;
acquiring an interface calling attribute set of the target service system;
calculating the contribution rate of each interface calling attribute in the interface calling attribute set;
and acquiring the target interface calling attribute with the contribution rate larger than a preset contribution rate threshold value as a preset parameter description.
The interface calling attribute may be a calling attribute such as an interface request mode, an interface request type, an interface data structure, a target service, and the like, and in an embodiment, the interface calling attribute may be obtained by querying an interface document. The contribution rate of the interface calling attribute can be determined according to the importance degree of the interface calling attribute in the interface document, and the higher the importance degree is, the higher the corresponding contribution rate is; the less important the interface calls the attribute, the lower its corresponding contribution rate. The importance degree can process the query interface document through a TF-IDF algorithm to obtain the importance degree of each interface calling attribute, and then determine the contribution rate of each interface calling attribute, without limitation.
In at least one embodiment of the present application, the preset interface description information refers to an exact description about each interface data stored in advance, and the preset interface description information may include interface information, entry information of an interface, a return type of an interface, and the like. Illustratively, corresponding to a certain schema information, the server-side system provides a query of a bookmark style, the returned type is Book, and the type of Book is defined by ID, Book name, page number and price. CallWay; string, URL; string, reqType; string, serverName; string, code; string and the like are fixed parameters, value assignment is carried out during schema definition, a mode for acquiring interface data is described, the aggregation service platform completes analysis, and a service system does not need to concern and transmit the fixed parameters.
Optionally, the data conversion module 202 further includes:
acquiring a simulation data request instruction set corresponding to the target service system;
determining interface return data corresponding to each simulation data request instruction in the simulation data request instruction set;
and acquiring the target attribute of the interface return data, and determining the interface description information corresponding to the simulation data request instruction based on the target attribute.
The simulation data request instruction set comprises all simulation data request instructions which are sent by the target service system and are associated with the service scene of the target service system. For each simulated data request instruction, the target attribute of the interface return data corresponding to the simulated data request instruction is obtained by adopting the method, and the interface description information corresponding to the simulated data request instruction can be obtained by combining the target attributes. The target attribute may include attributes such as a data type and a data length of the interface return data.
In an embodiment, the preset interface description information is constructed based on the simulation data request instruction set, and in an actual application process, a requirement for the interface of the target service system to return data may be changed. Optionally, the data conversion module 202 further includes:
establishing a monitoring process, wherein the monitoring process is used for regularly monitoring the attribute state of data returned by an interface of the target service system;
and when the monitoring process monitors that the attribute state of the interface returned data is changed, outputting a prompt to update the interface description information in time.
In an embodiment, the request information may include one URL address or a plurality of URL addresses, and when the request information includes a plurality of URL addresses, the target service system needs to invoke resources corresponding to a plurality of server-side systems. Optionally, before the determining, for each emulated data request instruction in the set of emulated data request instructions, interface return data corresponding to the emulated data request instruction, further includes:
acquiring the number of interfaces to be called contained in each analog data request instruction;
detecting whether the number of the interfaces to be called exceeds 1;
when the number of the interfaces to be called exceeds 1 as a detection result, determining the interfaces to be called;
and acquiring the dependency relationship among the interfaces to be called, and determining interface description information based on the dependency relationship.
For example, for a certain request message, the number of interfaces to be called is 2, namely, an interface a and an interface B, and in order to obtain interface return data corresponding to the request message, the interface a needs to be called according to the request message to obtain interface intermediate return data, and then the interface B needs to be called according to the interface intermediate return data to obtain interface return data corresponding to the request message. The determining interface description information based on the dependency relationship may include: according to the dependency relationship, traversing a mapping relationship between a preset dependency relationship and a dependency formula, and determining a target dependency formula corresponding to the dependency relationship; and combining the interface information according to the target dependent formula to obtain interface description information. The dependency formula refers to a data storage form of the interface information determined according to a dependency relationship (e.g., a front-back call relationship) between the interfaces, and the data storage form is not limited.
The server determination module 203 may be configured to determine a target server from the target service.
In at least one embodiment of the present application, the target request information includes data such as a target service, an interface structure, and a request parameter, where the target service is used to identify target server information that needs to be called by the request information, an identifier included in the target service may be a digital identifier, an alphabetic identifier, or a color identifier, and the target server may be determined by querying an identifier corresponding to the target service. The number of the target servers may be 1 or multiple, and the number of the target servers may be determined according to the number of the URL addresses carried in the request information.
The information invoking module 204 may be configured to control the target server to invoke preset schema information, and obtain interface return data according to the preset interface description information and the request parameter.
In at least one embodiment of the present application, for each target server, there is corresponding preset interface description information, and in order to improve security and privacy of the preset interface description information, the preset interface description information may be stored in a target node of a block chain. The target request information comprises data such as target service, interface structure and request parameters, first interface return data can be obtained according to the request parameters, and interface return data which does not contain redundant information can be obtained only by calling the preset interface description information to adjust the first interface return data.
Optionally, the obtaining interface return data according to the preset interface description information and the request parameter includes:
controlling the target server to obtain first interface return data based on the request parameters;
acquiring target attributes corresponding to the first interface return data in the preset interface description information;
and adjusting the first interface return data according to the target attribute to obtain second interface return data.
And controlling the target server to obtain the first interface return data based on the request parameter, wherein the process of obtaining the first interface return data is the prior art and is not described herein again. Each piece of data in the first interface return data has a target attribute in the preset interface description information corresponding to the data, and the target attribute can be a data type attribute or a data length attribute. And adjusting the first interface return data according to the target attribute, namely adjusting the type data or the length attribute of the first interface return data.
The data adjusting module 205 may be configured to adjust the interface return data according to the interface structure to obtain target structure data.
In at least one embodiment of the present application, the target request information includes data such as a target service, an interface structure, and a request parameter, where the interface structure is used to identify a target structure of returned interface data, and the target structure data corresponding to the request information is obtained by adjusting the interface structure of the interface returned data, so that the target service system directly calls the target structure data, and the target service system does not need to separately perform structure adjustment on the interface returned data, which can improve the efficiency of interface calling.
Optionally, the adjusting the interface return data according to the interface structure to obtain the target structure data includes:
acquiring an initial data structure of the interface return data;
matching the initial data structure with the interface structure to obtain a differentiated interface structure;
determining an optimal adjustment path according to the differentiated interface structure;
and adjusting the data structure based on the optimal adjustment path to obtain target structure data.
The initial data structure refers to a current data structure of the interface return data, and the difference between the initial data structure and the interface structure, namely the differentiated interface structure, can be obtained by comparing the initial data structure with the interface structure.
In an embodiment, in order to increase the comparison rate of the data structure and the calculation rate of the optimal adjustment path, optionally, the data adjustment module 205 further includes: and digitally processing the interface return data. Each piece of data in the interface return data is identified in a numerical value adding mode, so that the comparison rate of the data structure and the calculation rate of the optimal adjustment path can be improved. The optimal adjustment path refers to an adjustment path with the highest adjustment efficiency of the data structure, and can be obtained in a machine learning mode. And adjusting the data structure based on the optimal adjustment path to obtain target structure data, so that the adjustment rate of the structure data can be improved, and the interface calling rate is further improved.
In at least one embodiment of the present application, the request information may include one URL address or a plurality of URL addresses, and when the request information includes a plurality of URL addresses, the target service system needs to invoke resources corresponding to a plurality of service systems. The different service systems return the corresponding interface return data, and at this time, the number of the interface return data may also be multiple. Optionally, the data adjusting module 205 further includes:
acquiring the interface return data set;
determining interface information corresponding to each interface return data in the interface return data set;
determining the dependency relationship between the interfaces according to the interface information;
and combining the interface return data sets based on the dependency relationship to obtain target structure data.
The data output module 206 may be configured to output the target structure data to the target business system.
In at least one embodiment of the present application, the target structure data is output to the target business system, so that the target business system processes the target structure data.
Fig. 3 is a schematic structural diagram of a computer device according to a third embodiment of the present application. In the preferred embodiment of the present application, the computer device 3 includes a memory 31, at least one processor 32, at least one communication bus 33, and a transceiver 34.
It will be appreciated by those skilled in the art that the configuration of the computer device shown in fig. 3 is not a limitation of the embodiments of the present application, and may be a bus-type configuration or a star-type configuration, and that the computer device 3 may include more or less hardware or software than those shown, or a different arrangement of components.
In some embodiments, the computer device 3 is a device capable of automatically performing numerical calculation and/or information processing according to instructions set or stored in advance, and the hardware includes but is not limited to a microprocessor, an application specific integrated circuit, a programmable gate array, a digital processor, an embedded device, and the like. The computer device 3 may also include a client device, which includes, but is not limited to, any electronic product capable of interacting with a client through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device, for example, a personal computer, a tablet computer, a smart phone, a digital camera, etc.
It should be noted that the computer device 3 is only an example, and other existing or future electronic products, such as those that may be adapted to the present application, are also included in the scope of the present application and are incorporated herein by reference.
In some embodiments, the memory 31 has stored therein a computer program which, when executed by the at least one processor 32, implements all or part of the steps of the interface call method as described. The Memory 31 includes a Read-Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an electronically Erasable rewritable Read-Only Memory (Electrically-Erasable Programmable Read-Only Memory (EEPROM)), an optical Read-Only disk (CD-ROM) or other optical disk Memory, a magnetic disk Memory, a tape Memory, or any other medium readable by a computer capable of carrying or storing data.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In some embodiments, the at least one processor 32 is a Control Unit (Control Unit) of the computer device 3, connects various components of the entire computer device 3 by using various interfaces and lines, and executes various functions and processes data of the computer device 3 by running or executing programs or modules stored in the memory 31 and calling data stored in the memory 31. For example, the at least one processor 32, when executing the computer program stored in the memory, implements all or part of the steps of the interface calling method described in the embodiments of the present application; or implement all or part of the functions of the interface calling device. The at least one processor 32 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips.
In some embodiments, the at least one communication bus 33 is arranged to enable connection communication between the memory 31 and the at least one processor 32 or the like.
Although not shown, the computer device 3 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 32 through a power management device, so as to implement functions of managing charging, discharging, and power consumption through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The computer device 3 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a computer device, or a network device) or a processor (processor) to execute parts of the methods according to the embodiments of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or that the singular does not exclude the plural. A plurality of units or means recited in the specification may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present application and not for limiting, and although the present application is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made on the technical solutions of the present application without departing from the spirit and scope of the technical solutions of the present application.

Claims (10)

1. An interface calling method, characterized in that the interface calling method comprises:
receiving request information output by a target service system;
the data conversion processes the request information to obtain structured target request information, wherein the target request information comprises target service, an interface structure and request parameters;
determining a target server according to the target service;
controlling the target server to call preset interface description information and obtaining interface return data according to the preset interface description information and the request parameters;
adjusting the interface return data according to the interface structure to obtain target structure data;
and outputting the target structure data to the target business system.
2. The interface call method according to claim 1, wherein the data conversion processing the request information to obtain the structured target request information comprises:
acquiring a preset parameter description set;
starting double processes according to the preset parameter description set, wherein the double processes comprise a first information acquisition process and a second information acquisition process;
calling the first information acquisition process to acquire a first information item in the request information;
calling the second information acquisition process to acquire a second information item in the description information of the preset interface;
and structurally combining the first information item and the second information item to obtain target request information.
3. The interface call method according to claim 2, wherein the obtaining a preset parameter description set includes:
determining a target business system;
acquiring an interface calling attribute set of the target service system;
calculating the contribution rate of each interface calling attribute in the interface calling attribute set;
and acquiring the target interface calling attribute with the contribution rate larger than a preset contribution rate threshold value as a preset parameter description.
4. The interface call method according to claim 2, wherein the method further comprises:
acquiring a simulation data request instruction set corresponding to the target service system;
determining interface return data corresponding to each simulation data request instruction in the simulation data request instruction set;
and acquiring the target attribute of the interface return data, and determining the interface description information corresponding to the simulation data request instruction based on the target attribute.
5. The interface calling method according to claim 1, wherein the obtaining interface return data according to the preset interface description information and the request parameter comprises:
controlling the target server to obtain first interface return data based on the request parameters;
acquiring target attributes corresponding to the first interface return data in the preset interface description information;
and adjusting the first interface return data according to the target attribute to obtain second interface return data.
6. The interface call method according to claim 1, wherein the adjusting the interface return data according to the interface structure to obtain target structure data comprises:
acquiring an initial data structure of the interface return data;
matching the initial data structure with the interface structure to obtain a differentiated interface structure;
determining an optimal adjustment path according to the differentiated interface structure;
and adjusting the data structure based on the optimal adjustment path to obtain target structure data.
7. The interface call method according to claim 1, wherein the method further comprises:
acquiring the interface return data set;
determining interface information corresponding to each interface return data in the interface return data set;
determining the dependency relationship between the interfaces according to the interface information;
and combining the interface return data sets based on the dependency relationship to obtain target structure data.
8. An interface invocation apparatus, characterized in that said interface invocation apparatus comprises:
the request receiving module is used for receiving request information output by the target business system;
the data conversion module is used for performing data conversion processing on the request information to obtain structured target request information, and the target request information comprises target service, an interface structure and request parameters;
the server determining module is used for determining a target server according to the target service;
the information calling module is used for controlling the target server to call preset interface description information and obtaining interface return data according to the preset interface description information and the request parameters;
the data adjusting module is used for adjusting the interface return data according to the interface structure to obtain target structure data;
and the data output module is used for outputting the target structure data to the target service system.
9. A computer device comprising a processor for implementing the interface call method of any one of claims 1 to 7 when executing a computer program stored in a memory.
10. A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the interface call method according to any one of claims 1 to 7.
CN202110219988.0A 2021-02-26 2021-02-26 Interface calling method and device and related equipment Pending CN112948723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110219988.0A CN112948723A (en) 2021-02-26 2021-02-26 Interface calling method and device and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110219988.0A CN112948723A (en) 2021-02-26 2021-02-26 Interface calling method and device and related equipment

Publications (1)

Publication Number Publication Date
CN112948723A true CN112948723A (en) 2021-06-11

Family

ID=76246597

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110219988.0A Pending CN112948723A (en) 2021-02-26 2021-02-26 Interface calling method and device and related equipment

Country Status (1)

Country Link
CN (1) CN112948723A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542369A (en) * 2021-06-28 2021-10-22 深圳海付移通科技有限公司 Interface data processing method and device, computer equipment and storage medium
CN114928636A (en) * 2022-07-20 2022-08-19 北京达佳互联信息技术有限公司 Interface call request processing method, device, equipment, storage medium and product
CN117009110A (en) * 2023-08-30 2023-11-07 中国人民解放军陆军工程大学 Interface dynamic calling method based on description information

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107193668A (en) * 2017-04-26 2017-09-22 深圳中兴网信科技有限公司 The call method and system at interface service end
CN108023921A (en) * 2016-11-03 2018-05-11 平安科技(深圳)有限公司 The cut-in method and device of a kind of third-party platform
CN111049854A (en) * 2019-12-25 2020-04-21 微民保险代理有限公司 Service request transmission method and device
CN111143087A (en) * 2019-12-18 2020-05-12 中国平安财产保险股份有限公司 Interface calling method and device, storage medium and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108023921A (en) * 2016-11-03 2018-05-11 平安科技(深圳)有限公司 The cut-in method and device of a kind of third-party platform
CN107193668A (en) * 2017-04-26 2017-09-22 深圳中兴网信科技有限公司 The call method and system at interface service end
CN111143087A (en) * 2019-12-18 2020-05-12 中国平安财产保险股份有限公司 Interface calling method and device, storage medium and server
CN111049854A (en) * 2019-12-25 2020-04-21 微民保险代理有限公司 Service request transmission method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542369A (en) * 2021-06-28 2021-10-22 深圳海付移通科技有限公司 Interface data processing method and device, computer equipment and storage medium
CN114928636A (en) * 2022-07-20 2022-08-19 北京达佳互联信息技术有限公司 Interface call request processing method, device, equipment, storage medium and product
CN114928636B (en) * 2022-07-20 2022-11-04 北京达佳互联信息技术有限公司 Interface call request processing method, device, equipment, storage medium and product
CN117009110A (en) * 2023-08-30 2023-11-07 中国人民解放军陆军工程大学 Interface dynamic calling method based on description information

Similar Documents

Publication Publication Date Title
CN112948723A (en) Interface calling method and device and related equipment
CN112698971B (en) Parameter conversion method, device, equipment and medium based on rule engine
CN105556475A (en) Request processing techniques
CN104092555B (en) A kind of methods, devices and systems of undated parameter value
CN111913818A (en) Method for determining dependency relationship between services and related device
CN113094674A (en) Page display method and device, electronic equipment and storage medium
CN113704665A (en) Dynamic service publishing method, device, electronic equipment and storage medium
CN112256783A (en) Data export method and device, electronic equipment and storage medium
CN112948275A (en) Test data generation method, device, equipment and storage medium
WO2022134809A1 (en) Model training processing method and apparatus, computer device, and medium
CN114691050A (en) Cloud native storage method, device, equipment and medium based on kubernets
CN114675976B (en) GPU (graphics processing Unit) sharing method, device, equipment and medium based on kubernets
CN113286014B (en) Dynamic configuration method and device of basic domain name and related equipment
CN113923218B (en) Distributed deployment method, device, equipment and medium for coding and decoding plug-in
CN114185502A (en) Log printing method, device, equipment and medium based on production line environment
CN114691782A (en) Database table increment synchronization method and device and storage medium
CN114489985A (en) Data processing method, device and storage medium
CN114374727B (en) Data calling method and device based on artificial intelligence, electronic equipment and medium
CN112631996A (en) Log searching method and device
CN111767500A (en) Data storage sharing method and device, computer equipment and storage medium
CN112000945B (en) Authorization method, device, equipment and medium based on artificial intelligence
CN111741097B (en) Method for tenant to monopolize node, computer equipment and storage medium
CN103970854A (en) Method for synchronizing incremental certificate information between SAP ECC end and SAP BW end
CN112905470A (en) Interface calling method and device, computer equipment and medium
CN112528332A (en) Data acquisition method and device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination