CN113766030B - Automatic parameter entering method and device for interface constant parameters - Google Patents

Automatic parameter entering method and device for interface constant parameters Download PDF

Info

Publication number
CN113766030B
CN113766030B CN202111069304.XA CN202111069304A CN113766030B CN 113766030 B CN113766030 B CN 113766030B CN 202111069304 A CN202111069304 A CN 202111069304A CN 113766030 B CN113766030 B CN 113766030B
Authority
CN
China
Prior art keywords
parameter
request
constant
interface
user request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111069304.XA
Other languages
Chinese (zh)
Other versions
CN113766030A (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.)
CCI China Co Ltd
Original Assignee
CCI China 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 CCI China Co Ltd filed Critical CCI China Co Ltd
Priority to CN202111069304.XA priority Critical patent/CN113766030B/en
Publication of CN113766030A publication Critical patent/CN113766030A/en
Application granted granted Critical
Publication of CN113766030B publication Critical patent/CN113766030B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides an interface constant parameter automatic parameter entering method, which comprises the following steps: the API gateway obtains a user request; calling the user to request a corresponding API interface and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules; and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message, wherein the technical scheme of realizing automatic parameter entering of interface constant parameters in an API gateway based on a third party request is realized.

Description

Automatic parameter entering method and device for interface constant parameters
Technical Field
The application relates to the field of gateway interfaces, in particular to an interface constant parameter automatic parameter entering method and device.
Background
API (Application Programming Interface) is also known as an application programming interface, which is a number of predefined functions that are intended to provide the ability for applications and developers to access a set of routines based on certain software or hardware, where a routine refers to a collection of functional interfaces or services that a certain system provides externally.
The API interface plays a very important role in the information intercommunication of the internet, and each platform or system needs to expose the API interface externally for a third party to use. Specifically, a third party needs to interface with a system or a platform by requesting a specific corresponding API interface, parameters of the API interfaces of different requesters are not completely the same, but some fixed constant request parameters often exist, and currently, the third party needs to manually fill all parameters of the API interface when requesting the API interface, so that the calling efficiency is low.
Of course, in the prior art, there is also a scheme of performing interface templating on the API and forming a calling instance based on the templated interface template and combining dynamic data parameters, however, the data parameters in the scheme are still transmitted by the calling party and the service party, which solves the problem that only different types of dynamic data parameters are converted into a form in which the interface template can be fused, and for the calling party or the service party, various dynamic data parameters still need to be filled. In other words, the current solution still does not alleviate the workload of the caller or business.
Disclosure of Invention
The embodiment of the application provides an interface constant parameter automatic parameter entering method and device, which can realize automatic parameter entering of constant parameters fixed by an interface when the interface is called, and can specify the adding position of the constant parameters according to configuration rules, and a third party does not need to fill in the constant parameters of the interface when the interface is called, so that the user time is saved, and the user experience is improved.
In a first aspect, an embodiment of the present application provides an interface constant automatic joining method, where the method includes: the API gateway obtains a user request; calling the user to request a corresponding API interface and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules; and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message.
In a second aspect, an embodiment of the present application provides an interface constant automatic parameter entering method, including: sending a user request to an API gateway; the API gateway calls an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, the constant parameters are added to the appointed position of the user request based on the configuration rules, a request message is formed, and the returned data of a server side is requested based on the request message.
In a third aspect, an embodiment of the present application provides an interface constant parameter automatic parameter joining device, set in an API gateway, including: a user request acquisition unit for acquiring a user request; the configuration unit is used for calling the API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules; and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message.
In a fourth aspect, an embodiment of the present application provides an interface constant parameter automatic parameter joining device, which is set in a request end and an API gateway, including: a user request sending unit, configured to send a user request to the API gateway; the gateway processing unit is arranged in the API gateway and is used for calling an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, the constant parameters are added to the appointed position of the user request based on the configuration rules to form a request message, and the request message requests the returned data of a server side based on the request message; and the return data acquisition unit is used for acquiring the return data.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to run the computer program to perform any one of the above interface constant parameter auto-entry methods.
In a sixth aspect, embodiments of the present application provide a computer program product comprising software code portions for performing any of the above interface constant parameter auto-entry methods when the computer program product is run on a computer.
A seventh embodiment, an embodiment of the present application provides a readable storage medium having stored therein a computer program including program code for controlling a process to execute a process including executing any one of the above interface constant parameter auto-entry methods.
The main contributions and innovation points of the invention are as follows: the method comprises the steps that automatic entry of constant parameters of an API is achieved based on an API gateway, the API gateway stores an API interface corresponding to at least one route and constant parameter configuration information corresponding to the API interface, when a service request of a user has a corresponding route in the API gateway, the API gateway calls the constant parameter configuration information of the API interface corresponding to the route, constant parameters are added to a designated position of the service request based on the constant parameter configuration information, a complete request message is formed, and then a service end is requested based on the request message. In the scheme, the third party user does not need to fill in fixed constant parameters when requesting the API interface, but the API gateway realizes automatic parameter entry of the constant parameters of the API interface, and the adding position of the constant parameters can be adjusted lightly by adjusting the constant parameter configuration rule, so that the use experience of the third party user can be improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a schematic diagram of an operation framework of an interface constant parameter automatic parameter entering method according to an embodiment of the application.
Fig. 2 is a flow chart of an automatic parameter entry method for an interface according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a logic framework corresponding to the interface parameter automatic joining method of fig. 2 according to an embodiment of the present application.
Fig. 4 is a flow chart of an automatic parameter entry method for an interface according to another embodiment of the present application.
Fig. 5 is a schematic diagram of a logic framework corresponding to the interface parameter automatic joining method of fig. 4 according to an embodiment of the present application.
Fig. 6 is a flow chart of an automatic parameter entry method for an interface according to another embodiment of the present application.
Fig. 7 is a schematic diagram of an operation framework of the interface constant parameter automatic parameter entering method according to the embodiment of the present application in fig. 6.
Fig. 8 is a schematic diagram of a framework of an interface constant parameter auto-entry device according to an embodiment of the present application.
Fig. 9 is a schematic diagram of a framework of an interface constant parameter auto-entry device according to another embodiment of the present application.
Fig. 10 is a schematic diagram of a framework of an interface constant parameter auto-entry device according to another embodiment of the present application.
Fig. 11 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with aspects of one or more embodiments of the present description as detailed in the accompanying claims.
It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. Furthermore, individual steps described in this specification, in other embodiments, may be described as being split into multiple steps; while various steps described in this specification may be combined into a single step in other embodiments.
The application aims to provide a technical scheme capable of realizing automatic parameter entering of interface constant parameters in an API gateway based on a third party request, when the method is realized, constant parameter configuration information of an API interface is firstly configured, when a user request and a gateway route are matched, constant parameter configuration information of the API interface corresponding to the route is called, and the constant parameters of the API interface are automatically added to a designated position of the user request according to the constant parameter configuration information to form a new request message, so that a complete automatic parameter entering method of the constant parameters of the API interface is realized.
The embodiment of the application provides an automatic parameter entering method for interface constants, which can achieve the aim of interface constants, and specifically, referring to fig. 1, the automatic parameter entering method for interface constants is applied to a request end, an API gateway and a service end, wherein the request end refers to a terminal which is used by a third party user who wants to request an API interface, the third party user sends a user request to the API gateway at the request end, and the user request refers to a service request corresponding to various services and can exist in the form of an http request; the service end refers to a terminal providing business service data based on an API interface. In the scheme, a third party user uses a request terminal to send a user request to an API gateway, the API gateway reconfigures the user request based on constant parameter configuration information of an API interface after pre-judging the user request, generates a new complete request message, and requests data to a server terminal based on the request message. For convenience of explanation, the "user" will be referred to as "third party user" in the present embodiment, the user request of the user does not need to fill in constant parameters of the interface, so as to greatly save the time of the user.
Example 1
The scheme provides an interface constant parameter automatic parameter entering method, which is shown in fig. 2 and comprises the following steps:
the API gateway obtains a user request;
calling the user to request a corresponding API interface and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules;
and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message.
In the scheme, an API gateway acquires an incomplete user request, and repacks and configures the user request based on constant parameter configuration information corresponding to the user request to obtain a complete request message. The method has the advantages that the user request sent by the client does not need to fill in constant parameters corresponding to the API interface, so that the request time of the user can be saved to a great extent, and the user experience is optimized.
That is, the API gateway of the present solution obtains the user request from the requesting end without including the constant parameters of the corresponding API interface in the user request. In addition, it should be noted that the user request in this embodiment may refer to a specific service request.
The user request at least comprises url parameters, query parameters, body parameters and header parameters corresponding to the user request data, and in the embodiment of the scheme, the user request can exist in the form of an http request.
In some embodiments, the user requests to fill in the request parameters and parameter values, wherein the request parameters are filled in for the purpose of defining the parameter names to be added, and the parameter values are filled in for the purpose of defining the parameter values to be added.
"call the user request to the corresponding API interface and the constant parameter configuration information corresponding to the API interface" includes the steps of: judging whether the user request has a corresponding route in the API gateway, and if so, calling an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface. And correspondingly, if the user request does not have a corresponding route in the API gateway, returning error information to the client, and terminating the interface constant parameter automatic parameter entering method.
According to the scheme, whether the user request has a route in the API gateway is judged in advance, so that unnecessary calling of an API interface is reduced, available API interface resources are reserved for the user request really having demands, and resource waste of a server is reduced. That is, if the API gateway does not have a route corresponding to the user request, it is proved that the API gateway does not register a corresponding interface, and thus, it is not necessary to perform automatic parameter entry of the constant parameters of the subsequent interface. Conversely, if the user request has a route in the API gateway, it is known that the API gateway stores a corresponding API interface, and the API interface corresponds to at least one route.
In this scheme, "determining whether the user request has a corresponding route in the API gateway" includes the steps of: and the API gateway acquires the user request and traverses a route set, and matches the user request with the routes in the route set. More specifically, the url parameters of the user request and the route set may be matched to match whether a corresponding route exists.
In addition, the constant parameter configuration information of the API interface is synchronized to the API gateway after being configured, so that the constant parameter configuration information of the API interface can be conveniently changed or replaced. In this solution, the configuration rule includes: the constant parameters are the parameter contents which need to be configured into the original request, and the contents of the constant parameters exist in the form of constant parameter arrays. The configuration rule records a specific configuration mode.
Illustratively, some original request is:
General
ip:port/getage=10
Request headers
Token:sdfwersfsdrfwersfsd。
the configuration rules in the constant parameter configuration information of the API interface corresponding to the original request are as follows in table one:
list one
Parameters (parameters) Parameters (parameters) Value of
paramType Parameter type String
required Whether or not to fill true
paramName Parameter name name
paramLocation Parameter position query
paramValue Parameter value zhangsan
paramNote Parameter description User name
aramOrder Sequential order 1
The constant parameters are: userName, userTel.
The combined request is:
General
ip:port/getage=10&userName=zhangsan
Request headers
Token:sdfwersfsdrfwersfsd
userTel:13111111111。
"adding the constant parameter to the specified location of the user request based on the configuration rule" includes: analyzing the user request to obtain an initial request body object, creating a parameter object corresponding to the constant parameter according to the configuration rule, matching the types of the initial request body object and the parameter object, merging the parameter object and the initial request body object of the same type to obtain a configuration request body object, and forming the request message by the configuration request body object.
Specifically, the initial requester object includes multiple initial requester object subclasses of different types, in this scheme: the initial requestor object subclass includes: a url parameter request body object, a query parameter request body object, a body parameter request body object and a header parameter request body object corresponding to the user request; the body parameters in the body parameter request body are converted into json format data. This step is a scheme that allows for data in json format to support only elements whose element attributes are of the Object type and whose element attributes are of the Array type nested within each other.
Correspondingly, the parameter object comprises a plurality of parameter object subclasses with different types, and the types of the parameter object subclasses and the initial request body object subclasses are matched. Correspondingly, in some embodiments, the parameter object subclass includes at least one of a url parameter object, a query parameter object, a body parameter object, and a header parameter object. That is, the parameter object subclass does not necessarily need to include all types of the initial requestor object, and the parameter object subclass may be obtained according to a custom configuration rule.
In the scheme, the parameter object subclasses are obtained by processing the constant parameters according to the configuration rules, and different parameter object subclasses can be obtained corresponding to different configuration rules, so that the parameter object subclasses can be adjusted by modifying the content of the configuration rules, and further automatic parameter entry of interface constant parameters at the designated positions is realized.
"creating a parameter object corresponding to the constant parameter according to the configuration rule" includes the steps of: the parameter object comprises at least one parameter object subclass, and the constant parameters create corresponding parameter object subclasses according to the rules of the configuration rules. The configuration rule comprises parameter positions, parameter values, parameter names, parameter types and the like, and the configuration rule traverses the constant parameters to obtain parameter object subclasses.
The step of merging the parameter object and the corresponding initial request object to obtain the configuration request object includes: the parameter objects of the same type are merged with the corresponding initial request body object. More specifically, the parameter object subclass is combined with the parameter object of the initial request object subclass of the same type, the parameter object subclass is traversed, and the configuration request object is obtained in a summarizing mode.
The configuration requester object also includes a corresponding url parameter requester object, a query parameter requester object, a body parameter requester object, and a header parameter requester object, where the configuration requester object is different from the initial requester object in that: the parameters in the configuration request body object are already constant parameters included. The configuration request body object in the scheme is used as a new complete request message to be sent to the server side so as to request to return data.
In the scheme, the API gateway is selected as an SOUL gateway, the SOUL gateway is based on a java webflux framework, the processing of the request by the SOUL gateway is divided into a plurality of stages, each stage is provided with corresponding plug-in processing, paramyModifyPlugin plug-in processing user request analysis, interface constant parameter addition is carried out, and regeneration of a request message is carried out. In addition, it is worth to describe that the SOUL gateway adopts a database-free mode, and the API interface and the corresponding constant parameter configuration rule adopt a local cache.
As for the first embodiment, a logical block diagram is shown in fig. 4, and the present embodiment is briefly described with reference to fig. 4: firstly, after an API gateway obtains a user request, matching the user request with a route in a route set, if no matched route exists, directly returning error information to the API gateway, and if the matched route exists, calling an API interface corresponding to the route and corresponding constant parameter configuration information; the API gateway configures the user request based on the constant parameter configuration information to obtain a complete request message, and can send the request message to a server.
Example two
Based on the same conception, referring to fig. 4, the application further provides an interface constant parameter automatic parameter entering method, which comprises the following steps:
sending a user request to an API gateway;
the API gateway calls an API interface corresponding to a user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, the constant parameters are added to a designated position of the user request based on the configuration rules, a request message is formed, and return data of a server is requested based on the request message;
and acquiring the return data.
In the scheme, the user side sends a user request to the API gateway, wherein the user request does not comprise constant parameters corresponding to the API interface and can refer to a specific service request. The user request at least comprises url parameters, query parameters, body parameters and header parameters corresponding to the user request data, and in the embodiment of the scheme, the user request can exist in the form of an http request. In some embodiments, the user requests to fill in the request parameters and parameter values, the request parameters are filled in for the purpose of defining the parameter names, and the parameter values are filled in for the purpose of defining the parameter values.
The "the API gateway calls an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface" based on the user request includes the steps of: and the API gateway judges whether a route corresponding to the user request exists, and if so, calls an API interface corresponding to the route and constant parameter configuration information corresponding to the API interface. And correspondingly, if the user request does not have a corresponding route in the API gateway, returning error information to the client, and terminating the interface constant parameter automatic parameter entering method.
The API gateway determining whether there is a route corresponding to the user request includes the steps of: and the API gateway acquires the user request and traverses a route set, and matches the user request with the routes in the route set.
"adding the constant parameter to the specified location of the user request based on the configuration rule" includes: analyzing the user request to obtain an initial request body object, creating a parameter object corresponding to the constant parameter according to the configuration rule, matching the types of the initial request body object and the parameter object, merging the parameter object and the initial request body object of the same type to obtain a configuration request body object, and forming the request message by the configuration request body object. For the specific content of the API gateway for obtaining the request message based on the user request, reference may be made to the content of the first embodiment, and this scheme will not be described herein.
The step of acquiring the return data includes: and the API gateway returns the return data to the client.
A logical block diagram for the second embodiment is shown in fig. 5. This embodiment is briefly described with reference to fig. 5: firstly, a request end sends a user request to an API gateway, the API gateway judges whether a route matching the user request exists or not based on the user request, if not, error information is directly returned to the request end, if so, an API interface corresponding to the route and constant parameter configuration information are called, and constant parameters are added to a designated position of the user request based on configuration rules to form a request message; the request message is sent to the server to acquire the return data, and the return data is returned to the request terminal.
Example III
Based on the same conception, referring to fig. 6, the application also provides an interface constant parameter automatic parameter entering method, which comprises the following steps:
the client sends a user request to the API gateway;
the API gateway acquires the user request, calls an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, adds the constant parameters to the appointed position of the user request based on the configuration rules to form a request message, and sends the request message to a server;
and the server returns data based on the request message.
The contents of the solution related to the third embodiment are the same as those of the first embodiment or the second embodiment, and a detailed description thereof is omitted.
As shown in fig. 7, a logic operation block diagram of an interface constant parameter automatic parameter entering method according to the embodiment of the present invention is shown. This embodiment is briefly described with reference to fig. 7: an API interface is first created by a developer and constant parameter configuration information corresponding to the API interface is configured, the API interface being synchronized into an API gateway. At this time, the request end sends a user request to the API gateway, the API gateway judges whether a route corresponding to the user request exists locally, if not, the API gateway directly returns error information to the request end, if so, the API gateway analyzes the user request, adds constant parameters to the appointed position of the user request based on configuration rules to generate a request message, and sends the request message to the server end to acquire return data, and returns the return data to the request end.
Example five
Based on the same conception, referring to fig. 8, the application further provides an automatic parameter entering device for interface constant parameters, which is arranged in an API gateway and comprises:
a user request acquiring unit 301, configured to acquire a user request;
a configuration unit 302, configured to call an API corresponding to the user request and constant parameter configuration information corresponding to the API, where the constant parameter configuration information includes constant parameters and configuration rules; and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message.
The content related to the automatic parameter entering device of the interface constant parameter can be referred to as the automatic parameter entering method of the interface constant parameter in the first embodiment, and the same content is not described in detail herein.
Example six
Based on the same conception, referring to fig. 9, the present application further provides an interface constant parameter automatic parameter entering device, which is set in a request end and an API gateway, and includes:
a user request sending unit 501, configured to send a user request to an API gateway;
the gateway processing unit 502 is configured to call an API corresponding to a user request and constant parameter configuration information corresponding to the API based on the user request, where the constant parameter configuration information includes a constant parameter and a configuration rule, add the constant parameter to a specified location of the user request based on the configuration rule, form a request packet, and request return data of a server based on the request packet;
a return data obtaining unit 503, configured to obtain the return data.
The content related to the automatic parameter entering device of the interface constant parameter can be referred to as the automatic parameter entering method of the interface constant parameter in the second embodiment, and the same content is not described in detail herein.
Example seven
Based on the same conception, referring to fig. 10, the present application further provides an automatic parameter entering device for interface constant parameters, which is disposed in a request end, an API gateway and a server end, and includes:
a client request sending unit 601, configured to send a user request to an API gateway;
the gateway configuration unit 602 is configured to obtain the user request, call an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface based on the user request, where the constant parameter configuration information includes constant parameters and configuration rules, add the constant parameters to a specified location of the user request based on the configuration rules, form a request packet, and send the request packet to a server;
the server data response unit 603 is configured to return data based on the request packet.
The content related to the automatic parameter entering device of the interface constant parameter can be referred to the automatic parameter entering method of the interface constant parameter in the third embodiment, and the same content is not described in detail herein.
Example IV
The present embodiment also provides an electronic device, referring to fig. 11, comprising a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to perform the steps in any of the above-mentioned interface constant parameter automatic parameter entering method embodiments.
In particular, the processor 402 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured to implement one or more integrated circuits of embodiments of the present application.
The memory 404 may include, among other things, mass storage 404 for data or instructions. By way of example, and not limitation, memory 404 may comprise a Hard Disk Drive (HDD), floppy disk drive, solid State Drive (SSD), flash memory, optical disk, magneto-optical disk, tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Memory 404 may include removable or non-removable (or fixed) media, where appropriate. Memory 404 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 404 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, memory 404 includes Read-only memory (ROM) and Random Access Memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or FLASH memory (FLASH) or a combination of two or more of these. The RAM may be Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM) where appropriate, and the DRAM may be fast page mode dynamic random access memory 404 (FPMDRAM), extended Data Output Dynamic Random Access Memory (EDODRAM), synchronous Dynamic Random Access Memory (SDRAM), or the like.
Memory 404 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions for execution by processor 402.
Processor 402 implements any of the interface constant parameter auto-entry methods described in the embodiments above by reading and executing computer program instructions stored in memory 404.
Optionally, the electronic apparatus may further include a transmission device 406 and an input/output device 408, where the transmission device 406 is connected to the processor 402 and the input/output device 408 is connected to the processor 402.
The transmission device 406 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through the base station to communicate with the internet. In one example, the transmission device 406 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
The input-output device 408 is used to input or output information. In this embodiment, the input information may be a service request for requesting various service services, and the output information may be a complete request message, return data, and the like.
Alternatively, in the present embodiment, the above-mentioned processor 402 may be configured to execute the following steps by a computer program:
the API gateway obtains a user request;
calling the user to request a corresponding API interface and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules;
and adding the constant parameters to the appointed position of the user request based on the configuration rule to form a request message.
Alternatively, in the present embodiment, the above-mentioned processor 402 may be configured to execute the following steps by a computer program:
sending a user request to an API gateway;
the API gateway calls an API interface corresponding to a user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, the constant parameters are added to a designated position of the user request based on the configuration rules, a request message is formed, and return data of a server is requested based on the request message;
and acquiring the return data.
Alternatively, in the present embodiment, the above-mentioned processor 402 may be configured to execute the following steps by a computer program:
the client sends a user request to the API gateway;
the API gateway acquires the user request, calls an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, adds the constant parameters to the appointed position of the user request based on the configuration rules to form a request message, and sends the request message to a server;
and the server returns data based on the request message.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and this embodiment is not repeated herein.
In general, the various embodiments may be implemented in hardware or special purpose circuits, software, logic or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software which may be executed by a controller, microprocessor or other computing device, although the invention is not limited thereto. While various aspects of the invention may be illustrated and described as block diagrams, flow charts, or using some other pictorial representation, it is well understood that these blocks, apparatus, systems, techniques or methods described herein may be implemented in, as non-limiting examples, hardware, software, firmware, special purpose circuits or logic, general purpose hardware or controller or other computing devices, or some combination thereof.
Embodiments of the invention may be implemented by computer software executable by a data processor of a mobile device, such as in a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets, and/or macros can be stored in any apparatus-readable data storage medium and they include program instructions for performing particular tasks. The computer program product may include one or more computer-executable components configured to perform embodiments when the program is run. The one or more computer-executable components may be at least one software code or a portion thereof. In addition, in this regard, it should be noted that any blocks of the logic flows as illustrated may represent program steps, or interconnected logic circuits, blocks and functions, or a combination of program steps and logic circuits, blocks and functions. The software may be stored on a physical medium such as a memory chip or memory block implemented within a processor, a magnetic medium such as a hard disk or floppy disk, and an optical medium such as, for example, a DVD and its data variants, a CD, etc. The physical medium is a non-transitory medium.
It should be understood by those skilled in the art that the technical features of the above embodiments may be combined in any manner, and for brevity, all of the possible combinations of the technical features of the above embodiments are not described, however, they should be considered as being within the scope of the description provided herein, as long as there is no contradiction between the combinations of the technical features.
The foregoing examples merely represent several embodiments of the present application, the description of which is more specific and detailed and which should not be construed as limiting the scope of the present application in any way. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (11)

