CN115480816A - Interface calling method and device, electronic equipment and readable storage medium - Google Patents

Interface calling method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115480816A
CN115480816A CN202211111625.6A CN202211111625A CN115480816A CN 115480816 A CN115480816 A CN 115480816A CN 202211111625 A CN202211111625 A CN 202211111625A CN 115480816 A CN115480816 A CN 115480816A
Authority
CN
China
Prior art keywords
interface
version
target
data platform
api
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
CN202211111625.6A
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.)
Hangzhou Dt Dream Technology Co Ltd
Original Assignee
Hangzhou Dt Dream Technology 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 Hangzhou Dt Dream Technology Co Ltd filed Critical Hangzhou Dt Dream Technology Co Ltd
Priority to CN202211111625.6A priority Critical patent/CN115480816A/en
Publication of CN115480816A publication Critical patent/CN115480816A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides an interface calling method, an interface calling device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: in response to an interface call request, determining a lower interface version of the first interface version and the second interface version corresponding to a target API as a target interface version of the target API; and further submitting the interface calling request to a target API of the target interface version to complete interface calling aiming at the target API, and initiating interface calling aiming at a target API interface of the target interface version to complete interaction between the lower-level data platform and the upper-level data platform. Therefore, the problem of version incompatibility between the upper and lower data platforms can be solved, and when one data platform is upgraded, other data platforms do not need to be driven to be upgraded, so that the maintenance cost of the data platform is saved.

Description

