CN112860308A - Configuration method of interface definition, service processing method, server and storage medium - Google Patents

Configuration method of interface definition, service processing method, server and storage medium Download PDF

Info

Publication number
CN112860308A
CN112860308A CN202110049071.0A CN202110049071A CN112860308A CN 112860308 A CN112860308 A CN 112860308A CN 202110049071 A CN202110049071 A CN 202110049071A CN 112860308 A CN112860308 A CN 112860308A
Authority
CN
China
Prior art keywords
interface
configuration
parameter
conversion
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110049071.0A
Other languages
Chinese (zh)
Inventor
尤文榜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN202110049071.0A priority Critical patent/CN112860308A/en
Publication of CN112860308A publication Critical patent/CN112860308A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The embodiment of the invention relates to the technical field of Internet and discloses a configuration method of interface definition, a service processing method, a server and a storage medium. In the invention, a first CDN application server provides a configuration interface for interface definition in an application program interface; receiving an interface identifier and configuration information defined by an interface to be configured through a configuration interface; the configuration information comprises interface parameters and a conversion script; and establishing a mapping relation between the interface identification defined by the interface and the configuration information. By the method, the interface definition in the application program interface is only configured on the configuration interface, the mapping relation is established between the interface identification and the configuration information of the interface definition received by the configuration interface, the configuration of the interface definition is completed and the interface definition is put into use, and the interface definition can be put into use without rewriting codes and then developing and testing the application program interface, so that the development time of the application program interface is reduced, and the service requirements of a client can be met as soon as possible.

Description