1. An interface constant parameter automatic parameter entering method is characterized by comprising the following steps:
the API gateway obtains a user request, wherein the user request does not comprise constant parameters corresponding to an API interface, and the user request comes from a request end;
calling the user to request a corresponding API interface and constant parameter configuration information corresponding to the API interface, wherein the constant parameter configuration information comprises constant parameters and configuration rules; analyzing the user request to obtain an initial request body object, creating a parameter object corresponding to the constant parameter according to the configuration rule, matching the types of the initial request body object and the parameter object, merging the parameter object and the initial request body object of the same type to obtain a configuration request body object, and forming a request message by the configuration request body object.
2. The interface constant parameter automatic joining method according to claim 1, comprising: "call the user request to the corresponding API interface and the constant parameter configuration information corresponding to the API interface" includes the steps of: judging whether the user request has a corresponding route in the API gateway, and if so, calling an API interface corresponding to the user request and constant parameter configuration information corresponding to the API interface.
3. The interface constant parameter automatic joining method according to claim 1, wherein "creating a parameter object corresponding to the constant parameter according to the configuration rule" includes the steps of: the parameter object comprises at least one parameter object subclass, and the constant parameters create corresponding parameter object subclasses according to the rules of the configuration rules.
4. The method of claim 1, wherein the initial requestor object comprises a plurality of initial requestor object subclasses of different types, and wherein combining the parameter object and the corresponding initial requestor object to obtain the configuration requestor object comprises: and merging the parameter object subclass with the initial request body object subclass of the same type.
5. The interface constant parameter automatic joining method according to claim 1, wherein the configuration rule sets a parameter type, whether filling is necessary, a parameter name, a parameter position, a parameter value, a parameter description, and a sequence.
6. An interface constant parameter automatic parameter entering method is characterized by comprising the following steps:
sending a user request to an API gateway, wherein the user request does not comprise constant parameters corresponding to an API interface, and the user request comes from a request end;
the API gateway calls an API interface corresponding to a user request and constant parameter configuration information corresponding to the API interface based on the user request, wherein the constant parameter configuration information comprises constant parameters and configuration rules, analyzes the user request to obtain an initial request body object, creates a parameter object corresponding to the constant parameters according to the configuration rules, matches the types of the initial request body object and the parameter object, merges the parameter object and the initial request body object of the same type to obtain a configuration request body object, and the configuration request body object forms a request message;
and acquiring return data.
7. The method of claim 6, wherein the initial requestor object comprises a plurality of initial requestor object subclasses of different types, and wherein merging the parameter object and the corresponding initial requestor object to obtain the configuration requestor object comprises: and merging the parameter object subclass with the initial request body object subclass of the same type.
8. An automatic parameter entering device for interface constant parameters, which is arranged in an API gateway, is characterized by comprising:
a user request obtaining unit 301, configured to obtain a user request, where the user request does not include a constant parameter corresponding to an API interface, and the user request is from a request end;
a configuration unit 302, configured to call an API corresponding to the user request and constant parameter configuration information corresponding to the API, where the constant parameter configuration information includes constant parameters and configuration rules; analyzing the user request to obtain an initial request body object, creating a parameter object corresponding to the constant parameter according to the configuration rule, matching the types of the initial request body object and the parameter object, merging the parameter object and the initial request body object of the same type to obtain a configuration request body object, and forming a request message by the configuration request body object.
9. An automatic parameter entering device of interface constant parameters is arranged in a request end and an API gateway, and is characterized by comprising the following components:
a user request sending unit 501, configured to send a user request to an API gateway, where the user request does not include a constant parameter corresponding to an API interface, and the user request comes from a request end;
the gateway processing unit 502 is configured to invoke an API corresponding to a user request and constant parameter configuration information corresponding to the API based on the user request, where the constant parameter configuration information includes constant parameters and configuration rules, parse the user request to obtain an initial request body object, create a parameter object corresponding to the constant parameters according to the configuration rules, match types of the initial request body object and the parameter object, and combine the parameter object and the initial request body object of the same type to obtain a configuration request body object, where the configuration request body object forms a request message, and request return data of a server based on the request message;
a return data obtaining unit 503, configured to obtain the return data.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the interface constant parameter auto-entry method of any one of claims 1-5 or 6-7.
11. A readable storage medium, characterized in that the readable storage medium has stored therein a computer program comprising program code for controlling and executing a process comprising executing an interface constant parameter auto-entry method according to any of claims 1-5 or 6-7.
CN202111069304.XA 2021-09-13 2021-09-13 Automatic parameter entering method and device for interface constant parameters Active CN113766030B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111069304.XA CN113766030B (en) 2021-09-13 2021-09-13 Automatic parameter entering method and device for interface constant parameters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111069304.XA CN113766030B (en) 2021-09-13 2021-09-13 Automatic parameter entering method and device for interface constant parameters