Interface calling method and device, electronic equipment and readable storage medium
Technical Field
The application relates to the technical field of big data, in particular to a big data platform in the field of data bases, and provides an interface calling method, an interface calling device, electronic equipment and a readable storage medium.
Background
There are multi-level mechanisms with vertical relationships in the big data field industry. For example, in the government affairs big data industry, there is a vertical management relationship between multi-level organizations such as department, province, city, county, etc. Wherein each level of an organization in the multi-level organization can deploy a corresponding data platform.
In a scenario of data sharing between an upper-level data platform and a lower-level data platform, the upper-level data platform may provide an API for the lower-level data platform to call, in practical applications, each level of data platform generally needs version update, after version update is performed on a certain level of data platform, an interface version of the API provided by the level of data platform may change accordingly, and if version update is not performed adaptively on other data platforms which are in butt joint with the certain level of data platform, interface versions of the same API maintained by other data platforms may be inconsistent, so that the API provided by the data platform cannot be called normally, and a problem of compatibility failure occurs between the levels of data platforms.
Disclosure of Invention
The application provides an interface calling method, wherein a multi-level data cascade platform comprises at least one upper level data platform and at least one lower level data platform; the lower data platform is cascaded with the upper data platform through a cascading module; the API provided by the superior data platform is used for the subordinate data platform to initiate interface calling; the tandem module storing a first interface version of the API maintained by the upper level data platform and a second interface version of the API maintained by the lower level data platform, the method applied to the tandem module, the method comprising:
receiving an interface calling request which is initiated by the lower data platform and aims at a target API provided by the upper data platform;
in response to the interface calling request, determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and further submitting the interface calling request to a target API of the target interface version so as to complete the interface calling aiming at the target API.
Optionally, the cascade module stores a version identifier of a first interface version of the API maintained by the upper data platform and a version identifier of a second interface version of the API maintained by the lower data platform;
the determining, as the target interface version of the target API, a lower interface version of the first interface version and the second interface version corresponding to the target API includes:
when the version identification of the second interface version is larger than that of the first interface version, determining the first interface version as a target interface version of a target API;
when the version identification of the second interface version is smaller than that of the first interface version, determining the second interface version as the target interface version of the target API
Optionally, the cascade module locally stores interface codes of all historical versions of the API provided by the upper level data platform;
the submitting the interface call request to a target API of the target interface version to complete an interface call to the target API comprises:
searching an interface code corresponding to the target interface version from the interface codes of all historical versions;
and submitting the interface calling request to an interface code corresponding to the target interface version so as to complete the interface calling of the target API aiming at the target interface version.
Optionally, the method further includes:
and receiving the second interface version of the lower data platform with timing synchronization, and storing the second interface version locally for maintenance.
Optionally, the method further includes:
and when the interface version of the target API does not exist, returning prompt information to the lower-level data platform.
Optionally, the method further includes:
the lower data platform responds to the interface call of a target API provided by the upper data platform, and acquires a first interface version of the API maintained by the upper data platform and maintained by the cascade module;
determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and responding to the determined target interface version, and initiating an interface calling request aiming at the target API of the target interface version to the superior data platform.
Optionally, the step of determining, by the cascade module, a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API includes:
when the version identification of the first interface version is larger than that of the second interface version, determining the second interface version as a target interface version of the target API;
and when the version identification of the first interface version is smaller than the version identification of the second interface version, determining the first interface version as the target interface version of the target API.
Optionally, the lower data platform locally stores interface request codes of all historical versions of the API provided by the upper data platform;
the responding to the determined target interface version, initiating an interface call request aiming at the target API of the target interface version to the superior data platform, and including:
searching an interface request code corresponding to the target interface version from the interface request codes of all historical versions;
executing an interface request code corresponding to the target interface version, and initiating an interface call request aiming at a target API of the target interface version to the superior data platform.
Optionally, the method further includes:
and synchronizing the second interface version to the cascade module at regular time so that the cascade module stores the second interface version locally for maintenance.
The application also provides an interface calling device, wherein the multistage data cascade platform comprises at least one upper data platform and at least one lower data platform; the lower data platform is cascaded with the upper data platform through a cascading module; an API provided by the superior data platform is used for the subordinate data platform to initiate interface call; the cascade module storing a first interface version of the API maintained by the upper level data platform and a second interface version of the API maintained by the lower level data platform, the method being applied to the cascade module, the apparatus comprising:
a receiving request unit, configured to receive an interface call request, which is initiated by the lower data platform and is directed to a target API provided by the upper data platform;
an interface version determining unit, configured to determine, in response to the interface call request, a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and the interface calling unit is used for further submitting the interface calling request to a target API of the target interface version so as to complete interface calling aiming at the target API.
The application also provides an electronic device, which comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are mutually connected through the bus;
the memory stores machine-readable instructions, and the processor executes the method by calling the machine-readable instructions.
The present application also provides a computer readable storage medium having stored thereon machine readable instructions which, when invoked and executed by a processor, implement the above method.
With the above embodiment, the first interface version of the API maintained by the upper data platform and the second interface version of the API maintained by the lower data platform are maintained in the cascade module, and the method is applied to the cascade module, and before a target interface is called, the first interface version and the second interface version of the target interface are compared, and a lower interface version is determined as the target interface version, thereby completing interface calling for the target API.
And meanwhile, the cascade module stores a first interface version of the API maintained by the superior data platform, the subordinate data platform maintains a second interface version of the API, and before the subordinate data platform initiates an interface call request, the lower interface version is determined as a target interface version, so that the interface call request aiming at the API of the target interface version is initiated.
Therefore, by the technical scheme, the API with the lower interface version can be selected when the interface is called, and the API with the lower interface version is selected to initiate the interface calling request when the interface calling request is initiated, so that the problem of version incompatibility between the upper and lower data platforms is solved, when one data platform is upgraded, other data platforms do not need to be driven to be upgraded, and the maintenance cost of the data platform is saved.
Drawings
FIG. 1 is a schematic diagram of a multi-level data cascading platform, according to an exemplary embodiment.
FIG. 2 is a flow diagram illustrating an interface call method in accordance with an illustrative embodiment.
Fig. 3 is a flow diagram illustrating an example embodiment of a lower data platform initiating an interface call request.
Fig. 4 is a hardware configuration diagram of an electronic device in which an interface calling apparatus is located according to an exemplary embodiment.
Fig. 5 is a block diagram of an interface invocation means in accordance with an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present specification, the following briefly describes the related technologies related to the embodiments of the present specification.
There are multi-level mechanisms with vertical relationships in the big data domain industry. For example, in the government affairs big data industry, vertical management relations exist among multi-level organizations such as department, province, city, county, and the like. Wherein each level of an organization in the multi-level organization can deploy a corresponding data platform. In recent years, with the continuous development of the industry in the vertical field of the internet, a scene of data exchange between an upper data platform and a lower data platform exists.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating a multi-level data concatenation platform according to an exemplary embodiment.
As shown in fig. 1, the multi-level data cascade platform includes at least one upper level data platform and at least one lower level data platform, and the lower level data platform may cascade with the upper level data platform through a cascade module. The cascade module can be deployed on an upper data platform, can also be deployed on an upper data platform, and can also be deployed independently as a middleware for interaction between the upper data platform and a lower data platform.
The superior data platform can send the data information provided by the superior data platform to the cascade module through the API provided by the superior data platform, and the subordinate data platform can store the data information sent by the superior data platform to the local subordinate data platform through requesting the API provided by the superior. Meanwhile, the lower data platform can send data information to the upper data platform by requesting the API provided by the upper data platform, and the upper data platform stores the data information sent by the lower data platform to the local of the upper data platform by the API provided by the upper data platform, so that data exchange between the upper data platform and the lower data platform is completed.
However, since the upper level data platform or the lower level data platform usually needs version update, after the version of the upper level data platform is updated, the lower level data platform is still an old version, and if the API provided by the upper level data platform is changed, the lower level data platform cannot normally request the API provided by the upper level data platform in the form of the API of the old version, and then the compatibility problem may occur. After the version of the next-level data platform is upgraded, the upper-level data platform is still an old version, the next-level data platform may not use the API of the new version to normally request the API of the old version provided by the upper-level data platform, and meanwhile, the next-level data platform may have a new function, and the old-version upper-level data platform may not provide an interface corresponding to the new function, which may also cause a compatibility problem.
Aiming at the problem of version compatibility, the traditional solution is to synchronously upgrade the upper and lower data platforms, which not only wastes time and manpower, but also increases the maintenance cost of the data platform,
In view of this, the present specification aims to provide a technical solution for determining an interface version compatible with both upper and lower data platforms before an interface is called, and then performing the interface calling.
In implementation, the cascade module stores a first interface version of the API maintained by the superior data platform and a second interface version of the API maintained by the inferior data platform.
The cascade module can receive an interface call request which is initiated by the lower data platform and aims at a target API provided by the upper data platform;
in response to the interface calling request, determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and further submitting the interface calling request to a target API of the target interface version so as to complete the interface calling aiming at the target API.
Meanwhile, the cascade module stores a first interface version of the API maintained by the upper data platform, and the lower data platform maintains a second interface version of the API; the method is applied to the lower level data platform,
the lower data platform may obtain, in response to an interface call for a target API provided by the upper data platform, a first interface version of the API maintained by the upper data platform and maintained by the cascade module;
determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and responding to the determined target interface version, and initiating an interface calling request aiming at the target API of the target interface version to the superior data platform.
With the above embodiment, the first interface version of the API maintained by the upper data platform and the second interface version of the API maintained by the lower data platform are maintained in the cascade module, and the method is applied to the cascade module, and before a target interface is called, the first interface version and the second interface version of the target interface are compared, and a lower interface version is determined as the target interface version, thereby completing interface calling for the target API.
And meanwhile, the cascade module stores a first interface version of the API maintained by the upper-level data platform, the lower-level data platform maintains a second interface version of the API, and a lower interface version is determined as a target interface version before the lower-level data platform initiates an interface calling request, so that the interface calling request aiming at the API of the target interface version is initiated.
Therefore, by the technical scheme, the API with the lower interface version can be selected when the interface is called, and the API with the lower interface version is selected to initiate the interface calling request when the interface calling request is initiated, so that the problem of version incompatibility between the upper and lower-level data platforms is solved, when one data platform is upgraded, other data platforms do not need to be driven to be upgraded, and the maintenance cost of the data platform is saved.
The present application is described below with reference to specific embodiments and specific application scenarios.
Referring to fig. 2, fig. 2 is a flowchart illustrating an interface calling method according to an exemplary embodiment, where the method is applied to a cascade module of the multi-level data cascade platform, where the cascade module stores a first interface version of the API maintained by the upper level data platform and a second interface version of the API maintained by the lower level data platform.
The first interface version may be in the form of a data table, a data dictionary, or the like, and may store interface versions of all APIs provided by the upper level data platform. Wherein the version identification may be used to determine the interface version of the API. The version identification may be in the form of a version number, a version code, or the like. When the version of the upper level data platform is upgraded, if the interface is changed, the version identification can be modified to distinguish different interface versions.
For example, as shown in the first interface version in table 1 below, the interface version number of interface 1 is 1.0.0, and the interface version number of interface 2 is 1.1.0.
API interface identification Interface version number
Interface 1 interface1 1.0.0
Interface 2 interface2 1.1.0
TABLE 1
Similarly, the second interface version may also be in the form of a data table, a data dictionary, or the like, and may store interface versions of all APIs maintained by the lower data platform, where the interface version of the API may also be determined using the version identifier. The version identification can be in the form of version number, version code, etc. When the version of the lower-level data platform is upgraded, if the interface is changed, the version identification can be modified to distinguish different interface versions.
For example, as shown in the second interface version shown in table 2 below, the interface version number of interface 1 is 1.0.1, and the interface version number of interface 2 is 1.0.1.
API interface identification Interface version number
Interface 1 interface1 1.0.1
Interface 2 interface2 1.0.0
TABLE 2
In one embodiment, the lower level data platform may time synchronize the second interface version to the upper level data platform. For example, after the data cascade platform is started, the second interface version maintained by the lower data platform may be synchronized to the cascade module at regular intervals of five days, ten days, and the like, so that the cascade module stores the second interface version locally for maintenance.
The above method may comprise the steps of:
step 202, receiving an interface call request, which is initiated by the lower data platform and is directed to a target API provided by the upper data platform.
In this specification, the target API may be an API interface provided by an upper platform that a lower data platform needs to call.
For example, the lower data platform needs to use interface a to obtain the data resource provided by the upper data platform, and interface a may be used as the target API.
The lower level data platform may initiate an interface call request for a target API provided by the upper level data platform. The interface call request may include an interface identifier of the target API, and related interface call parameters, and the like.
For example, the lower data platform needs to call an API interface a provided by the upper data platform, and may initiate an interface call request for the interface a to the cascade module, where the interface call request may include an interface identifier "interface a" of the interface a, a relevant call parameter (int a, int b), and the like.
Step 204, in response to the interface call request, determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API.
In this specification, the target interface version may be an interface version compatible with both the upper level data platform and the lower level data platform, for example, the interface version number of the interface a provided by the upper level data platform is 1.0.1, and the interface version number of the interface a docked by the lower level data platform is 1.0.0.0, and if the cascade module directly uses the interface version of 1.0.1, the problem of incompatibility may occur. For example, the call parameter of the 1.0.1 version of the interface a is (int a, int b, double c); and the call parameters of the 1.0.0 version of interface a are (int a, int b); since the calling parameter initiated by the lower data platform is the calling parameter of the 1.0.0 version, it is obvious that the cascade module directly uses the interface a of the 1.0.1 version.
After receiving an interface call request, initiated by a lower data platform, for a target API provided by the upper data platform, the cascade module may query a first interface version and a second interface version maintained by the cascade module to determine the target interface version of the target API requested to be called by the lower data platform.
The lower interface version of the first interface version and the second interface version corresponding to the target API may be determined as the target interface version of the target API.
For example, the cascade module queries that the interface version number of the interface a provided by the upper data platform is 1.0.1, and the interface version number of the interface a maintained by the lower data platform is 1.0.0. Since the interface of version 1.0.0 is compatible with the upper level data platform and the lower level data platform, version 1.0.0 can be used as the target interface version.
In one embodiment, when the version identifier of the second interface version is greater than the version identifier of the first interface version, determining the first interface version as a target interface version of a target API;
and when the version identification of the second interface version is smaller than the version identification of the first interface version, determining the second interface version as the target interface version of the target API.
When the version identifier of the second interface version is greater than the version identifier of the first interface version, it indicates that the interface version of the API maintained by the lower data platform is greater than the interface version of the API provided by the upper data platform, and at this time, the interface version of the API maintained by the upper data platform may be determined as the target interface version.
For example, when the cascade module queries that the interface version number of the second interface version of the interface a is 1.0.1, and the interface version number of the first interface version is 1.0.0, the first interface version maintained by the upper data platform may be determined as the target interface version.
And when the second interface version is smaller than the first interface version, the interface version of the API maintained by the lower data platform is smaller than the interface version of the API provided by the upper data platform. In this case, the interface version of the API maintained by the lower data platform may be determined as the target interface version.
For example, when the cascade module queries that the interface version number of the second interface version of the interface a is 1.0.0 and the interface version number of the first interface version is 1.0.1, the second interface version maintained by the lower data platform is determined as the target interface version.
In one embodiment, the lower data platform may be upgraded to add a portion of functionality, and the upper data platform is not upgraded, so that the API for this portion of functionality is not present. Therefore, when the lower data platform calls the API provided by the upper data platform, there may be a case where the target API does not exist. Therefore, when the interface version of the target API does not exist, the prompt information is returned to the lower data platform. For example, "the target function does not exist due to the version difference, please upgrade the version. "
Step 206, the interface call request is further submitted to the target API of the target interface version to complete the interface call for the target API.
After determining the target interface version of the target API, the cascade module may submit an interface call request to the target API of the target interface version, and initiate an interface call for the target API of the target interface version.
For example, when the target API is determined to be interface a and the target interface version is 1.0.0, an interface call request may be submitted to interface a of 1.0.0, and an interface call to interface a may be initiated.
In one embodiment, the cascade module locally stores interface codes of all historical versions of the API provided by the upper level data platform; the interface code corresponding to the target interface version can be searched from the interface codes of all historical versions;
and submitting the calling request to an interface code corresponding to the target interface version, and initiating interface calling of a target API aiming at the target interface version.
Because the cascade module stores the interface codes of all historical versions, when the interface version of the API maintained by the lower-level data platform is less than that of the API provided by the upper-level data platform, the interface calling request can be directly sent to submit the interface code corresponding to the target interface version, and the interface calling of the target API aiming at the target interface version is initiated, so that the interfaces of the upper-level and lower-level data platforms can be ensured to be completely compatible.
In an embodiment, a lower data platform may further obtain a first interface version maintained by an upper data platform, and a lower interface version of the first interface version and the second interface version is determined as a target interface version of the target API, and the lower data platform initiates an interface call request of the target interface version to the upper data platform.
Referring to fig. 3, fig. 3 is a flow diagram illustrating another example of a lower data platform initiating an interface call request,
step 302, the lower data platform responds to the interface call of the target API provided by the upper data platform, and obtains the first interface version of the API maintained by the upper data platform and maintained by the cascade module.
In this specification, the lower data platform may initiate an interface call request for a target API provided by the upper data platform, and may obtain a first interface version of the API provided by the upper data platform in advance before the call request.
For example, when the cascaded data platform is started, a request for acquiring the first interface version may be sent to the upper data platform, so that the upper data platform sends the first interface version to the lower data platform. Or after the cascade data platform is started, the first interface version can be synchronized from the superior data platform at regular time.
Step 304, determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API. In this specification, the target interface version may be an interface version compatible with both a higher-level data platform and a lower-level data platform, for example, an interface version number of an interface a provided by the higher-level data platform is 1.0.1, while the interface version number of the interface a is 1.0.0 by which the lower-level data platform is docked, and if the cascade module directly uses the interface version of 1.0.1, an incompatible problem may occur. For example, the call parameter of the 1.0.1 version of the interface a is (inta, int b, double c); and the call parameters of the 1.0.0 version of interface a are (int a, int b); since the calling parameter initiated by the lower data platform is the calling parameter of the 1.0.0 version, it is obvious that the cascade module directly uses the interface a of the 1.0.1 version.
When initiating an interface call request to an upper data platform, a lower data platform may obtain a first interface version maintained by the upper data platform, and determine a lower interface version of the first interface version and the second interface version as a target interface version of the target API.
For example, the interface version number of the interface a provided by the lower data platform to the upper data platform is 1.0.1, and the interface version number of the interface a maintained by the lower data platform is 1.0.0. Since the interface of version 1.0.0 is compatible with the upper level data platform and the lower level data platform, version 1.0.0 can be used as the target interface version.
In one embodiment, when the version identifier of the first interface version is greater than the version identifier of the second interface version, determining the second interface version as the target interface version of the target API;
and when the version identification of the first interface version is smaller than the version identification of the second interface version, determining the first interface version as the target interface version of the target API.
When the version identifier of the first interface version is greater than the version identifier of the second interface version, it indicates that the interface version of the API maintained by the higher-level data platform is greater than the interface version of the API provided by the lower-level data platform, and at this time, the interface version of the API maintained by the lower-level data platform may be determined as the target interface version.
For example, when the interface version number of the first interface version of the interface a obtained by the lower data platform and maintained by the upper data platform is 1.0.1, and the interface version number of the second interface version is 1.0.0, the second interface version maintained by the lower data platform may be determined as the target interface version.
When the version identifier of the first interface version is smaller than the version identifier of the second interface version, it indicates that the interface version of the API maintained by the upper data platform is smaller than the interface version of the API provided by the lower data platform, and at this time, the interface version of the API maintained by the upper data platform may be determined as the target interface version.
For example, the interface version number of the first interface version of the interface a, which is obtained by the lower data platform and maintained by the upper data platform, is 1.0.0, and the interface version number of the second interface version is 1.0.1, at this time, the first interface version maintained by the upper data platform may be determined as the target interface version.
And 304, responding to the determined target interface version, and initiating an interface calling request of a target API aiming at the target interface version to the superior data platform.
After determining the target interface version of the target API, the lower data platform may initiate an interface call request for the target API of the target interface version to the upper data platform. For example, when the target API is determined to be interface a and the target interface version is 1.0.0, an interface call request for interface a of the 1.0.0 version may be initiated to the upper data platform.
In one embodiment, the lower level data platform locally stores interface request codes for all historical versions of API interfaces provided by the upper level data platform; the interface request code corresponding to the target interface version can be searched from the interface request codes of all historical versions;
executing an interface request code corresponding to the target interface version, and initiating an interface call request aiming at the target API of the target interface version to the superior data platform.
Because the lower-level data platform locally stores interface request codes of all historical versions, when the interface version of the API maintained by the lower-level data platform is larger than the interface version of the API provided by the upper-level data platform, the interface call request aiming at the target API of the target interface version can be directly initiated through the interface request code corresponding to the target interface version, so that the interfaces of the upper-level and lower-level data platforms can be completely compatible.
In one embodiment, the lower level data platform may time synchronize the second interface version to the upper level data platform. For example, after the data cascade platform is started, the interface version maintained by the lower data platform may be synchronized to the cascade module at regular intervals of five days, ten days, and the like, so that the cascade module stores the second interface version locally for maintenance.
With the above embodiment, the first interface version of the API maintained by the upper data platform and the second interface version of the API maintained by the lower data platform are maintained in the cascade module, and the method is applied to the cascade module, and before a target interface is called, the first interface version and the second interface version of the target interface are compared, and a lower interface version is determined as the target interface version, thereby completing interface calling for the target API.
And meanwhile, the cascade module stores a first interface version of the API maintained by the upper-level data platform, the lower-level data platform maintains a second interface version of the API, and a lower interface version is determined as a target interface version before the lower-level data platform initiates an interface calling request, so that the interface calling request aiming at the API of the target interface version is initiated.
Therefore, by the technical scheme, the API with the lower interface version can be selected when the interface is called, and the API with the lower interface version is selected to initiate the interface calling request when the interface calling request is initiated, so that the problem of version incompatibility between the upper and lower data platforms is solved, when one data platform is upgraded, other data platforms do not need to be driven to be upgraded, and the maintenance cost of the data platform is saved.
Corresponding to the embodiment of the interface calling method, the specification also provides an embodiment of an interface calling device.
Referring to fig. 4, fig. 4 is a hardware structure diagram of an electronic device where an interface invoking device is located according to an exemplary embodiment. At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, although it may include hardware required for other services. One or more embodiments of the present description may be implemented in software, such as by processor 402 reading corresponding computer programs from non-volatile storage 410 into memory 408 and then executing. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Referring to fig. 5, fig. 5 is a block diagram of an interface invoking device according to an exemplary embodiment. The interface calling device can be applied to the electronic device shown in fig. 4 to implement the technical solution of the present specification. Wherein, the interface calling device may include:
a receiving request unit 502, configured to receive an interface call request, which is initiated by the lower data platform and is directed to a target API provided by the upper data platform;
an interface version determining unit 504, configured to determine, in response to the interface call request, a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
an interface calling unit 506, configured to submit the interface call request further to the target API of the target interface version, so as to complete an interface call for the target API.
In this embodiment, the cascade module stores a version identifier of a first interface version of the API maintained by the upper level data platform and a version identifier of a second interface version of the API maintained by the lower level data platform, and the interface version determining unit 504 is specifically configured to determine the first interface version as a target interface version of a target API when the version identifier of the second interface version is greater than the version identifier of the first interface version;
and when the version identification of the second interface version is smaller than that of the first interface version, determining the second interface version as a target interface version of a target API.
In this embodiment, the cascade module locally stores interface codes of all historical versions of an API interface provided by a higher-level data platform;
the interface calling unit 506: specifically, the method is used for searching the interface code corresponding to the target interface version from the interface codes of all the historical versions;
and submitting the interface calling request to an interface code corresponding to the target interface version so as to complete the interface calling of the target API aiming at the target interface version.
In this embodiment, the interface calling apparatus further includes an information prompting unit: and the system is used for returning prompt information to the lower data platform when the interface version of the target API does not exist.
In this embodiment, the interface calling apparatus further includes a timing synchronization unit: and the interface module is used for receiving the second interface version of the lower data platform timing synchronization and storing the second interface version locally for maintenance.
In this embodiment, the apparatus further includes a request initiating unit: the first interface version of the API maintained by the superior data platform and maintained by the cascade module is acquired in response to the interface call of the target API provided by the superior data platform;
determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and responding to the determined target interface version, and initiating an interface call request aiming at a target API of the target interface version to the superior data platform.
In this embodiment, the lower data platform locally stores interface request codes of all historical versions of an API provided by the upper data platform;
a request initiating unit, configured to search the interface request codes corresponding to the target interface version from the interface request codes of all historical versions;
executing an interface request code corresponding to the target interface version, and initiating an interface call request aiming at a target API of the target interface version to the superior data platform.
A request initiating unit, configured to specifically initiate an interface call request for a target API interface of the target interface version to the upper-level data platform, and send data information to a cascade module, so that the upper-level data platform obtains the data information through the target API interface, and/or;
and acquiring second data information sent by a superior data platform through the target API from the target API.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are only illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units 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 can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
This specification also provides an embodiment of a computer-readable storage medium. The computer readable storage medium stores machine readable instructions, which when called and executed by a processor, can implement the interface calling method provided by any one of the embodiments in this specification.
Embodiments of the present description provide computer-readable storage media that may include, but are not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magnetic-optical disks, ROMs (Read-Only memories), RAMs (Random Access memories), EPROMs (Erasable Programmable Read-Only memories), EEPROMs (Electrically Erasable Programmable Read-Only memories), flash memories, magnetic cards, or fiber optic cards. That is, a readable storage medium includes a readable medium that can store or transfer information.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein in one or more embodiments to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if," as used herein, may be interpreted as "at \8230; \8230when" or "when 8230; \823030when" or "in response to a determination," depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.