Configuration method of interface definition, service processing method, server and storage medium
Technical Field
The embodiment of the invention relates to the technical field of internet, in particular to a configuration method of interface definition, a service processing method, a server and a storage medium.
Background
The development of internet technology has enabled people's lives to change greatly, and people's demands for services are also changing constantly, for example: people are caching changes in business needs and accelerating changes in business needs. At present, in the process of adjusting the service requirement, a Content Delivery Network (CDN) is usually required to provide a corresponding Application Programming Interface (API) Interface to adjust the service requirement; namely, when the service requirement changes, an API interface needs to be redeveloped, that is, the interface definition of the API interface needs to be performed again, and at this time, the code needs to be rewritten and tested to be put into use again, which takes a long time.
Disclosure of Invention
Embodiments of the present invention provide a configuration method of interface definition, a service processing method, a server, and a storage medium, which can reduce development time of an application program interface and meet service requirements of a client as soon as possible.
To solve the foregoing technical problem, an embodiment of the present invention provides a configuration method for interface definition, which is applied to a first CDN application server, and the method includes: providing a configuration interface for interface definition in an application program interface; receiving an interface identifier and configuration information defined by an interface to be configured through the configuration interface; the configuration information comprises interface parameters and a conversion script; and establishing a mapping relation between the interface identification defined by the interface and the configuration information.
The embodiment of the invention also provides a service processing method which is applied to a second CDN application server, and the method comprises the following steps: receiving a request sent by a client; the request carries interface identification defined by an interface and parameter values of interface parameters; acquiring configuration information corresponding to the interface identifier of the interface definition carried in the request according to the mapping relation between the interface identifier of the interface definition and the configuration information; wherein, the mapping relation is obtained by the configuration method defined by the interface; and calling a service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter, so as to realize service processing.
An embodiment of the present invention further provides a server, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a configuration method as defined by any of the interfaces described above or to perform a business processing method as described above.
The embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the configuration method of the interface definition, or implements the service processing method.
Compared with the prior art, the embodiment of the invention has the advantages that the first CDN application server provides a configuration interface for interface definition in an application program interface; receiving an interface identifier and configuration information defined by an interface to be configured through a configuration interface; the configuration information comprises interface parameters and a conversion script; and establishing a mapping relation between the interface identification defined by the interface and the configuration information. By the method, the interface definition in the application program interface is only configured on the configuration interface, the mapping relation is established between the interface identification and the configuration information of the interface definition received by the configuration interface, the configuration of the interface definition is completed and the interface definition is put into use, and the interface definition can be put into use without rewriting codes and then developing and testing the application program interface, so that the development time of the application program interface is reduced, and the service requirements of a client can be met as soon as possible.
In addition, the receiving, through the configuration interface, the interface identifier and the configuration information defined by the interface to be configured includes: receiving an interface identifier defined by an interface to be configured through an interface identifier input item on the configuration interface; receiving interface parameters for defining configuration for the interface through an interface parameter configuration item on the configuration interface; and providing a plurality of preset conversion scripts through the conversion script configuration items on the configuration interface, and receiving a selection command of the conversion scripts in the plurality of conversion scripts through the conversion script configuration items. By the method, the interface identification and the configuration information of the interface definition to be configured can be received through the configuration interface.
In addition, the providing of a plurality of preset conversion scripts through the conversion script configuration items on the configuration interface includes: identifying a corresponding service access type according to the interface identifier; and acquiring a plurality of conversion scripts corresponding to the service access types from a preset script library, and displaying the conversion scripts through the configuration items of the conversion scripts. Since the service access type can affect the selected conversion script, when the corresponding service access type is identified according to the interface identifier, only the conversion script corresponding to the service access type can be provided, so that the workload of selection can be reduced, and the development time of the application program interface can be further reduced.
In addition, after receiving the interface identifier defined by the interface to be configured through the interface identifier input item on the configuration interface, the method further includes: acquiring the characteristic information corresponding to the interface definition through the interface identification, and displaying the characteristic information through a characteristic information display item on the configuration interface; the characteristic information at least comprises a service access type corresponding to the interface definition. When the feature information corresponding to the interface definition is acquired through the interface identification, the feature information display item on the configuration interface is directly displayed, namely, the feature information display item is displayed in a visual mode, so that an operator can clearly know the feature information corresponding to the currently input interface identification.
In addition, the interface parameter configuration item comprises an input parameter configuration item, and the interface parameter comprises an input parameter; the conversion script configuration items comprise request conversion script configuration items, and the preset conversion scripts comprise a plurality of preset request conversion scripts; the receiving, by the interface parameter configuration item, the interface parameter configured for the interface definition includes: receiving input parameters defining configuration for the interface through the input parameter configuration items; the providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of a conversion script in the plurality of conversion scripts through the conversion script configuration items include: providing a plurality of preset request conversion scripts through the request conversion script configuration items, and receiving a selection command of the request conversion scripts in the plurality of request conversion scripts through the request conversion script configuration items; the request conversion script is used for converting the parameter value of the input parameter into service data and calling the service function corresponding to the interface definition through the service data to realize service processing. By such a method, the configuration of the request conversion script can be successfully realized.
In addition, the interface parameter configuration item comprises an output parameter configuration item, and the interface parameter comprises an output parameter; the conversion script configuration items comprise response conversion script configuration items, and the preset conversion scripts comprise a plurality of preset response conversion scripts; the receiving, by the interface parameter configuration item, the interface parameter configured for the interface definition includes: receiving an output parameter configured for the interface definition through the output parameter configuration item; the providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of a conversion script in the plurality of conversion scripts through the conversion script configuration items include: providing a plurality of preset response conversion scripts through the response conversion script configuration items, and receiving a selection command of a response conversion script in the plurality of response conversion scripts through the response conversion script configuration items; the response conversion script is used for converting a service processing result into a parameter value of the output parameter, wherein the service processing result is a result obtained by calling a service function corresponding to the interface definition and realizing service processing. By such a method, the configuration of the response conversion script can be successfully realized.
In addition, the interface parameters in the configuration information comprise input parameters; before the calling the service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter to implement service processing, the method further includes: performing parameter validity check on the parameter value of the interface parameter based on the parameter type of the input parameter in the configuration information and/or based on the value range of the input parameter in the configuration information; if the parameter value of the interface parameter passes the parameter validity check, entering the conversion script based on the configuration information and the parameter value of the interface parameter, and calling the service function corresponding to the interface definition to realize the service processing. By the method, the next step is only carried out when the parameter value of the interface parameter in the request passes the parameter validity check, and useless work caused by the next step when the parameter value of the interface parameter in the request does not pass the parameter validity check is avoided.
In addition, the conversion script in the configuration information comprises a request conversion script; the step of calling the service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter to realize service processing includes: and converting the parameter values of the input parameters into service data based on the request conversion script in the configuration information, and calling the service function corresponding to the interface definition through the service data to realize service processing. By such a method, service processing can be successfully realized.
In addition, if the service processing is query operation, the conversion script in the configuration information further comprises a response conversion script; after the service processing is realized, the method further comprises the following steps: and converting the service processing result into a parameter value of an output parameter through a response conversion script in the configuration information, and returning a response comprising the parameter value of the output parameter to the client. If the service processing is a new adding operation, a deleting operation or a modifying operation; after the service processing is realized, the method further comprises the following steps: and sending a response that the business processing is successfully executed to the client. By the method, when the service processing is query operation, the parameter value required by the client can be converted into the parameter value of the output parameter of the client by responding to the conversion script, so that the client can directly know the related content; when the service processing is an addition operation, a deletion operation or a modification operation, the client can know the successful result of the service processing.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
FIG. 1 is a flow chart of a configuration method of interface definitions according to a first embodiment of the present invention;
FIG. 2 is a flowchart showing a detailed implementation of step 102 according to a first embodiment of the present invention;
fig. 3 is a flow chart of a service processing method according to a second embodiment of the present invention;
fig. 4 is a flow chart of a service processing method according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a server in a fourth embodiment according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention will be described in detail with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that in various embodiments of the invention, numerous technical details are set forth in order to provide a better understanding of the present application. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments. The following embodiments are divided for convenience of description, and should not constitute any limitation to the specific implementation manner of the present invention, and the embodiments may be mutually incorporated and referred to without contradiction.
A first embodiment of the present invention relates to a configuration method for interface definition, which is applied to a first CDN application server, for example: in any node of the CDN, a server capable of providing a service configuration service, a specific flow is shown in fig. 1, and includes:
step 101, providing a configuration interface for interface definition in an application program interface.
Specifically, the application program interface is a general API interface, a plurality of interface definitions are preset in the general API interface, when a service requirement changes, the interface definition corresponding to the preset service needs to be modified, and when a new service requirement is added, a new interface definition needs to be added; at this time, the first CDN application server provides a configuration interface for interface definition in the application program interface, the configuration interface is visually displayed to an operator, and the operator performs corresponding operation on the configuration interface.
102, receiving an interface identifier and configuration information defined by an interface to be configured through a configuration interface; the configuration information comprises interface parameters and a conversion script.
In one example, the configuration interface comprises an interface identification input item, an interface parameter configuration item and a conversion script configuration item; a specific flowchart for receiving an interface identifier and configuration information defined by an interface to be configured through a configuration interface is shown in fig. 2, and includes:
step 1021, receiving an interface identifier of the interface definition to be configured through an interface identifier input item on the configuration interface.
Specifically, when an operator inputs an interface identifier into an interface identifier input item on a configuration interface, the first CDN application server receives, through the interface identifier input item, an interface identifier defined by an interface to be configured, where the interface identifier may be a Uniform Resource Identifier (URI) or other codes. If the interface definition is the preset interface definition, when the first CDN application server receives an interface identifier of the interface definition to be configured, configuration information corresponding to the interface identifier is also displayed on the configuration interface, so that an operator can know the configuration information before the interface definition, that is, interface parameters and a conversion script corresponding to the interface definition before the interface definition, and modify the interface parameters and the conversion script according to the current service requirement; if the interface definition is the interface definition that needs to be newly added, when the first CDN application server receives the interface identifier of the interface definition to be configured, all configuration information is empty, that is, the interface parameters and the conversion script are empty, and configuration needs to be performed according to the current service requirement.
In one example, the configuration interface comprises an interface identification input item, an interface parameter configuration item, a conversion script configuration item and a characteristic information display item defined by the interface; after receiving the interface identifier defined by the interface to be configured through the interface identifier input item, the method further includes: acquiring characteristic information corresponding to the interface definition through the interface identification, and displaying the characteristic information through a characteristic information display item on the configuration interface; the characteristic information at least comprises a service access type corresponding to the interface definition.
Specifically, the characteristic information at least comprises a service access type corresponding to the interface definition, wherein the service access type comprises classification, standard functions and the like, the classification type comprises four types of addition, deletion, modification and query, and the standard functions can be functions of rewriting, authentication and the like; if the interface definition is the preset interface definition, the interface definition corresponding to the interface identification can be obtained when the interface identification is received, so that the corresponding feature information is obtained and displayed through the feature information display item, that is, the service access type corresponding to the interface definition is displayed through the display item of the service access type, for example: the interface definition 1 is preset in the first CDN application server, the interface identifier a of the interface definition 1 is classified as query and the standard function is rewrite, if the interface identifier a of the interface definition 1 to be configured is received through the interface identifier input item, the feature information acquired that the interface definition 1 corresponds to is classified as query and the standard function is rewrite, and the feature information display item shows that the interface definition 1 is classified as query and the standard function is rewrite. When the characteristic information corresponding to the interface definition is acquired through the interface identification, the characteristic information is directly displayed on the characteristic information display item, namely, the characteristic information is displayed in a visual mode, so that an operator can clearly know the characteristic information corresponding to the currently input interface identification. In one example, the feature information may also include a name, a client, etc. corresponding to the interface definition, which may allow the operator to know more feature information corresponding to the currently entered interface identification.
In one example, if the interface definition is the newly added interface definition, the feature information of the interface definition is received through the feature information presentation item. Specifically, if the interface definition is the newly added interface definition, an operator is required to input the feature information in the feature information presentation item, and at this time, the first CDN application server receives the feature information of the interface definition through the feature information presentation item.
At step 1022, interface parameters configured for the interface definition are received through the interface parameter configuration items on the configuration interface.
Step 1023, a plurality of preset conversion scripts are provided through the conversion script configuration items on the configuration interface, and selection commands of the conversion scripts in the plurality of conversion scripts are received through the conversion script configuration items.
Specifically, the interface parameter configuration item includes a plurality of sub-configuration items, and the sub-configuration items may be set according to actual needs, including but not limited to the following sub-configuration items: parameter names, must pass, can pass, parameter types, value ranges, descriptions, and the like, wherein the parameter types include but are not limited to the following types: the first CDN application server receives, through the interface parameter configuration item, the interface parameter configured for the interface definition when the operator configures the interface parameter in the interface configuration item. And the first CDN application server provides a plurality of preset conversion scripts through the conversion script configuration items, an operator selects the conversion scripts from the plurality of preset conversion scripts based on the service functions defined by the interfaces required to be called by the interface parameters, receives the selection commands of the conversion scripts through the conversion script configuration items, and at the moment, the conversion scripts are configured to call the corresponding service functions defined by the interfaces based on the interface parameters. In one example, a preset plurality of conversion scripts are provided through a conversion script configuration item on a configuration interface, and the method comprises the following steps: identifying a corresponding service access type according to the interface identifier; and acquiring a plurality of conversion scripts corresponding to the service access types from a preset script library, and displaying the conversion scripts through the conversion script configuration items.
Specifically, if the interface definition is a preset interface definition, the interface definition corresponding to the interface identifier may be obtained when the interface identifier is received, so as to obtain a corresponding service access type, where the service access type includes a classification and a standard function, and different classifications may affect the selection of the conversion script, for example: when the new service data is classified as new service data, the selected conversion script is a request conversion script capable of realizing the new service data, and when the new service data is classified as inquiry, the selected conversion script is a request conversion script capable of realizing the inquiry of the service data; therefore, when providing the conversion script, the first CDN application server obtains a plurality of conversion scripts corresponding to the service access types from a preset script library, and displays the conversion scripts through the conversion script configuration items. By the method, the service access type can influence the selected conversion script, so that when the corresponding service access type is identified according to the interface identifier, only the conversion script corresponding to the service access type can be provided, the workload of selection can be reduced, and the development time of the application program interface can be further reduced.
In one example, the interface parameter configuration item comprises an input parameter configuration item, and the interface parameter comprises an input parameter; the conversion script configuration items comprise request conversion script configuration items, and the preset conversion scripts comprise a plurality of preset request conversion scripts; receiving interface parameters configured for the interface definition through an interface parameter configuration item, including: receiving input parameters for interface definition configuration through an input parameter configuration item; providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of the conversion script in the plurality of conversion scripts through the conversion script configuration items, wherein the selection command comprises: providing a plurality of preset request conversion scripts through the request conversion script configuration items, and receiving a selection command of the request conversion scripts in the plurality of request conversion scripts through the request conversion script configuration items; the request conversion script is used for converting the parameter value of the input parameter into service data and calling the service function corresponding to the interface definition through the service data to realize service processing.
Specifically, the first CDN application server only needs to configure the input parameters and the request conversion script, and provides the input parameter configuration items and a plurality of preset request conversion scripts through the request conversion script configuration items; an operator configures input parameters in an input parameter configuration item, selects a request conversion script from a plurality of preset request conversion scripts based on the service function defined by an interface required to be called by the input parameters; the first CDN application server receives an input parameter configured for the interface definition through an input parameter configuration item and receives a selection command requesting a conversion script through a request conversion script configuration item, and the request conversion script is used for converting a parameter value of the input parameter into service data and calling a service function corresponding to the interface definition through the service data to realize service processing.
In one example, the interface parameter configuration item comprises an output parameter configuration item, and the interface parameter comprises an output parameter; the conversion script configuration items comprise response conversion script configuration items, and the preset conversion scripts comprise a plurality of preset response conversion scripts; receiving interface parameters configured for interface definition through the interface parameter configuration items, including: receiving an output parameter configured for the interface definition through an output parameter configuration item; providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of the conversion script in the plurality of conversion scripts through the conversion script configuration items, wherein the selection command comprises: providing a plurality of preset response conversion scripts through the response conversion script configuration items, and receiving a selection command of the response conversion scripts in the plurality of response conversion scripts through the response conversion script configuration items; the response conversion script is used for converting the service processing result into the parameter value of the output parameter, and the service processing result is a result obtained by calling the interface definition corresponding to the service function and realizing the service processing.
Specifically, the first CDN application server only needs to configure the output parameters and the response conversion scripts, and provides an output parameter configuration item and a plurality of preset response conversion scripts through the response conversion script configuration item; an operator configures output parameters in an output parameter configuration item, calls a service function corresponding to an interface definition based on the output parameters, and selects a response conversion script from a plurality of preset response conversion scripts; the first CDN application server receives an output parameter configured for interface definition by an interface through an output parameter configuration item and receives a selection command responding to a conversion script through a response conversion script configuration item, the response conversion script is used for converting a service processing result into a parameter value of the output parameter, the service processing result is a service function corresponding to calling interface definition, and a result obtained by service processing is achieved.
In one example, the interface parameter configuration items comprise input parameter configuration items and output parameter items, and the interface parameters comprise input parameters and output parameters; the conversion script configuration items comprise request conversion script configuration items and response conversion script items, and the preset conversion scripts comprise a plurality of preset request conversion scripts and a plurality of preset response conversion scripts; receiving interface parameters configured for an application program interface through an interface parameter configuration item, including: receiving input parameters configured for the application program interface through the input parameter configuration item, and receiving output parameters configured for the application program interface through the output parameter configuration item; providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of the conversion script in the plurality of conversion scripts through the conversion script configuration items, wherein the selection command comprises: providing a plurality of preset request conversion scripts through the request conversion script configuration items, and receiving a selection command of the request conversion scripts in the plurality of request conversion scripts through the request conversion script configuration items; the request conversion script is used for converting the parameter values of the input parameters into service configuration data, calling the service functions corresponding to the interface definition through the service configuration data to realize service processing, providing a plurality of preset response conversion scripts through response conversion script configuration items, and receiving selection commands of the response conversion scripts in the plurality of response conversion scripts through the response conversion script configuration items; the response conversion script is used for converting the service processing result into the parameter value of the output parameter, and the service processing result is a result obtained by calling the interface definition corresponding to the service function and realizing the service processing.
Specifically, a first CDN application server needs to configure input parameters and a request conversion script, and configure output parameters and a response conversion script, where the first CDN application server provides an input parameter configuration item, an output parameter configuration item, a plurality of preset request conversion scripts provided through the request conversion script configuration item, and a plurality of preset response conversion scripts provided through the response conversion script configuration item; an operator configures input parameters in an input parameter configuration item, configures output parameters in an output parameter configuration item, and selects a request conversion script from a plurality of preset request conversion scripts and a service function defined by an interface to be called based on the input parameters, and selects a response conversion script from a plurality of preset response conversion scripts; the first CDN application server receives an input parameter configured for interface definition by an interface through an input parameter configuration item, receives an output parameter configured for interface definition by an interface through an output parameter configuration item, receives a selection command requesting a conversion script and a selection command responding the conversion script through a response conversion script configuration item, wherein the request conversion script is used for converting a parameter value of the input parameter into service data and calling a corresponding service function of the interface definition through the service data to realize service processing, the response conversion script is used for converting a service processing result into a parameter value of the output parameter, and the service processing result is used for calling the corresponding service function of the interface definition to realize a result obtained by the service processing.
Step 103, establishing a mapping relation between the interface identifier defined by the interface and the configuration information.
Specifically, the first CDN application server establishes a mapping relationship between an interface identifier defined by the interface and the configuration information, and stores the mapping relationship in the general API interface, where the configuration information includes interface parameters and a conversion script.
In this embodiment, the first CDN application server provides a configuration interface for interface definition in the application program interface; receiving an interface identifier and configuration information defined by an interface to be configured through a configuration interface; the configuration information comprises interface parameters and a conversion script; and establishing a mapping relation between the interface identification defined by the interface and the configuration information. By the method, the interface definition in the application program interface is only configured on the configuration interface, the mapping relation is established between the interface identification and the configuration information of the interface definition received by the configuration interface, the configuration of the interface definition is completed and the interface definition is put into use, and the interface definition can be put into use without rewriting codes and then developing and testing the application program interface, so that the development time of the application program interface is reduced, and the service requirements of a client can be met as soon as possible.
A second embodiment of the present invention relates to a service processing method, which is applied to a second CDN application server, for example: an interface server in any node of the CDN, where a mapping relationship between an interface identifier defined by an interface and configuration information is obtained by a configuration method defined by the interface in the first embodiment, and a specific flowchart is shown in fig. 3, where the method includes:
step 201, receiving a request sent by a client; the request carries the interface identifier defined by the interface and the parameter value of the interface parameter.
Specifically, after the second CDN application server receives a request sent by the client through the interface gateway, the request is analyzed to obtain an interface identifier defined by the interface and a parameter value of the interface parameter; the interface identifier is a Uniform Resource Identifier (URI) or other codes.
Step 202, obtaining the configuration information corresponding to the interface identifier of the interface definition carried in the request according to the mapping relationship between the interface identifier of the interface definition and the configuration information.
Specifically, a mapping relationship between an interface identifier defined by an interface and configuration information is pre-stored in a general API interface of the second CDN application server, and the configuration information corresponding to the interface identifier defined by the interface carried in the request can be obtained according to the mapping relationship between the interface identifier defined by the interface and the configuration information.
Step 203, based on the conversion script in the configuration information and the parameter value of the interface parameter, calling the service function corresponding to the interface definition, and implementing service processing.
In one example, the conversion script in the configuration information includes a request conversion script, and based on the conversion script in the configuration information and a parameter value of an interface parameter, the interface is called to define a corresponding service function, so as to implement service processing, including: and converting the parameter values of the input parameters into service data based on the request conversion script in the configuration information, and calling the corresponding service functions defined by the interface through the service data to realize service processing.
Specifically, if the configuration information corresponding to the URI defined by the interface in the request includes: the classification is query, the standard function is cache, and the parameter value of the interface parameter in the request is < cache type: js >, convert script based on the request in the configuration information to convert the < cache type: js > is converted into service data which can be identified by the second CDN application server, and then the query function defined by the interface is called through the service data to query the cache type: js > corresponding information, and business processing of query operation is realized. If the configuration information corresponding to the URI of the interface definition in the request comprises: the classification is new, the standard function is buffer, the parameter value of the interface parameter in the request is < buffer type: cs, buffer time: 10s, whether case is ignored: yes, convert script based on request in configuration information to convert < cache type: b, cache time: 10s, whether case is ignored: converting the data into service data which can be identified by a second CDN application server, calling a newly-added function defined by an interface through the service data, and newly adding a cache type: cs, buffer time: 10s, whether case is ignored: and yes, service processing of the new operation is realized. If the configuration information corresponding to the URI of the interface definition in the request comprises: the classification is modified, the standard function is caching, and the parameter value of the interface parameter in the request is < caching type: cs, buffer time: 20s >, based on the request in the configuration information the conversion script will < cache type: cs, buffer time: 20s > is converted into service data which can be identified by the second CDN application server, and then the modification function defined by the interface is called through the service data, so that the content of the cache type: and the caching time in the css is modified into 20s, and the business processing of the modification operation is realized. If the configuration information corresponding to the URI of the interface definition in the request comprises: the classification is deletion, the standard function is caching, and the parameter value of the interface parameter in the request is < cache type: css >, convert script based on request in configuration information to convert < cache type: cs > is converted into service data which can be identified by the second CDN application server, and then the modification function defined by the interface is called through the service data, so that the value of < cache type: and cs > deleting the corresponding information to realize the service processing of the deleting operation.
In one example, after the service processing is implemented, the method further includes: if the service processing is query operation and the conversion script in the configuration information also comprises a response conversion script, converting the service processing result into a parameter value of the output parameter through the response conversion script in the configuration information, and returning a response comprising the parameter value of the output parameter to the client; if the service processing is a new adding operation, a deleting operation or a modifying operation; and sending a response that the business processing is successfully executed to the client.
Specifically, if the service processing is a query operation, the conversion script in the configuration information further includes a response conversion script, for example: if the configuration information corresponding to the URI of the interface definition in the request comprises: the classification is query, the standard function is cache, and the parameter value of the interface parameter in the request is < cache type: js >, convert script based on the request in the configuration information to convert the < cache type: js > is converted into service data which can be identified by the second CDN application server, and then the query function defined by the interface is called through the service data to query the cache type: js, implementing service processing of query operation, converting the service processing result into a parameter value < cache time of an output parameter through a response conversion script: 20s >, returns to the client a message comprising < cache time: 20s >. If the service processing is a new adding operation, a deleting operation or a modifying operation, the conversion script in the configuration information does not include a response conversion script and/or the configuration information does not include an output parameter configuration item, namely the response conversion script and/or the output parameter configuration item is empty, and then a response that the service processing is successfully executed is sent to the client after the service processing is realized.
In this embodiment, a request sent by a client is received; the request carries interface identification defined by the interface and parameter values of interface parameters; acquiring configuration information corresponding to the interface identifier of the interface definition carried in the request according to the mapping relation between the interface identifier of the interface definition and the configuration information; wherein, the mapping relation is obtained by the configuration method defined by the interface; based on the conversion script in the configuration information and the parameter value of the interface parameter, the service function corresponding to the interface definition is called to realize the service processing.
A third embodiment of the present invention relates to a service processing method, which is applied to a second CDN application server, for example: an interface server in any node of the CDN, wherein a mapping relationship between an interface identifier defined by an interface and configuration information is obtained by the configuration method defined by the interface in the first embodiment, and a difference between the third embodiment and the second embodiment is that: the interface parameters in the configuration information include input parameters, and also perform parameter validity check on the parameter values of the interface parameters, and only when the parameter values of the interface parameters pass the parameter validity check, the interface parameters enter the conversion script and the parameter values of the interface parameters in the configuration information, and call the service functions corresponding to the interface definition, so as to implement the steps of service processing, where a specific flowchart is shown in fig. 4, and includes:
step 301, receiving a request sent by a client; the request carries the interface identifier defined by the interface and the parameter value of the interface parameter.
Step 302, obtaining the configuration information corresponding to the interface identifier of the interface definition carried in the request according to the mapping relationship between the interface identifier of the interface definition and the configuration information.
The steps 301-302 are similar to the steps 201-202, and are not described herein again.
And 303, performing parameter validity check on the parameter value of the interface parameter based on the parameter type of the input parameter in the configuration information and/or based on the value range of the input parameter in the configuration information.
Step 304, determining whether the parameter value of the interface parameter passes the parameter validity check, if so, entering step 305, and if not, entering to end.
In one example, the interface parameters in the configuration information include input parameters, and the parameter validity of the parameter values of the interface parameters is checked based on the parameter types of the input parameters in the configuration information. Specifically, if the parameter value of the interface parameter does not belong to the parameter type of the input parameter, the parameter value of the interface parameter cannot pass the parameter validity check, and if the parameter value of the interface parameter belongs to the parameter type of the input parameter, the parameter value of the interface parameter passes the parameter validity check. For example: if the parameter type of the input parameter is digital, if the parameter value of the interface parameter is true, the parameter value of the interface parameter does not belong to the digital, the parameter value of the interface parameter cannot pass the parameter validity check, if the parameter value of the interface parameter is 1, the parameter value of the interface parameter belongs to the digital, and the parameter value of the interface parameter passes the parameter validity check.
In one example, the interface parameter in the configuration information includes an input parameter, and based on a value range of the input parameter in the configuration information, validity check is performed on a parameter value of the interface parameter. Specifically, if the parameter value of the interface parameter is not in the value range of the input parameter, the parameter value of the interface parameter cannot pass the parameter validity check, and if the parameter value of the interface parameter is in the value range of the input parameter, the parameter value of the interface parameter passes the parameter validity check. For example: if the value range of the input parameter is 1-4, if the parameter value of the interface parameter is 5, the parameter value of the interface parameter is not in the value range, the parameter value of the interface parameter cannot pass the parameter validity check, and if the parameter value of the interface parameter is 1, the parameter value of the interface parameter belongs to a number, and the parameter value of the interface parameter passes the parameter validity check.
In one example, the interface parameters in the configuration information include input parameters, and validity of the parameter values of the interface parameters is checked based on the parameter types of the input parameters and the value ranges of the input parameters in the configuration information. Specifically, if the parameter value of the interface parameter does not belong to the parameter type of the input parameter or the parameter value of the interface parameter is not in the value range of the input parameter, the parameter value of the interface parameter cannot pass the parameter validity check, and if the parameter value of the interface parameter belongs to the parameter type of the input parameter and the parameter value of the interface parameter is in the value range of the input parameter, the parameter value of the interface parameter passes the parameter validity check.
And 305, calling a service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter, and realizing service processing.
Step 305 is similar to step 203 and will not be described herein.
In this embodiment, the next step is performed only when the parameter value of the interface parameter in the request passes the parameter validity check, so that the next step is not performed when the parameter value of the interface parameter in the request does not pass the parameter validity check.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A fourth embodiment of the invention is directed to a server, as shown in fig. 5, comprising at least one processor 402; and a memory 401 communicatively coupled to the at least one processor 402; the memory 401 stores instructions executable by the at least one processor 402, and the instructions are executed by the at least one processor 402, so that the at least one processor 402 can execute the configuration method of the interface definition according to the first embodiment, or execute the service processing method according to the second embodiment or the third embodiment.
Where the memory and processor are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting together one or more of the various circuits of the processor and the memory. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor.
The processor is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory may be used to store data used by the processor in performing operations.
A fifth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, as can be understood by those skilled in the art, all or part of the steps in the method for implementing the embodiments described above may be implemented by a program instructing related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific embodiments for practicing the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (12)