Publications (2)

Publication Number Publication Date
CN113766030A CN113766030A (en) 2021-12-07
CN113766030B true CN113766030B (en) 2023-05-26

Family

ID=78795176

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111069304.XA Active CN113766030B (en) 2021-09-13 2021-09-13 Automatic parameter entering method and device for interface constant parameters

Country Status (1)

Country Link
CN (1) CN113766030B (en)

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103841134B (en) * 2012-11-22 2017-03-01 阿里巴巴集团控股有限公司 Based on API transmission, the method for receive information, apparatus and system
US10664331B2 (en) * 2016-09-28 2020-05-26 Amazon Technologies, Inc. Generating an application programming interface
US11663110B2 (en) * 2016-10-31 2023-05-30 International Business Machines Corporation Analysis to check web API code usage and specification
CN108108162B (en) * 2016-11-24 2020-05-12 腾讯科技(深圳)有限公司 Application programming interface generation method and device
US10606672B2 (en) * 2017-05-04 2020-03-31 Microsoft Technology Licensing, Llc Micro-service framework derived from third-party apps
US10915377B2 (en) * 2018-05-18 2021-02-09 International Business Machines Corporation Automatically building a web API definition from a microservice or web application
US10489224B1 (en) * 2018-07-30 2019-11-26 International Business Machines Corporation Managing application programming interface requests
CN111381820A (en) * 2018-12-29 2020-07-07 北京数聚鑫云信息技术有限公司 Method and device for automatically generating API based on GUI
CN111506365A (en) * 2019-01-31 2020-08-07 北京数聚鑫云信息技术有限公司 Method and device for automatically constructing API
CN110083384B (en) * 2019-03-21 2020-09-15 平安国际智慧城市科技股份有限公司 Application programming interface creating method and device
CN110007950A (en) * 2019-04-10 2019-07-12 优信拍(北京)信息科技有限公司 A kind of management method of application programming interfaces, device and server
CN110286897A (en) * 2019-05-22 2019-09-27 深圳壹账通智能科技有限公司 API Visual Dynamic configuration method, device, equipment and storage medium
CN110716738A (en) * 2019-09-03 2020-01-21 无锡华云数据技术服务有限公司 Data processing method and device, cloud platform, electronic equipment and storage medium
CN110633162B (en) * 2019-09-23 2022-10-11 苏州达家迎信息技术有限公司 Remote call implementation method and device, computer equipment and storage medium
CN110738036A (en) * 2019-10-15 2020-01-31 北京百度网讯科技有限公司 Method and apparatus for generating information
CN110753127A (en) * 2019-10-29 2020-02-04 浪潮云信息技术有限公司 Method for realizing request parameter conversion based on Kong API gateway
CN111880839A (en) * 2020-09-28 2020-11-03 珠海大横琴科技发展有限公司 API processing method and device
CN112631694B (en) * 2020-12-11 2023-08-11 远光软件股份有限公司 API (application program interface) encapsulation calling method and system
CN112947963A (en) * 2021-02-26 2021-06-11 平安普惠企业管理有限公司 Interface operation and maintenance method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113766030A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
CN111278031B (en) PDU type setting method, UE strategy setting method, entity and storage medium
EP2913972A1 (en) Resource subscription method and device
US8341285B2 (en) Method and system for transferring files
CN111212154B (en) Service binding method, device, terminal, server and storage medium
WO2020192092A1 (en) Network communication method, system, computing device, and computer-readable storage medium
CN111092877A (en) Data processing method and device, electronic equipment and storage medium
CN109982152B (en) P2P CDN service processing method, intelligent gateway and CDN platform
CN112702425B (en) WEB application access proxy method, device and storage medium based on domain name extensive resolution
CN113766034B (en) Business processing method and device based on block chain
CN114281573A (en) Workflow data interaction method and device, electronic device and readable storage medium
CN110868361A (en) Gateway load balancing method, device and equipment
CN112311628A (en) Network speed measuring method, system, network equipment and storage medium
CN115225709B (en) Data transmission system, method, electronic device and readable storage medium
CN113079198A (en) Method and device for converting cloud platform interface protocol
US8180857B2 (en) Method for downloading file in parallel
CN111367685A (en) Interface calling method and device, computer equipment and storage medium
CN109471713B (en) Method and device for inquiring information
CN113766030B (en) Automatic parameter entering method and device for interface constant parameters
CN109862134B (en) Lease time configuration method and system of IP address and DHCP client
CN108124021A (en) Internet protocol IP address obtains, the method, apparatus and system of website visiting
CN113746932B (en) Network request merging method, device, electronic device and computer program product
CN111159226A (en) Index query method and system
CN113055444B (en) File sharing method and related device thereof
CN112039801B (en) Method, system and proxy server for setting IP information
CN115514799A (en) TCP connection method, system, network device 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