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

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

Info

Publication number
CN115185717B
CN115185717B CN202211113731.8A CN202211113731A CN115185717B CN 115185717 B CN115185717 B CN 115185717B CN 202211113731 A CN202211113731 A CN 202211113731A CN 115185717 B CN115185717 B CN 115185717B
Authority
CN
China
Prior art keywords
interface
request
configuration information
target interface
target
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.)
Active
Application number
CN202211113731.8A
Other languages
Chinese (zh)
Other versions
CN115185717A (en
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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202211113731.8A priority Critical patent/CN115185717B/en
Publication of CN115185717A publication Critical patent/CN115185717A/en
Application granted granted Critical
Publication of CN115185717B publication Critical patent/CN115185717B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure relates to an interface calling method, an interface calling device, an electronic device and a storage medium. The method comprises the following steps: acquiring a first interface calling request generated based on a general request format, and determining a target interface for the first interface calling request; acquiring first configuration information for configuring interface parameters of a target interface; acquiring a request parameter associated with a target interface from the first interface calling request according to the first configuration information, and generating a second interface calling request based on the request parameter associated with the target interface; and calling the target interface through the two interface calling requests. According to the method and the device, the relevant request parameters can be obtained based on the first configuration information corresponding to the target interface, the second interface calling request corresponding to the target interface is generated, codes corresponding to the interface are prevented from being re-developed, calling of the interface can be achieved only by adding the corresponding configuration information when a new interface needs to be introduced, and interface calling efficiency is effectively improved.

Description

Interface calling method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an interface calling method and apparatus, an electronic device, and a storage medium.
Background
With the development of computer technology, interaction between different systems is increasingly frequent, and in the data processing process of a platform, specific data is often acquired from an external interface provided by other equipment or systems.
In the related art, the interfaces of the external system are various, and the data formats or data processing logics provided by different interfaces are different, so when an interface to be accessed is newly added to the platform, corresponding codes are adaptively developed for the interface, for example, corresponding subclasses are developed, then the original codes of the platform are modified, the newly developed codes are added to the codes, and in the subsequent data processing process, the corresponding interfaces can be called by means of the newly added codes.
However, in the above method, each time a new interface is added, the platform code needs to be adjusted, which causes corresponding processes such as code development, verification, joint debugging and the like, and has a problem of low interface calling efficiency.
Disclosure of Invention
The present disclosure provides an interface calling method, an interface calling apparatus, an electronic device, and a storage medium, so as to at least solve the problem of low interface calling efficiency in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an interface calling method, including:
acquiring a first interface calling request generated based on a general request format, and determining a target interface to which the first interface calling request aims;
acquiring first configuration information for configuring interface parameters of the target interface;
acquiring a request parameter associated with the target interface from the first interface calling request according to the first configuration information, and generating a second interface calling request based on the request parameter associated with the target interface;
and calling the target interface through the second interface calling request.
In one embodiment, the invoking the target interface through the second interface call request includes:
sending the second interface calling request to the target interface, and receiving response data returned by the target interface aiming at the second interface calling request;
analyzing the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
In one embodiment, the parsing the response data based on the second configuration information of the target interface to obtain a parsing result includes:
obtaining an expression analysis engine at least storing second configuration information of the target interface;
inputting the interface identifier of the target interface and the response data into the expression analysis engine, determining the second configuration information associated with the interface identifier by the expression analysis engine, and analyzing the response data based on the second configuration information to obtain an analysis result.
In one embodiment, before the obtaining the first interface call request generated based on the generic request format, the method further includes:
acquiring a data analysis script corresponding to the target interface; the data analysis script comprises a response data analysis rule corresponding to the target interface;
and importing the data analysis script corresponding to the target interface as second configuration information into an expression analysis engine.
In one embodiment, the obtaining first configuration information for configuring interface parameters of the target interface includes:
and acquiring an interface identifier corresponding to the target interface, and acquiring configuration information associated with the interface identifier from a parameter configuration server as first configuration information for configuring interface parameters of the target interface.
In one embodiment, before the obtaining the first interface call request generated based on the common request format, the method further includes:
acquiring an interface identifier, a request parameter and an interface access address corresponding to the target interface, and generating first configuration information of the target interface according to the request parameter and the interface access address;
and storing the first configuration information and the interface identifier corresponding to the target interface in a parameter configuration server in an associated manner.
According to a second aspect of the embodiments of the present disclosure, there is provided an interface calling apparatus, including:
the interface determining unit is configured to execute acquiring a first interface calling request generated based on a general request format and determine a target interface to which the first interface calling request aims;
a first configuration information acquisition unit configured to perform acquisition of first configuration information for configuring interface parameters of the target interface;
the request generation unit is configured to acquire a request parameter associated with the target interface from the first interface calling request according to the first configuration information, and generate a second interface calling request based on the request parameter associated with the target interface;
an interface calling unit configured to perform calling the target interface through the second interface call request.
In one embodiment, the interface call unit includes:
the request sending module is configured to execute sending of the second interface calling request to the target interface and receive response data returned by the target interface for the second interface calling request;
the response data analysis module is configured to analyze the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the interface call method as in any above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform any one of the interface calling methods described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which includes instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the interface call method according to any one of the above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the method and the device, a first interface calling request generated based on a general request format can be obtained, a target interface to which the first interface calling request aims is determined, then first configuration information used for configuring interface parameters of the target interface can be obtained, request parameters related to the target interface are obtained from the first interface calling request according to the first configuration information, a second interface calling request is generated based on the request parameters related to the target interface, and the target interface is called through the second interface calling request. In the scheme, the target interface can be triggered to be called based on the first interface calling request generated according to the general request format, and when the target interface is called, the relevant request parameters can be obtained based on the first configuration information corresponding to the target interface and the second interface calling request corresponding to the target interface is generated, so that codes corresponding to the interface are prevented from being redeveloped, the interface can be called only by adding the corresponding configuration information when a new interface is required to be introduced, the development cost is saved, and the interface calling efficiency is effectively improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flowchart illustrating an interface call method in accordance with an exemplary embodiment.
FIG. 2 is a flowchart illustrating interface response data parsing steps according to an exemplary embodiment.
FIG. 3 is a flowchart illustrating steps for parsing response data by an expression parsing engine in accordance with an exemplary embodiment.
FIG. 4 is a flowchart illustrating another interface invocation method in accordance with an illustrative embodiment.
Fig. 5 is a block diagram illustrating an interface invocation apparatus according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating an electronic device in accordance with an example embodiment.
FIG. 7 is a block diagram illustrating another electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in other sequences than those illustrated or described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It should be further noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
Fig. 1 is a flowchart illustrating an interface calling method according to an exemplary embodiment, where this embodiment illustrates that the method is applied to a terminal, it is to be understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and is implemented through interaction between the terminal and the server. In this embodiment, the terminal may communicate with a plurality of interfaces, and when the terminal acquires a first interface call request generated based on a general request format, the terminal may determine a target interface to which the first interface call request is directed, and acquire first configuration information for configuring interface parameters of the target interface, and further may acquire, according to the first configuration information, request parameters associated with the target interface from the first interface call request, generate a second interface call request based on the request parameters associated with the target interface, and call the target interface through the second interface call request.
The terminal can be but is not limited to various personal computers, notebook computers, smart phones, tablet computers, internet of things equipment and portable wearable equipment, the internet of things equipment can be smart sound boxes, smart televisions, smart air conditioners, smart car-mounted equipment and the like, and the portable wearable equipment can be smart watches, smart bracelets, head-mounted equipment and the like; the server may be implemented as a stand-alone server or as a server cluster consisting of a plurality of servers. Illustratively, in the case that the present embodiment is applied to a terminal, a client may be deployed on the terminal, and the interface calling method in the present application is implemented by the client.
In this embodiment, the method includes the steps of:
in step S110, a first interface call request generated based on the generic request format is acquired, and a target interface to which the first interface call request is directed is determined.
In practical application, the terminal can communicate with a plurality of interfaces, and each interface can have corresponding request parameters and request formats; in the related art, adapted subclasses are often required to be developed for different interfaces, and a request is generated and an interface is called through the adapted subclasses.
Specifically, a general request format for triggering to invoke different interfaces may be preset, and the device may obtain an interface invocation request generated based on the general request format, for example, a user may input related parameters in the terminal according to the general request format, so that the terminal obtains the interface invocation request, and in order to facilitate distinguishing from subsequent other interface invocation requests, the interface invocation request generated according to the general request format is referred to as a first interface invocation request in this embodiment. It can be understood that, when different interfaces are triggered to be called, a user does not need to record request formats of different interfaces respectively, but can generate a first interface calling request through a uniform universal request format to trigger to call a specified interface.
After receiving the first interface call request, the terminal may parse the first interface call request, and determine an interface to be called by the first interface call request, that is, a target interface to which the first interface call request is directed.
In step S120, first configuration information for configuring interface parameters of a target interface is acquired.
The interface parameter may be a parameter related to the interface itself, and may include, for example, at least one of the following: interface name, interface access address, request parameter required for calling the interface, and request packaging format of the interface calling request.
In specific implementation, interface parameters of the interface can be set and stored in a configuration form, and when a new interface needs to be added, interface parameters corresponding to the new interface can be correspondingly added. In this step, after the target interface to which the first interface call request is directed is determined, the configuration information of the interface parameters for configuring the target interface may be obtained from at least one piece of configuration information stored in advance, so as to obtain the first configuration information.
In step S130, according to the first configuration information, a request parameter associated with the target interface is obtained from the first interface call request, and a second interface call request is generated based on the request parameter associated with the target interface.
Specifically, since the first configuration information may record a specific configuration manner of the target interface parameters, after the first configuration information is obtained, the request parameters associated with the target interface may be determined from the first interface invocation request according to the first configuration information, and the determined request parameters associated with the target interface may be encapsulated in combination with the first configuration information to generate a new interface invocation request, where the interface invocation request may be referred to as a second interface invocation request. Specifically, for example, the first configuration information may record a request parameter and a request encapsulation format required for invoking the target interface, after the first configuration information is obtained, the request parameter required for invoking the target interface may be determined according to the first configuration information, then the request parameter associated with the target interface is extracted from the first interface invocation request, and the extracted request parameter is encapsulated according to the request encapsulation format in the first configuration information, so as to generate the second interface invocation request.
In other words, in this embodiment, when an interface call request corresponding to a specified interface is generated for the specified interface, it is not necessary to develop an adaptive subclass for the interface in advance and generate the interface call request by running the subclass when the interface is called, but a generation manner of parameters and a related interface call request that are needed when the specified interface is called may be determined by analyzing configuration information corresponding to the interface, and further, when an interface for terminal communication needs to be adjusted (for example, a new interface is added or an original interface is deleted), the configuration information corresponding to the interface may be conveniently and quickly adjusted (for example, configuration information of a new interface is added or configuration information of an original interface is deleted).
In step S140, the target interface is called by the second interface call request.
After the second interface calling request is generated based on the first configuration information, the target interface can be called through the second interface.
In the interface calling method, a first interface calling request generated based on a general request format can be acquired, a target interface to which the first interface calling request is directed is determined, then first configuration information for configuring interface parameters of the target interface can be acquired, request parameters associated with the target interface are acquired from the first interface calling request according to the first configuration information, a second interface calling request is generated based on the request parameters associated with the target interface, and the target interface is called through the second interface calling request. In the scheme, the target interface can be triggered to be called based on the first interface calling request generated according to the general request format, and when the target interface is called, the relevant request parameters can be obtained based on the first configuration information corresponding to the target interface and the second interface calling request corresponding to the target interface is generated, so that codes corresponding to the interface are prevented from being redeveloped, the interface can be called only by adding the corresponding configuration information when a new interface is required to be introduced, the development cost is saved, and the interface calling efficiency is effectively improved.
Moreover, according to the scheme of the disclosure, the interfaces of various different types can be modularly called by means of the configuration information, the number limit of interface extension is reduced, when the interface type or the platform framework is changed, the interface calling logic in the disclosure can be reused to call the interfaces, the universality is strong, and therefore, the stability of the platform in the interface introducing process is guaranteed, the interface introducing risk is reduced, and the number of the accessible interfaces is remarkably increased.
In an exemplary embodiment, as shown in fig. 2, the invoking of the target interface by the second interface call request in step S140 may include the following steps:
in step S210, a second interface call request is sent to the target interface, and response data returned by the target interface for the second interface call request is received.
In a specific implementation, after the second interface call request of the target interface is obtained, the second interface request may be sent to the target interface. In an optional embodiment, the first configuration information of the target interface may store an interface access address corresponding to the target interface, where the interface access address may also be referred to as an interface request address, and may be understood as an address for implementing access or call to the interface, and after obtaining the second interface call request of the target interface, the interface access address of the target interface may be obtained from the first configuration information, and the second interface call request is sent to the interface access address.
After receiving the second interface call request, the target interface may obtain the relevant response data according to the second interface call request, for example, if the target interface is an access type interface, after receiving the second interface call request, the target interface may use the relevant data in the database as the response data, and then the target interface may return the response data to the terminal.
In step S220, analyzing the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
In practical applications, when the data formats of response data returned by different interfaces are different, it may be difficult to obtain a correct analysis result if the same analysis rule is used for analysis.
In this embodiment, corresponding second configuration information may be configured in advance for each interface, and the second configuration information may store a response data analysis rule of the corresponding interface, so that after receiving the response data returned by the target interface, the response data may be analyzed through the response data analysis rule set in the second configuration information of the target interface, and an analysis result is obtained.
In this embodiment, the parsing rule of the interface response data may be set in a configuration manner, and the response data of the target interface is parsed based on the second configuration information, so that on one hand, an original structural framework of the platform may be maintained when an interface new parsing logic is introduced, thereby effectively improving the stability of the platform, and on the other hand, when the data format or the parsing logic of the response data changes, the second configuration information of the interface may be modified correspondingly, thereby implementing fast adaptation of the parsing rule of the response data.
In an exemplary embodiment, as shown in fig. 3, in step S220, parsing the response data based on the second configuration information of the target interface to obtain a parsing result may include the following steps:
s310, obtaining an expression analysis engine at least storing second configuration information of the target interface.
The expression analysis engine may also be referred to as an expression calculation engine or an expression engine, and can dynamically compile an expression into bytecode and run the bytecode.
In a specific implementation, at least the second configuration information of the target interface may be stored in the expression parsing engine, and in some examples, in a case that the terminal communicates with multiple interfaces, the expression parsing engine may store, in addition to the second configuration information of the target interface, the second configuration information of other interfaces. In this step, after receiving the response data returned by the target interface for the second time, the expression analysis engine may be obtained, for example, the expression analysis engine may be installed and started on the terminal.
S320, inputting the interface identifier of the target interface and the response data into an expression analysis engine, determining second configuration information associated with the interface identifier by the expression analysis engine, and analyzing the response data based on the second configuration information to obtain an analysis result.
Each response data analysis rule stored in the expression analysis engine can be associated with a corresponding interface through an interface identifier, after the expression analysis engine is obtained, the interface identifier of a target interface can be determined, the interface identifier and returned response data are input into the expression analysis engine, then the expression analysis engine can determine that the currently input response data come from the target interface based on the input interface identifier, obtain second configuration information of the target interface associated with the interface identifier, and analyze the response data based on the second configuration information to obtain an analysis result.
In this embodiment, through the second configuration information pre-configured in the expression analysis engine, modification of platform-related codes can be avoided, the platform stability is improved, response data returned by the target interface can be accurately analyzed, and the interface calling efficiency is improved.
In an exemplary embodiment, before step S110, the method may further include the steps of:
acquiring a data analysis script corresponding to a target interface; the data analysis script comprises a response data analysis rule corresponding to the target interface; and importing the data analysis script corresponding to the target interface as second configuration information into the expression analysis engine.
In a specific implementation, a user may determine an analysis rule of response data returned by the target interface, that is, a response data analysis rule, and may set a corresponding data analysis script as the data analysis script corresponding to the target interface according to the response data analysis rule.
Correspondingly, the terminal can acquire the data analysis script set for the target interface and import the data analysis script into the expression analysis engine as second configuration information, so that the expression analysis engine can acquire the second configuration information recorded with the target interface response data analysis logic.
In the implementation, the data analysis script corresponding to the target interface is imported into the expression analysis engine as the second configuration information, so that a user can complete the rapid configuration of different response data analysis logics in the expression analysis engine through the customized data analysis script, and the configuration efficiency of the second configuration information is improved.
In an exemplary embodiment, as shown in fig. 3, in step S120, acquiring first configuration information for configuring interface parameters of the target interface may include the following steps:
the method comprises the steps of obtaining an interface identifier corresponding to a target interface, obtaining configuration information associated with the interface identifier from a parameter configuration server, and using the configuration information as first configuration information for configuring interface parameters of the target interface.
The parameter configuration server may be a server that configures and stores interface parameters of the interface, and may be, for example, an interface registry or a metadata center for an RPC (Remote Procedure Call) interface.
In practical applications, after the target interface is determined, an interface identifier corresponding to the target interface may be obtained, where the interface identifier may also be referred to as an interface signature, and may be used to uniquely determine an interface. After the interface identifier of the target interface is obtained, the query can be performed at the parameter configuration server side through the interface identifier, and the configuration information associated with the interface identifier is obtained and used as the first configuration information for configuring the interface parameter of the target interface.
In other examples, when the target interface is called for the first time, the first configuration information acquired from the parameter configuration server may be stored locally, and then the first configuration information may be directly read from local data when the target interface is called for the next time without accessing the parameter configuration server again; of course, the first configuration information may also be obtained from the parameter configuration server every time the target interface is called or obtained from the parameter configuration server when the interface parameter update notification is received, so as to ensure the accuracy of the first configuration information.
In this embodiment, the configuration information provided by the parameter configuration server can be used to quickly configure the relevant parameters of the interface, so as to provide a basis for modularly invoking different interfaces.
In an exemplary embodiment, before step S110, the method may further include the steps of:
acquiring an interface identifier, a request parameter and an interface access address corresponding to a target interface, and generating first configuration information of the target interface according to the request parameter and the interface access address; and storing the first configuration information and the interface identifier corresponding to the target interface in a parameter configuration server in an associated manner.
In practical application, the relevant interface parameters of the target interface can be configured through the terminal. Specifically, an interface identifier, a request parameter, and an interface access address corresponding to the target interface may be obtained, so as to obtain an interface parameter of the target interface according to the request parameter and the interface access address, and generate first configuration information of the target interface according to the interface parameter, so as to associate and store the interface identifier of the target interface and the first configuration information to the parameter configuration server.
In this embodiment, first configuration information of the target interface may be generated according to the request parameter and the interface access address, and the first configuration information and the interface identifier corresponding to the target interface are stored in the parameter configuration server in an associated manner, so that a subsequent current terminal or other terminals can obtain corresponding first configuration information from the parameter configuration server according to the interface identifier.
In some embodiments, the interface calling method can be used for calling the interface in various different types of interfaces, can be applied to various service frameworks or protocol environments, and can be popularized and applied in a wider range.
In order to enable those skilled in the art to better understand the above steps, the embodiments of the present disclosure are illustrated below by way of an example, but it should be understood that the embodiments of the present disclosure are not limited thereto.
As shown in fig. 4, a user may generate a first interface call request for a target interface according to a general request format and input the first interface call request to a client (the client may also be referred to as a generalized call client), the client may analyze a request parameter in the first interface call request after receiving the first interface call request, and may determine an interface identifier and obtain an interface access address according to first configuration information of the interface when recognizing that the first interface call request is a call request for the target interface, and then splice related parameters in the first interface call request into request parameters in a preset format, and generate a second interface call request.
Furthermore, the client can send a second interface calling request to the interface according to the interface access address, and the interface can correspondingly analyze the request parameter in the request and return the relevant response data to the client. After receiving the response data, the client may invoke an expression parsing engine, where the engine may be preconfigured with second configuration information including a data parsing rule, and then may parse the returned response data through the expression parsing engine to obtain a parsing result.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
It is understood that the same/similar parts among the various embodiments of the method described above in this specification can be referred to each other, and each embodiment focuses on the differences from the other embodiments, and where relevant, reference may be made to the description of the other method embodiments.
Based on the same inventive concept, the embodiment of the present disclosure further provides an interface calling device for implementing the above-mentioned interface calling method.
Fig. 5 is a block diagram illustrating an interface invocation apparatus according to an exemplary embodiment. Referring to fig. 5, the apparatus includes an interface determining unit 501, a first configuration information acquiring unit 502, a request generating unit 503, and an interface calling unit 504.
An interface determining unit 501, configured to perform obtaining a first interface call request generated based on a generic request format, and determine a target interface to which the first interface call request is directed;
a first configuration information obtaining unit 502 configured to perform obtaining first configuration information for configuring interface parameters of the target interface;
a request generating unit 503 configured to execute obtaining a request parameter associated with the target interface from the first interface call request according to the first configuration information, and generate a second interface call request based on the request parameter associated with the target interface;
an interface calling unit 504 configured to perform calling the target interface by the second interface call request.
In an exemplary embodiment, the interface calling unit 504 includes:
the request sending module is configured to execute sending of the second interface calling request to the target interface and receive response data returned by the target interface for the second interface calling request;
the response data analysis module is configured to analyze the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
In an exemplary embodiment, the response data parsing module is configured to perform:
obtaining an expression analysis engine at least storing second configuration information of the target interface;
and inputting the interface identifier of the target interface and the response data into the expression analysis engine, determining the second configuration information associated with the interface identifier by the expression analysis engine, and analyzing the response data based on the second configuration information to obtain an analysis result.
In an exemplary embodiment, the apparatus further comprises:
the script acquisition unit is configured to execute the acquisition of the data analysis script corresponding to the target interface; the data analysis script comprises a response data analysis rule corresponding to the target interface;
and the analysis engine configuration unit is configured to execute importing the data analysis script corresponding to the target interface into an expression analysis engine as second configuration information.
In an exemplary embodiment, the first configuration information obtaining unit 502 is configured to perform:
and acquiring an interface identifier corresponding to the target interface, and acquiring configuration information associated with the interface identifier from a parameter configuration server as first configuration information for configuring interface parameters of the target interface.
In an exemplary embodiment, the apparatus further comprises:
the configuration information generation unit is configured to execute acquisition of an interface identifier, a request parameter and an interface access address corresponding to the target interface, and generate first configuration information of the target interface according to the request parameter and the interface access address;
and the interface configuration unit is configured to store the first configuration information and the interface identifier corresponding to the target interface in association to a parameter configuration server.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The modules in the interface calling device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
FIG. 6 is a block diagram illustrating an electronic device 600 for implementing an interface call method in accordance with an exemplary embodiment. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet device, a medical device, a fitness device, a personal digital assistant, and so forth.
Referring to fig. 6, electronic device 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, interface to input/output (I/O) 612, sensor component 614, and communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operations at the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.
Power supply component 606 provides power to the various components of electronic device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen providing an output interface between the electronic device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 600 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor component 614 may detect an open/closed state of the electronic device 600, the relative positioning of components, such as a display and keypad of the electronic device 600, the sensor component 614 may also detect a change in the position of the electronic device 600 or components of the electronic device 600, the presence or absence of user contact with the electronic device 600, orientation or acceleration/deceleration of the device 600, and a change in the temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the electronic device 600 to perform the above-described method is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided that includes instructions executable by the processor 620 of the electronic device 600 to perform the above-described method.
FIG. 7 is a block diagram illustrating an electronic device 700 for implementing an interface call method in accordance with an exemplary embodiment. For example, the electronic device 700 may be a server. Referring to fig. 7, electronic device 700 includes a processing component 720 that further includes one or more processors and memory resources, represented by memory 722, for storing instructions, such as applications, that are executable by processing component 720. The application programs stored in memory 722 may include one or more modules that each correspond to a set of instructions. Further, the processing component 720 is configured to execute instructions to perform the above-described methods.
The electronic device 700 may further include: a power supply component 724 is configured to perform power management for the electronic device 700, a wired or wireless network interface 726 is configured to connect the electronic device 700 to a network, and an input/output (I/O) interface 728. The electronic device 700 may operate based on an operating system stored in the memory 722, such as Windows Server, mac OS X, unix, linux, freeBSD, or the like.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as memory 722, that are executable by a processor of electronic device 700 to perform the above-described method is also provided. The storage medium may be a computer-readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, which comprises instructions executable by a processor of the electronic device 700 to perform the above-described method.
It should be noted that the descriptions of the above apparatus, the electronic device, the computer-readable storage medium, the computer program product, and the like according to the method embodiments may also include other embodiments, and specific implementation manners may refer to the descriptions of the related method embodiments, which are not described in detail herein.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An interface calling method, comprising:
acquiring a first interface calling request generated based on a general request format, and determining a target interface for the first interface calling request;
acquiring a plurality of pieces of pre-stored configuration information, wherein the configuration information comprises information which is acquired when an interface to be communicated is newly added and records an interface parameter configuration mode of the newly added interface;
acquiring first configuration information for configuring interface parameters of the target interface from the pre-stored configuration information;
reading the request parameter and the request packaging format required for calling the target interface recorded in the first configuration information, acquiring the request parameter associated with the request parameter required for calling the target interface from the first interface calling request, packaging the request parameter associated with the target interface based on the request packaging format recorded in the first configuration information, and generating a second interface calling request;
and calling the target interface through the second interface calling request.
2. The method of claim 1, wherein the invoking the target interface via the second interface call request comprises:
sending the second interface calling request to the target interface, and receiving response data returned by the target interface aiming at the second interface calling request;
analyzing the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
3. The method of claim 2, wherein the parsing the response data based on the second configuration information of the target interface to obtain a parsing result comprises:
obtaining an expression analysis engine at least storing second configuration information of the target interface;
and inputting the interface identifier of the target interface and the response data into the expression analysis engine, determining the second configuration information associated with the interface identifier by the expression analysis engine, and analyzing the response data based on the second configuration information to obtain an analysis result.
4. The method of claim 3, further comprising, prior to the obtaining the first interface call request generated based on the generic request format:
acquiring a data analysis script corresponding to the target interface; the data analysis script comprises a response data analysis rule corresponding to the target interface;
and importing the data analysis script corresponding to the target interface into an expression analysis engine as second configuration information.
5. The method of claim 1, wherein obtaining first configuration information for configuring interface parameters of the target interface comprises:
and acquiring an interface identifier corresponding to the target interface, and acquiring configuration information associated with the interface identifier from a parameter configuration server as first configuration information for configuring interface parameters of the target interface.
6. The method of claim 5, further comprising, prior to the obtaining the first interface call request generated based on the generic request format:
acquiring an interface identifier, a request parameter and an interface access address corresponding to the target interface, and generating first configuration information of the target interface according to the request parameter and the interface access address;
and storing the first configuration information and the interface identifier corresponding to the target interface in a parameter configuration server in an associated manner.
7. An interface invocation apparatus, comprising:
the interface determining unit is configured to execute acquiring a first interface calling request generated based on a general request format and determine a target interface to which the first interface calling request aims;
a first configuration information acquisition unit configured to perform acquisition of a plurality of pieces of configuration information stored in advance, where the configuration information includes information obtained when an interface to be communicated is newly added and in which an interface parameter configuration mode of the newly added interface is recorded; acquiring first configuration information for configuring interface parameters of the target interface from the pre-stored configuration information;
a request generating unit, configured to read the request parameter and the request encapsulation format required for invoking the target interface and recorded in the first configuration information, obtain the request parameter associated with the request parameter required for invoking the target interface from the first interface invocation request, encapsulate the request parameter associated with the target interface based on the request encapsulation format recorded in the first configuration information, and generate a second interface invocation request;
an interface calling unit configured to perform calling the target interface through the second interface call request.
8. The apparatus of claim 7, wherein the interface call unit comprises:
the request sending module is configured to execute sending of the second interface calling request to the target interface and receive response data returned by the target interface for the second interface calling request;
the response data analysis module is configured to analyze the response data based on the second configuration information of the target interface to obtain an analysis result; the second configuration information is used for configuring a response data analysis rule of the target interface.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the interface call method of any of claims 1 to 6.
10. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the interface call method of any of claims 1-6.
CN202211113731.8A 2022-09-14 2022-09-14 Interface calling method and device, electronic equipment and storage medium Active CN115185717B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211113731.8A CN115185717B (en) 2022-09-14 2022-09-14 Interface calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211113731.8A CN115185717B (en) 2022-09-14 2022-09-14 Interface calling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115185717A CN115185717A (en) 2022-10-14
CN115185717B true CN115185717B (en) 2023-01-20

Family

ID=83524540

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211113731.8A Active CN115185717B (en) 2022-09-14 2022-09-14 Interface calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115185717B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115878630B (en) * 2023-02-01 2023-06-23 天翼云科技有限公司 Custom interface calling method and device, electronic equipment and storage medium
CN117009110A (en) * 2023-08-30 2023-11-07 中国人民解放军陆军工程大学 Interface dynamic calling method based on description information

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105635151A (en) * 2015-12-31 2016-06-01 深圳中兴网信科技有限公司 Open platform access method and open platform access system
WO2018201978A1 (en) * 2017-05-04 2018-11-08 平安科技(深圳)有限公司 Interface call data processing method, apparatus, computer device and storage medium
CN111427570A (en) * 2020-02-27 2020-07-17 中国平安人寿保险股份有限公司 Intelligent interface processing method and device
CN111638983A (en) * 2020-05-28 2020-09-08 深圳壹账通智能科技有限公司 Interface calling method, interface calling device and terminal equipment
CN112099964A (en) * 2019-06-18 2020-12-18 北京思源政通科技集团有限公司 Interface calling method and device, storage medium and electronic device
CN112835782A (en) * 2020-12-22 2021-05-25 北京健康之家科技有限公司 Interface access test method and system
CN114237931A (en) * 2021-12-13 2022-03-25 平安证券股份有限公司 Configuration method and device for interface call, computer equipment and storage medium
CN114398191A (en) * 2021-12-23 2022-04-26 杭州安恒信息技术股份有限公司 Remote service calling method, system, computer equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112532564B (en) * 2019-09-17 2022-09-13 中国移动通信集团广东有限公司 Service calling method and device and electronic equipment
CN111026797A (en) * 2019-12-02 2020-04-17 卫盈联信息技术(深圳)有限公司 Service data processing method, server and storage medium
CN111930534A (en) * 2020-07-29 2020-11-13 北京字节跳动网络技术有限公司 Data calling method and device and electronic equipment
CN113467855B (en) * 2021-06-24 2024-03-19 北京达佳互联信息技术有限公司 Webpage request processing method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105635151A (en) * 2015-12-31 2016-06-01 深圳中兴网信科技有限公司 Open platform access method and open platform access system
WO2018201978A1 (en) * 2017-05-04 2018-11-08 平安科技(深圳)有限公司 Interface call data processing method, apparatus, computer device and storage medium
CN112099964A (en) * 2019-06-18 2020-12-18 北京思源政通科技集团有限公司 Interface calling method and device, storage medium and electronic device
CN111427570A (en) * 2020-02-27 2020-07-17 中国平安人寿保险股份有限公司 Intelligent interface processing method and device
CN111638983A (en) * 2020-05-28 2020-09-08 深圳壹账通智能科技有限公司 Interface calling method, interface calling device and terminal equipment
CN112835782A (en) * 2020-12-22 2021-05-25 北京健康之家科技有限公司 Interface access test method and system
CN114237931A (en) * 2021-12-13 2022-03-25 平安证券股份有限公司 Configuration method and device for interface call, computer equipment and storage medium
CN114398191A (en) * 2021-12-23 2022-04-26 杭州安恒信息技术股份有限公司 Remote service calling method, system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115185717A (en) 2022-10-14

Similar Documents

Publication Publication Date Title
CN115185717B (en) Interface calling method and device, electronic equipment and storage medium
CN107395624B (en) Information processing method and device
CN107463372B (en) Data-driven page updating method and device
CN105530129B (en) Router resetting method and device
CN110852163A (en) Binding method and device
CN110704030A (en) Interface configuration information generation method and device, electronic equipment and storage medium
CN110865823B (en) Pre-installation application control method, pre-installation application control device and storage medium
CN109885360B (en) Data processing method, device and storage medium
CN111221593A (en) Dynamic loading method and device
CN107122174B (en) Application program updating method and device
CN112860625B (en) Data acquisition method, data storage method, device, equipment and storage medium
CN110989987B (en) Portal webpage generation method and device, client, server and storage medium
CN113778687A (en) Memory allocation information processing method and device, electronic equipment and storage medium
CN112631695A (en) Data verification method and device, electronic equipment and storage medium
CN111597106A (en) Point burying management method and device
CN111240735B (en) Application packaging method, application packaging device and storage medium
CN110995767B (en) Request processing method and device
CN107992333B (en) Theme acquisition method and device
CN110347394B (en) Software code analysis method and device
CN107784224B (en) Permission adaptation method and device and electronic equipment
CN108173846B (en) Login method and device
CN115828881A (en) Data template generation method and device, electronic equipment and storage medium
CN117093486A (en) Interface testing method, device, equipment and storage medium
CN114138289A (en) Component issuing method and device, electronic equipment and storage medium
CN115455007A (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
GR01 Patent grant
GR01 Patent grant