1. A configuration method of interface definition is applied to a first CDN application server, and the method comprises the following steps:
providing a configuration interface for interface definition in an application program interface;
receiving an interface identifier and configuration information defined by an interface to be configured through the configuration interface; the configuration information comprises interface parameters and a conversion script;
and establishing a mapping relation between the interface identification defined by the interface and the configuration information.
2. The method according to claim 1, wherein the receiving, through the configuration interface, the interface identifier and the configuration information of the interface definition to be configured comprises:
receiving an interface identifier defined by an interface to be configured through an interface identifier input item on the configuration interface;
receiving interface parameters for defining configuration for the interface through an interface parameter configuration item on the configuration interface;
and providing a plurality of preset conversion scripts through the conversion script configuration items on the configuration interface, and receiving a selection command of the conversion scripts in the plurality of conversion scripts through the conversion script configuration items.
3. The interface-defined configuration method according to claim 2, wherein the providing a plurality of preset conversion scripts through the conversion script configuration items on the configuration interface comprises:
identifying a corresponding service access type according to the interface identifier;
and acquiring a plurality of conversion scripts corresponding to the service access types from a preset script library, and displaying the conversion scripts through the configuration items of the conversion scripts.
4. The method according to claim 2, wherein after receiving the interface identifier of the interface definition to be configured through the interface identifier input item on the configuration interface, the method further comprises:
acquiring the characteristic information corresponding to the interface definition through the interface identification, and displaying the characteristic information through a characteristic information display item on the configuration interface; the characteristic information at least comprises a service access type corresponding to the interface definition.
5. The interface defined configuration method of claim 2 wherein the interface parameter configuration items comprise input parameter configuration items, and the interface parameters comprise input parameters; the conversion script configuration items comprise request conversion script configuration items, and the preset conversion scripts comprise a plurality of preset request conversion scripts;
the receiving, by the interface parameter configuration item, the interface parameter configured for the interface definition includes:
receiving input parameters defining configuration for the interface through the input parameter configuration items;
the providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of a conversion script in the plurality of conversion scripts through the conversion script configuration items include:
providing a plurality of preset request conversion scripts through the request conversion script configuration items, and receiving a selection command of the request conversion scripts in the plurality of request conversion scripts through the request conversion script configuration items; the request conversion script is used for converting the parameter value of the input parameter into service data and calling the service function corresponding to the interface definition to realize service processing through the service data.
6. The interface defined configuration method of claim 2 or 5 wherein the interface parameter configuration item comprises an output parameter configuration item and the interface parameter comprises an output parameter; the conversion script configuration items comprise response conversion script configuration items, and the preset conversion scripts comprise a plurality of preset response conversion scripts;
the receiving, by the interface parameter configuration item, the interface parameter configured for the interface definition includes:
receiving an output parameter configured for the interface definition through the output parameter configuration item;
the providing a plurality of preset conversion scripts through the conversion script configuration items, and receiving a selection command of a conversion script in the plurality of conversion scripts through the conversion script configuration items include:
providing a plurality of preset response conversion scripts through the response conversion script configuration items, and receiving a selection command of a response conversion script in the plurality of response conversion scripts through the response conversion script configuration items; the response conversion script is used for converting a service processing result into a parameter value of the output parameter, wherein the service processing result is a result obtained by calling a service function corresponding to the interface definition and realizing service processing.
7. A service processing method is applied to a second CDN application server, and the method comprises the following steps:
receiving a request sent by a client; the request carries interface identification defined by an interface and parameter values of interface parameters;
acquiring configuration information corresponding to the interface identifier of the interface definition carried in the request according to the mapping relation between the interface identifier of the interface definition and the configuration information; wherein the mapping relationship is obtained by the configuration method defined by the interface of any one of claims 1 to 6;
and calling a service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter, so as to realize service processing.
8. The traffic processing method according to claim 7, wherein the interface parameters in the configuration information include input parameters; before the calling the service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter to implement service processing, the method further includes:
performing parameter validity check on the parameter value of the interface parameter based on the parameter type of the input parameter in the configuration information and/or based on the value range of the input parameter in the configuration information;
if the parameter value of the interface parameter passes the parameter validity check, entering the conversion script based on the configuration information and the parameter value of the interface parameter, and calling the service function corresponding to the interface definition to realize the service processing.
9. The transaction processing method of claim 7, wherein the conversion script in the configuration information comprises a request conversion script; the step of calling the service function corresponding to the interface definition based on the conversion script in the configuration information and the parameter value of the interface parameter to realize service processing includes:
and converting the parameter values of the input parameters into service data based on the request conversion script in the configuration information, and calling the service function corresponding to the interface definition through the service data to realize service processing.
10. The service processing method according to claim 9, further comprising, after said performing service processing:
if the service processing is query operation and the conversion script in the configuration information also comprises a response conversion script, converting a service processing result into a parameter value of an output parameter through the response conversion script in the configuration information, and returning a response comprising the parameter value of the output parameter to the client;
and if the service processing is an adding operation, a deleting operation or a modifying operation, sending a response of successful execution of the service processing to the client.
11. A server, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method of configuring an interface as defined in any one of claims 1 to 6 or to perform a method of service processing as defined in any one of claims 7 to 10.
12. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the configuration method of the interface definition of any one of claims 1 to 6, or implements the service processing method of any one of claims 7 to 10.
CN202110049071.0A 2021-01-14 2021-01-14 Configuration method of interface definition, service processing method, server and storage medium Pending CN112860308A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110049071.0A CN112860308A (en) 2021-01-14 2021-01-14 Configuration method of interface definition, service processing method, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110049071.0A CN112860308A (en) 2021-01-14 2021-01-14 Configuration method of interface definition, service processing method, server and storage medium