Claims (20)

1. The interface calling method is characterized in that the multi-stage data cascade platform comprises at least one upper-stage data platform and at least one lower-stage data platform; the lower data platform is cascaded with the upper data platform through a cascading module; an API provided by the superior data platform is used for the subordinate data platform to initiate interface call; the tandem module storing a first interface version of the API maintained by the upper level data platform and a second interface version of the API maintained by the lower level data platform, the method applied to the tandem module, the method comprising:
receiving an interface calling request which is initiated by the lower data platform and aims at a target API provided by the upper data platform;
in response to the interface calling request, determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and further submitting the interface calling request to a target API of the target interface version so as to complete the interface calling aiming at the target API.
2. The method of claim 1, wherein the tandem module stores a version identification of a first interface version of the API maintained by the superior data platform and a version identification of a second interface version of the API maintained by the inferior data platform;
the determining, as the target interface version of the target API, a lower interface version of the first interface version and the second interface version corresponding to the target API includes:
when the version identification of the second interface version is larger than that of the first interface version, determining the first interface version as a target interface version of a target API;
and when the version identification of the second interface version is smaller than the version identification of the first interface version, determining the second interface version as the target interface version of the target API.
3. The method of claim 1, wherein the cascade module locally stores interface code for all historical versions of APIs provided by the superior data platform;
the submitting the interface call request to the target API of the target interface version to complete the interface call to the target API comprises:
searching an interface code corresponding to the target interface version from the interface codes of all historical versions;
and submitting the interface calling request to an interface code corresponding to the target interface version so as to complete the interface calling of the target API aiming at the target interface version.
4. The method of claim 1, further comprising:
and receiving the second interface version of the lower data platform timing synchronization, and storing the second interface version locally for maintenance.
5. The method of claim 1, further comprising:
and when the interface version of the target API does not exist, returning prompt information to the lower-level data platform.
6. The method of claim 1, further comprising:
the lower data platform responds to the interface call of a target API provided by the upper data platform, and acquires a first interface version of the API maintained by the upper data platform and maintained by the cascade module;
determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and responding to the determined target interface version, and initiating an interface call request aiming at a target API of the target interface version to the superior data platform.
7. The method of claim 6, wherein the tandem module stores a version identification of a first interface version of the API maintained by the superior data platform, and wherein the inferior data platform maintains a version identification of a second interface version of the API;
the determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API includes:
when the version identification of the first interface version is larger than that of the second interface version, determining the second interface version as a target interface version of the target API;
and when the version identification of the first interface version is smaller than that of the second interface version, determining the first interface version as a target interface version of the target API.
8. The method of claim 6, wherein the subordinate data platform locally stores interface request codes for all historical versions of APIs provided by the superior data platform;
the responding to the determined target interface version, initiating an interface call request aiming at the target API of the target interface version to the superior data platform, and including:
searching an interface request code corresponding to the target interface version from the interface request codes of all historical versions;
executing an interface request code corresponding to the target interface version, and initiating an interface call request aiming at the target API of the target interface version to the superior data platform.
9. The method of claim 6, further comprising:
and synchronizing the second interface version to the cascade module at regular time so that the cascade module stores the second interface version locally for maintenance.
10. An interface calling device is characterized in that a multi-stage data cascade platform comprises at least one upper data platform and at least one lower data platform; the lower level data platform is cascaded with the upper level data platform through a cascading module; an API provided by the superior data platform is used for the subordinate data platform to initiate interface call; said tandem module storing a first interface version of said API maintained by said superior data platform and a second interface version of said API maintained by said inferior data platform, said apparatus being applied to said tandem module, said apparatus comprising:
a receiving request unit, configured to receive an interface call request, which is initiated by the lower data platform and is directed to a target API provided by the upper data platform;
an interface version determining unit, configured to determine, in response to the interface call request, a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and the interface calling unit is used for further submitting the interface calling request to the target API of the target interface version so as to complete the interface calling aiming at the target API.
11. The apparatus of claim 10, wherein the concatenation module stores a version identification of a first interface version of the API maintained by the superior data platform and a version identification of a second interface version of the API maintained by the inferior data platform;
the interface version determining unit is specifically configured to determine the first interface version as a target interface version of a target API when the version identifier of the second interface version is greater than the version identifier of the first interface version;
and when the version identification of the second interface version is smaller than that of the first interface version, determining the second interface version as a target interface version of a target API.
12. The apparatus of claim 10, wherein the concatenation module locally stores interface code for all historical versions of APIs provided by the superior data platform;
the interface calling unit is specifically configured to search the interface codes corresponding to the target interface version from the interface codes of all the historical versions;
and submitting the interface calling request to an interface code corresponding to the target interface version so as to complete the interface calling of the target API aiming at the target interface version.
13. The apparatus of claim 10, further comprising:
and the timing synchronization unit is used for receiving the second interface version of the lower data platform timing synchronization and storing the second interface version in the local for maintenance.
14. The apparatus of claim 10, further comprising:
and the information prompting unit is used for returning prompting information to the lower-level data platform when the interface version of the target API does not exist.
15. The apparatus of claim 10, further comprising:
a request initiating unit, configured to, in response to an interface call for a target API provided by the superior data platform, the inferior data platform obtain a first interface version of the API maintained by the superior data platform and maintained by the cascade module;
determining a lower interface version of the first interface version and the second interface version corresponding to the target API as a target interface version of the target API;
and responding to the determined target interface version, and initiating an interface calling request aiming at the target API of the target interface version to the superior data platform.
16. The apparatus of claim 15, wherein the concatenation module stores a version identification of a first interface version of the API maintained by the superior data platform, and wherein the inferior data platform maintains a version identification of a second interface version of the API;
the request initiating unit is specifically configured to determine the second interface version as the target interface version of the target API when the version identifier of the first interface version is greater than the version identifier of the second interface version;
and when the version identification of the first interface version is smaller than that of the second interface version, determining the first interface version as a target interface version of the target API.
17. The apparatus of claim 15, wherein the lower level data platform locally stores interface request codes for all historical versions of APIs provided by the upper level data platform;
the request initiating unit is specifically configured to search the interface request codes corresponding to the target interface version from the interface request codes of all the historical versions;
executing an interface request code corresponding to the target interface version, and initiating an interface call request aiming at the target API of the target interface version to the superior data platform.
18. The apparatus of claim 15, further comprising:
and the timing synchronization unit is used for synchronizing the second interface version to the cascade module at regular time so that the cascade module stores the second interface version locally for maintenance.
19. An electronic device is characterized by comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are mutually connected through the bus;
the memory has stored therein machine-readable instructions, which the processor executes by calling to perform the method of any one of claims 1-9.
20. A computer-readable storage medium having stored thereon machine-readable instructions which, when invoked and executed by a processor, implement the method of any of claims 1-9.
CN202211111625.6A 2022-09-13 2022-09-13 Interface calling method and device, electronic equipment and readable storage medium Pending CN115480816A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211111625.6A CN115480816A (en) 2022-09-13 2022-09-13 Interface calling method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211111625.6A CN115480816A (en) 2022-09-13 2022-09-13 Interface calling method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115480816A true CN115480816A (en) 2022-12-16