Publications (1)

Publication Number Publication Date
CN112860308A true CN112860308A (en) 2021-05-28

Family

ID=76006034

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110049071.0A Pending CN112860308A (en) 2021-01-14 2021-01-14 Configuration method of interface definition, service processing method, server and storage medium

Country Status (1)

Country Link
CN (1) CN112860308A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023246486A1 (en) * 2022-06-23 2023-12-28 北京字跳网络技术有限公司 Method and apparatus for creating connector
CN117519837A (en) * 2024-01-02 2024-02-06 暗物智能科技(广州)有限公司 Interface management method and interface management system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7207046B1 (en) * 2000-08-23 2007-04-17 Agilent Technologies, Inc. Method and system for providing string-over-socket scripting language access to distributed object model interfaces
CN109165248A (en) * 2018-01-29 2019-01-08 北京数聚鑫云信息技术有限公司 A kind of management system and management method based on API
CN110175030A (en) * 2019-05-31 2019-08-27 福建南威软件有限公司 A kind of API service gateway processes method
CN111949275A (en) * 2020-07-09 2020-11-17 北京齐尔布莱特科技有限公司 Script deployment method, request processing method and device
CN112039896A (en) * 2020-08-29 2020-12-04 中国平安财产保险股份有限公司 Data processing method, equipment, server and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7207046B1 (en) * 2000-08-23 2007-04-17 Agilent Technologies, Inc. Method and system for providing string-over-socket scripting language access to distributed object model interfaces
CN109165248A (en) * 2018-01-29 2019-01-08 北京数聚鑫云信息技术有限公司 A kind of management system and management method based on API
CN110175030A (en) * 2019-05-31 2019-08-27 福建南威软件有限公司 A kind of API service gateway processes method
CN111949275A (en) * 2020-07-09 2020-11-17 北京齐尔布莱特科技有限公司 Script deployment method, request processing method and device
CN112039896A (en) * 2020-08-29 2020-12-04 中国平安财产保险股份有限公司 Data processing method, equipment, server and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023246486A1 (en) * 2022-06-23 2023-12-28 北京字跳网络技术有限公司 Method and apparatus for creating connector
CN117519837A (en) * 2024-01-02 2024-02-06 暗物智能科技(广州)有限公司 Interface management method and interface management system

Similar Documents

Publication Publication Date Title
CN108153670B (en) Interface testing method and device and electronic equipment
CN110310034B (en) Service arrangement and business flow processing method and device applied to SaaS
CN109814856B (en) Data entry method, device, terminal and computer readable storage medium
CN108881396A (en) Loading method, device, equipment and the computer storage medium of network data
CN112860308A (en) Configuration method of interface definition, service processing method, server and storage medium
CN111831191A (en) Workflow configuration method and device, computer equipment and storage medium
CN114416075A (en) Service processing method and device
CN115883310A (en) Service deployment method, service deployment system, electronic device, and storage medium
CN113806104A (en) Interface access request processing method, API gateway, server and system
CN111131442B (en) Webpage data monitoring method, terminal equipment and readable storage medium
WO2021093672A1 (en) Method for embedding external system, workflow system, device and computer readable storage medium
CN111708536A (en) Page building method and equipment based on component configuration and readable storage medium
US11658930B2 (en) Personalized dashboard chart for email subscriptions
CN113791766B (en) Method for combining data interfaces, electronic device and readable storage medium
CN111045928A (en) Interface data testing method, device, terminal and storage medium
CN113836212B (en) Method for automatically generating Json data by database data, readable medium and electronic equipment
CN113468446B (en) Method, system and equipment for supporting identification of third party two-dimensional code data
CN111294377A (en) Network request sending method of dependency relationship, terminal device and storage medium
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium
CN109298831B (en) Information storage method and device
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN117234512B (en) Method, system, electronic equipment and storage medium for rapidly developing business
CN109445964B (en) Method and device for data transmission with SAP system in external system
CN113452536B (en) Atomic object management method and device
CN112882922B (en) Test method and related device

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