Family

ID=84392422

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211111625.6A Pending CN115480816A (en) 2022-09-13 2022-09-13 Interface calling method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115480816A (en)

Similar Documents

Publication Publication Date Title
US11626972B2 (en) Data processing method and apparatus
CN107688500B (en) Distributed task processing method, device, system and equipment
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN109598407B (en) Method and device for executing business process
CN113220717B (en) Block chain-based data verification method and device and electronic equipment
CN109885612B (en) Synchronous validation method and device for intelligent contracts of block chains
CN115002228B (en) Service cascade calling method and device, electronic equipment and storage medium
CN114884962B (en) Load balancing method and device and electronic equipment
KR20180109921A (en) Data storage and service processing methods and devices
CN114020444B (en) Calling system and method for resource service application in enterprise digital middle station
CN113888173B (en) Intelligent contract calling method, device and equipment based on block chain
CN111651467A (en) Block chain link point interface issuing and calling method and device
CN115480816A (en) Interface calling method and device, electronic equipment and readable storage medium
CN111880895A (en) Data reading and writing method and device based on Kubernetes platform
CN112631648A (en) Service configuration method and device, electronic equipment and storage medium
CN111782346A (en) Distributed transaction global ID generation method and device based on same-library mode
CN112596741B (en) Video monitoring service deployment method and device
CN111506577B (en) Data operation method and device based on multiple state organization modes on block chain
CN112988460B (en) Data backup method and device for virtual machine
CN110321250B (en) Disaster recovery method and device for application
CN116700841B (en) Method and device for calling native API (application program interface)
CN116701349A (en) Data migration method, system, equipment and storage medium
CN118034773A (en) Function version management method and device based on SaaS platform
CN116541397A (en) State data query method and device
CN115840768A (en) Data processing method, device, equipment and 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