Service interface access method, device, electronic device and medium

By generating structured objects at the gateway level, the problem of inconsistent formats of external requests and internal service parameters is solved, the access success rate is improved, and maintenance costs are reduced, and efficient request forwarding is achieved.

CN112379951BActive Publication Date: 2024-11-05BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011307604.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-19
Publication Date
2024-11-05
Estimated Expiration
2040-11-19

AI Technical Summary

Technical Problem

In the context of computer and Internet technology development, external requests cannot directly access internal services, resulting in the problem of request forwarding failure, mainly due to the inconsistent parameter format of external requests and internal services, resulting in high development and maintenance costs.

Method used

By receiving external requests at the gateway level, structured objects are generated based on the metadata structure of the service interface, and parameter format conversion is performed to ensure that the requested parameters meet the format requirements of the internal service, thereby realizing automatic parameter conversion and request forwarding.

Benefits of technology

It improves the access success rate, reduces the workload of developers, reduces the system maintenance costs caused by parameter format changes, and significantly improves the problem of external request forwarding failure in mini-program scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112379951B_ABST
    Figure CN112379951B_ABST
Patent Text Reader

Abstract

The present application discloses a method for accessing a service interface, and relates to the field of metadata processing and interface technology. The specific implementation scheme is: receiving an access request for a service interface, the access request including at least one interface parameter; generating a structured object based on at least one interface parameter of the access request according to the structure of metadata of the service interface; and using the structured object to access the service interface. The present application also discloses a device for accessing a service interface, an electronic device, and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to metadata processing and interface technology. More specifically, the present application provides a method, device, electronic device and storage medium for accessing a service interface. Background Art

[0002] With the continuous development of computer and Internet technologies, various applications have emerged. Some of the data that applications rely on when providing services for external requests comes from internal services. For security reasons, external requests cannot directly access internal services. Generally, it is necessary to forward external requests to internal services at the proxy gateway level. However, due to different business scenarios, the request data of external requests may not be consistent with that of internal services in data form, which can easily cause request forwarding failure. Summary of the invention

[0003] Provided are a method, device, electronic device and storage medium for accessing a service interface.

[0004] According to a first aspect, a method for accessing a service interface is provided, the method comprising: receiving an access request for a service interface, the access request comprising at least one interface parameter; generating a structured object based on at least one interface parameter of the access request according to a structure of metadata of the service interface; and using the structured object to access the service interface.

[0005] According to a second aspect, a device for accessing a service interface is provided, the device comprising: receiving an access request for a service interface, the access request comprising at least one interface parameter; generating a structured object based on at least one interface parameter of the access request according to a structure of metadata of the service interface; and using the structured object to access the service interface.

[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method for accessing a service interface provided in the present application.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method for accessing the service interface provided in the present application.

[0008] According to a fifth aspect, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by the computer, the method as described above is implemented.

[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0011] Figure 1 It is an exemplary system architecture of a method and apparatus for accessing an application service interface according to an embodiment of the present application;

[0012] Figure 2 is a flowchart of a method for accessing a service interface according to an embodiment of the present application;

[0013] Figure 3 is a flowchart of a method for generating a structured object according to an embodiment of the present application;

[0014] Figure 4 is a flow chart of a method for establishing a structure according to an embodiment of the present application;

[0015] Figure 5 is a flowchart of a method for determining a mapping relationship according to an embodiment of the present application;

[0016] Figure 6 is a flowchart of a method for determining a mapping relationship according to another embodiment of the present application;

[0017] Figure 7 is a flowchart of a method for determining a mapping relationship according to another embodiment of the present application;

[0018] Figure 8 is a schematic diagram of a configuration interface according to an embodiment of the present application;

[0019] Fig. 9 is a block diagram of a device for accessing a service interface according to an embodiment of the present application; and

[0020] Fig.10 The present invention is a block diagram of an electronic device for a method of accessing a service interface according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0022] With the continuous development of computer and Internet technology, various applications have emerged, and various Internet companies have launched their own mini-program applications. Some of the data that various applications or mini-programs rely on when providing services comes from internal services. For security reasons, external requests cannot directly access internal services. Therefore, it is generally necessary to forward external requests to internal services at the proxy gateway level. The gateway can forward requests by configuring the corresponding relationship between the external request URL and the internal service interface URL, which implements the mapping and forwarding at the URL path level. However, the request data of external requests may not be completely consistent with the internal service in data form due to different business scenarios. For example, the parameters of the external get request are username=test, id=2, while the request type of the corresponding internal URL is post, and in the internal service, id and username are encapsulated into a composite object user. The interface shows that it needs to receive the user object, which will cause the request to be forwarded incorrectly. If a large amount of hard coding appears at the internal service interface level to convert the parameters of the external request, once the format of the external request parameters changes, the corresponding internal service interface code needs to be modified, resulting in high development and maintenance costs.

[0023] Figure 1 1 is an exemplary system architecture 100 to which a method and apparatus for accessing a service interface can be applied according to an embodiment of the present application. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present application can be applied, in order to help those skilled in the art understand the technical content of the present application, but it does not mean that the embodiments of the present application cannot be used in other devices, systems, environments or scenarios.

[0024] like Figure 1 As shown, the system architecture 100 according to this embodiment may include multiple terminal devices 101, a network 102, a gateway 103, and a server 104. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired and / or wireless communication links, etc.

[0025] Various communication client applications may be installed on the terminal device 101. The terminal device 101 may be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. The gateway 103 may be an electronic device for forwarding external requests to internal services. The server 104 may be an electronic device with certain computing capabilities that can provide various application services or small program services.

[0026] The user can use the terminal device 101 to interact with the gateway 103 through the network 102 to receive or send messages, etc. Exemplarily, the user enters the user name and password of the application through the terminal device 101, and the terminal device 101 sends an external URL request including the user name and password to the gateway 103. The gateway 103 converts the external URL request into an internal URL request and forwards the request to the server 104. The server 104 analyzes and processes the received request and other data, and feeds back the processing results (such as the login webpage, prompt information, etc. obtained or generated according to the user request) to the terminal device 101 through the forwarding of the gateway 103.

[0027] Figure 2 It is a flowchart of a method for accessing a service interface according to an embodiment of the present application.

[0028] like Figure 2 As shown, the service interface access method 200 may include operations S210 to S230.

[0029] In operation S210, an access request for a service interface is received, where the access request includes at least one interface parameter.

[0030] According to an embodiment of the present application, a service interface may be an interface for data interaction provided by an application in a distributed system. There are multiple service interfaces in a distributed system, some of which are interfaces for interacting with external devices, and some of which are interfaces for interacting with internal processes. For interfaces for interacting with the outside, there is a problem of formatting the parameters of external requests. Therefore, the interface to which the embodiment of the present application is directed may be a service interface for interacting with the outside among multiple service interfaces provided by an application in a distributed system, and these service interfaces may be marked by annotation information. When implementing the embodiment of the present application, multiple interfaces of the distributed system are scanned to determine the service interface with annotation information as the designated service interface.

[0031] According to an embodiment of the present application, when an external request is made to access, the external request needs to provide interface parameters. When the gateway forwards the external request to the interface, the external URL request is converted into an internal URL request, and then the internal URL request is forwarded to the service interface.

[0032] In operation S220, a structured object is generated based on at least one interface parameter of the access request according to the structure of the metadata of the service interface.

[0033] According to the embodiment of the present application, in addition to converting the external URL request into the internal URL request, the gateway also needs to convert the parameter format in the request into a format that meets the service interface requirements. Specifically, according to the structure of the metadata of the service interface, the interface parameters in the access request can be converted into a structured interface object, and the structured interface object has the same structure as the metadata of the service interface, and therefore meets the format requirements of the service interface.

[0034] According to an embodiment of the present application, metadata refers to data that describes data, and the metadata of a service interface may be a field that describes interface parameters. Exemplarily, the types of metadata may include basic types, composite types, and collection types. Basic types of metadata include a field for an interface parameter. For example, metadata A is data that describes an interface parameter as a username. Metadata A may be represented as string username, which represents a username field, and its type is character type. For another example, metadata B is data that describes an interface parameter as a user ID. Metadata B may be represented as int userid, which represents a user ID field, and its type is numeric type, and so on. For basic types of metadata, when a gateway receives an external request for the metadata, the external request includes interface parameters of the same type as the metadata. For example, the external request includes a username name, and name may be directly mapped to the username field of metadata A.

[0035] Metadata of a composite type includes multiple fields, and the multiple fields can be of different types. For example, metadata C is data describing user information, and metadata C can be expressed as user{string username, int userid, int userage}. The composite type metadata C includes a username field of character type, a user ID field of numeric type, and an age field of character type. Among them, the various fields in the composite type metadata C are not directly displayed to the outside world, but a user object is exposed to the external service. When the gateway receives an external request for the composite type metadata, the external request may include the name, id, and age fields. Based on the structure of metadata C, the gateway can generate a structured interface object user from the parameters name, id, and age in the external request. The structured interface object user has the same structure as metadata C and meets the format requirements for receiving parameters in the service interface.

[0036] The metadata of the collection type includes multiple fields, and multiple fields are of the same type. For example, metadata D is data describing user group information, which can be represented as a list <username>{string username1, string username2, string username3}. The metadata D of this collection type includes multiple username fields, and the types of these multiple username fields are the same, all of which are character type. The various fields in the metadata D of this collection type are not directly displayed to the outside world. What is exposed to external services is a list object. When the gateway receives an external request for the metadata of this collection type, the external request may include the fields name1, name2, and name3. Based on the structure of the collection metadata D, the gateway can generate a structured interface object list for the parameters name1, name2, and name3 in the external request. The structured interface object list has the same structure as the metadata D of the collection type and meets the format requirements for receiving parameters in the service interface.

[0037] In operation S230 , the service interface is accessed using the structured object.

[0038] According to an embodiment of the present application, the gateway assigns the structured interface object to the corresponding metadata in the service interface, for example, assigning the user object to the metadata C in the interface, assigning the list object to the metadata D in the service interface, etc. The service interface performs data processing according to the structured object to provide user services. For example, user identity information is verified according to the user name, password, and age in the user object.

[0039] According to an embodiment of the present application, an access request for a service interface is received, a structured object is generated based on at least one interface parameter of the access request according to the structure of the metadata of the service interface, and the service interface is accessed using the structured object. Since the structured object is generated based on the parameters in the external request according to the structure of the metadata inside the service interface, the structured object meets the requirements of the service interface for the parameter format, and can avoid request failures caused by inconsistent parameter formats, thereby improving the access success rate.

[0040] Furthermore, compared to the related art in which developers hard-code the conversion of external request parameters at the internal service interface level, the embodiment of the present application generates structured objects for the parameters of external requests at the gateway level, which can achieve automatic parameter conversion and request forwarding at the gateway level, avoiding a large amount of hard coding in the system due to changes in the external request parameter format or the internal method metadata format, thereby greatly reducing the workload of developers and significantly improving the problem of external request forwarding failure in the mini program scenario.

[0041] Figure 3 is a flowchart of a method for generating a structured object according to an embodiment of the present application.

[0042] like Figure 3 As shown, the method for generating a structured object may include operations S321 to S322.

[0043] In operation S321, a mapping relationship between at least one interface parameter of an access request and at least one field of a pre-established structure is determined, and the structure has the same structure as metadata of a service interface.

[0044] According to an embodiment of the present application, for metadata of a service interface, a structure having the same structure as the metadata is pre-constructed. Exemplarily, for metadata A of a basic type used to describe username information, metadata A can be represented as string username, and metadata A includes a field username. Structure 1 can be constructed for metadata A, and structure 1 can be represented as struct{username}.

[0045] For metadata C of a composite type used to describe user information, metadata C can be expressed as user{stringusername, int userid, int userage}, which includes a username field of character type, a user ID field of numeric type, and an age field of character type. Structure 2 can be constructed for metadata C. Structure 2 has the same structure as metadata C. Structure 2 can be expressed as user{username, userid, userage}, and the fields in structure 2 correspond to the fields in metadata C one by one.

[0046] For metadata D of the collection type used to describe user group information, metadata D can be expressed as a list <username>{string username1, string username2, string username3}, which includes multiple character-type username fields. Structure 3 can be constructed for metadata D. Structure 3 has the same structure as metadata D. Structure 3 can be represented as a list <username>{username1, username2, username3}, the fields in structure 3 correspond one-to-one to the fields in metadata D.

[0047] According to an embodiment of the present application, the interface parameter (name) in access request 1 corresponds to the field (username) in structure 1. The interface parameters (name, id and age) in access request 2 correspond one-to-one to the fields (username, userid and userage) in structure 2. The interface parameters (name1, name2 and name3) in access request 3 correspond one-to-one to the fields (username1, username2 and username3) in structure 3.

[0048] In operation S322, at least one interface parameter is assigned to each field of the structure according to the mapping relationship to generate a structured object.

[0049] According to an embodiment of the present application, according to the correspondence between the interface parameter (name) in the access request and the field (username) in the structure 1, the interface parameter in the access request 1 can be generated into a struct object. According to the correspondence between the interface parameters (name, id and age) in the access request and the fields (username, userid and userage) in the structure 2, the interface parameters in the access request 2 can be generated into a user object. According to the correspondence between the interface parameters (name1, name2 and name3) in the access request 3 and the fields (username1, username2 and username3) in the structure 3, the interface parameters in the access request can be generated into a list object.

[0050] Figure 4 is a flow chart of a method for establishing a structure according to an embodiment of the present application.

[0051] like Figure 4 As shown, the method for establishing a structure may include operations S411 to S412.

[0052] In operation S411 , a structure of metadata of a service interface is determined, the metadata including at least one interface parameter field arranged in a structure.

[0053] In operation S412, a structure having a plurality of fields is generated according to the structure of the metadata, and the plurality of fields of the structure are arranged according to the same structure as the metadata.

[0054] According to an embodiment of the present application, the metadata of the service interface can be read by reflection to determine the fields in the metadata. Different types of metadata have different structures. For metadata A of the basic type used to describe username information, metadata A can be represented as string username, and the username field of metadata A is arranged according to the structure of metadata A.

[0055] For metadata C of a composite type used to describe user information, metadata C is expressed as user{string username, int userid, int userage}, where the username field, userid field, and userage are arranged according to the structure of metadata C.

[0056] For metadata D of the collection type used to describe user group information, metadata D is represented as a list <username>{string username1, string username2, string username3}, where the username1, username2, and username3 fields are arranged according to metadata D.

[0057] Figure 5 It is a flowchart of a method for determining a mapping relationship according to an embodiment of the present application.

[0058] like Figure 5 As shown, the method for determining the mapping relationship may include operations S5321 to S5322.

[0059] In operation S5321, a structure for the access request is selected from a plurality of structures as a target structure according to at least one interface parameter of the access request.

[0060] In operation S5322, a mapping relationship between at least one interface parameter of the access request and at least one field of the target structure is determined.

[0061] According to an embodiment of the present application, a service interface may include multiple types of metadata, for example, the service interface includes metadata A of a basic type, metadata B of a composite type, and metadata C of a collection type. A structure set of the service interface may be generated for each metadata structure, and the structure set may be represented as, for example, json schema {structure 1, structure 2, structure 3}. The ID of the service interface and the json schema for the service interface may be saved in a database, with the ID of the service interface as the key value, and the json schema of the service interface may be queried by inputting the ID of the service interface.

[0062] According to an embodiment of the present application, when an access request is received, the target structure in the json schema can be determined based on the parameters in the access request. For example, if the parameters in the access request include name, id, and age, structure 2 can be selected as the target structure, and the parameters name, id, and age can be mapped to the username, userid, and userage fields. For another example, if the parameters in the access request include name1, name2, and name3, structure 3 can be determined as the target structure, and the parameters name1, name2, and name3 can be mapped to the username1, username2, and username3 fields.

[0063] Figure 6 is a flowchart of a method for determining a mapping relationship according to another embodiment of the present application.

[0064] like Figure 6 As shown, the method for determining the mapping relationship may include operations S6321 to S6322.

[0065] In operation S6321, a mapping rule between an interface parameter and a field of a structure is determined according to a historical mapping relationship between at least one interface parameter in a historical access request and at least one field of a structure.

[0066] In operation S6322, a mapping relationship between at least one interface parameter of the access request and at least one field of the structure is determined according to the mapping rule.

[0067] According to an embodiment of the present application, after receiving an access request, the service interface is determined based on the access path, and the structure set json schema of the metadata of the service interface is obtained. The parameters in the access request are obtained, and the historical mapping relationship between the parameters in the current request and the fields in the json schema is determined based on the historical mapping relationship between the parameters of the historical access requests for the same access path and the fields in the json schema. Exemplarily, parameter 1 and parameter 2 in the historical access request for the same access path as the current request correspond to field 1 and field 2 in the json schema, and parameter 3 and parameter 4 in the current access request correspond to field 1 and field 2 in the json schema.

[0068] Figure 7 is a flowchart of a method for determining a mapping relationship according to another embodiment of the present application.

[0069] like Figure 7 As shown, the method for determining the mapping relationship may include operations S7321 to S7322.

[0070] In operation S7321, in response to the access request, a configuration interface is displayed, where the configuration interface presents at least one interface parameter in the access request and at least one field of the structure.

[0071] In operation S7322, based on the user input in the configuration interface, a mapping relationship between at least one interface parameter of the access request and at least one field of the structure is determined.

[0072] According to an embodiment of the present application, the gateway may provide a visual configuration interface, and after receiving an access request, the configuration interface is displayed in response to the access request. The user may perform a unified mapping configuration between the parameters of the external request and the fields in the structure of the internal service interface on the configuration interface. The configured mapping relationship may be saved so that subsequent external requests for the same access path may automatically perform data mapping and forwarding according to the configured mapping rules.

[0073] Figure 8 is a schematic diagram of a configuration interface according to an embodiment of the present application.

[0074] like Figure 8 As shown, the first display area 801 of the configuration interface presents the parameters in the external access request, such as parameter 1 name, parameter 2 id, parameter 3 age and parameter 4 sex. The second display area 802 of the configuration interface presents the fields in the structure for the service interface, including the fields username, userid, userage and usersex. The user can perform configuration operations. In response to the configuration operations, parameter 1 name in the external request corresponds to the field username in the structure, parameter 2 id corresponds to the field userid in the structure, parameter 3 age corresponds to the field userage in the structure, and parameter 4 sex corresponds to the field usersex in the structure.

[0075] like Figure 8 As shown, the configuration interface can also display the structured object user generated after mapping. The structured object user corresponds to the composite metadata in the service interface. The composite metadata includes username, userid, userage and usersex. The fields of the structured object user are assigned one by one to the interface parameter fields of the metadata, so that the fields of the metadata in the service interface have specific parameter values, and can run applications based on the specific parameter values ​​to perform data processing and other services.

[0076] Fig. 9 It is a block diagram of a device for accessing a service interface according to an embodiment of the present application.

[0077] like Fig. 9 As shown, the access device 900 of the service interface may include a receiving module 901 , a generating module 902 and an access module 903 .

[0078] The receiving module 901 is used to receive an access request for a service interface, where the access request includes at least one interface parameter.

[0079] The generating module 902 is used to generate a structured object based on at least one interface parameter of the access request according to the structure of the metadata of the service interface.

[0080] The access module 903 is used to access the service interface using structured objects.

[0081] According to an embodiment of the present application, the generating module 902 includes a first determining unit and a first generating unit.

[0082] The first determining unit is used to determine a mapping relationship between at least one interface parameter of the access request and at least one field of a pre-established structure, and the structure has the same structure as metadata of the service interface.

[0083] The first generating unit is used to allocate at least one interface parameter to each field of the structure according to the mapping relationship to generate a structured object.

[0084] According to an embodiment of the present application, the service interface access device 900 further includes an establishment module. The establishment module includes a second determination unit and a second generation unit.

[0085] The second determining unit is used to determine a structure of metadata of the service interface, where the metadata includes at least one interface parameter field arranged in a structure.

[0086] The second generating unit is used to generate a structure having multiple fields according to the structure of the metadata, and the multiple fields of the structure are arranged according to the same structure as the metadata.

[0087] According to an embodiment of the present application, the service interface has a plurality of metadata, and a plurality of structures are pre-established for the plurality of metadata respectively. The first determination unit includes a selection subunit and a first determination subunit.

[0088] The selection subunit is used to select a structure corresponding to the access request as a target structure from a plurality of structures according to at least one interface parameter of the access request.

[0089] The first determining subunit is used to determine a mapping relationship between at least one interface parameter of an access request and at least one field of a target structure.

[0090] According to an embodiment of the present application, the first determining unit includes a second determining subunit and a third determining subunit.

[0091] The second determining subunit is used to determine a mapping rule between an interface parameter and a field of the structure according to a historical mapping relationship between at least one interface parameter in a historical access request and at least one field of the structure.

[0092] The third determining subunit is used to determine a mapping relationship between at least one interface parameter of the access request and at least one field of the structure according to a mapping rule.

[0093] According to an embodiment of the present application, the first determining unit includes a display subunit and a fourth determining subunit.

[0094] The display subunit is used to display a configuration interface in response to an access request, where the configuration interface presents at least one interface parameter in the access request and at least one field of the structure.

[0095] The fourth determining subunit is used to determine a mapping relationship between at least one interface parameter of the access request and at least one field of the structure based on the user input in the configuration interface.

[0096] According to an embodiment of the present application, the access module 903 is used to assign the interface parameters in each field of the structured object to each interface parameter field of the metadata of the service interface in a one-to-one correspondence.

[0097] According to an embodiment of the present application, the structure includes a field for an interface parameter.

[0098] According to an embodiment of the present application, the structure includes multiple fields, and the multiple fields are respectively for multiple different types of interface parameters.

[0099] According to an embodiment of the present application, the structure includes multiple fields, and the multiple fields are respectively for multiple interface parameters of the same type.

[0100] According to an embodiment of the present application, the service interface is a pre-specified application program interface among multiple application program interfaces in a distributed system.

[0101] According to an embodiment of the present application, the present application further provides an electronic device, a readable storage medium and a computer program product. The computer program product may include a computer program, and when the computer program is executed by the computer, the method described above is implemented.

[0102] like Fig.10 , is a block diagram of an electronic device according to a method for accessing a service interface of an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0103] like Fig.10 As shown, the electronic device 1000 includes: one or more processors 1001, a memory 1002, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 1001 is taken as an example.

[0104] The memory 1002 is a non-transient computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for accessing the service interface provided in the present application. The non-transient computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the method for accessing the service interface provided in the present application.

[0105] The memory 1002 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the method for accessing the service interface in the embodiment of the present application (for example, the attached Fig. 9 The processor 1001 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1002, that is, implements the access method of the service interface in the above method embodiment.

[0106] The memory 1002 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created by the use of the electronic device 1000 according to the access method of the service interface, etc. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1002 may optionally include a memory remotely arranged relative to the processor 1001, and these remote memories may be connected to the electronic device 1000 of the access method of the service interface via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0107] The electronic device 1000 of the service interface access method may further include: an input device 1003 and an output device 1004. The processor 1001, the memory 1002, the input device 1003 and the output device 1004 may be connected via a bus or other means. Fig.10 The example of connecting through bus is taken in the following.

[0108] The input device 1003 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device 1000 of the access method of the service interface, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 1004 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0109] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0110] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0111] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0112] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0113] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0114] According to the technical solution of the embodiment of the present application, an access request for the service interface is received, a structured object is generated based on at least one interface parameter of the access request according to the structure of the metadata of the service interface, and the service interface is accessed using the structured object. Since the parameters in the external request are generated into a structured object according to the structure of the metadata inside the service interface, the structured object meets the requirements of the service interface for the parameter format, and can avoid request failures caused by inconsistent parameter formats, thereby improving the access success rate.

[0115] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0116] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.< / username> < / username> < / username> < / username>

Claims

1. A method for accessing a service interface, comprising: receiving an access request for the service interface, the access request comprising at least one interface parameter; generating a structured object based on at least one interface parameter of the access request according to the structure of the metadata of the service interface; using the structured object to access the service interface; The generating of the structured object based on at least one interface parameter of the access request comprises: Determining a service interface based on the access path of the access request; Acquire a metadata structure set of the service interface, wherein the metadata structure set includes a plurality of structures, and each structure includes at least one field; Determine historical access requests that belong to the same access path as the access request; Determine, according to the mapping relationship between the interface parameters in the historical access request and the fields in the metadata structure set, a mapping relationship between at least one interface parameter in the access request and the fields in the metadata structure set; According to the mapping relationship between at least one interface parameter in the access request and the fields in the metadata structure set, the at least one interface parameter is allocated to the fields in the metadata structure set to generate the structured object.

2. The method according to claim 1 further comprises establishing a structure, wherein the establishing a structure comprises: determining a structure of metadata of the service interface, the metadata comprising at least one interface parameter field arranged in the structure; A structure having a plurality of fields is generated according to the structure of the metadata, wherein the plurality of fields of the structure are arranged in the same structure as the metadata.

3. The method according to claim 1, wherein: The service interface has a plurality of metadata, and a plurality of structures are pre-established for the plurality of metadata respectively, and the determining of a mapping relationship between at least one interface parameter of the access request and at least one field of the pre-established structure comprises: Selecting a structure corresponding to the access request as a target structure from the plurality of structures according to at least one interface parameter of the access request; A mapping relationship between at least one interface parameter of the access request and at least one field of the target structure is determined.

4. The method according to claim 1, wherein: Determining a mapping relationship between at least one interface parameter of the access request and at least one field of a pre-established structure includes: In response to the access request, display a configuration interface, wherein the configuration interface presents at least one interface parameter in the access request and at least one field of the structure; Based on the user input in the configuration interface, a mapping relationship between at least one interface parameter of the access request and at least one field of the structure is determined.

5. The method according to claim 1, wherein: The using the structured object to access the service interface comprises: The interface parameters in each field of the structured object are assigned one-to-one to each interface parameter field of the metadata of the service interface.

6. The method according to claim 1, wherein: The structure includes one field for one interface parameter.

7. The method according to claim 1, wherein: The structure includes multiple fields, and the multiple fields are respectively for multiple different types of interface parameters.

8. The method according to claim 1, wherein: The structure includes multiple fields, and the multiple fields are respectively for multiple interface parameters of the same type.

9. The method according to claim 1, wherein: The service interface is a pre-specified application program interface among a plurality of application program interfaces in a distributed system.

10. A device for accessing a service interface, comprising: A receiving module, configured to receive an access request for the service interface, wherein the access request includes at least one interface parameter; A generating module, configured to generate a structured object based on at least one interface parameter of the access request according to the structure of the metadata of the service interface; An access module, configured to access the service interface using the structured object; Wherein, the generation module is further used to determine the service interface based on the access path of the access request; obtain a metadata structure set of the service interface, the metadata structure set includes multiple structures, each structure includes at least one field; determine the historical access request belonging to the same access path as the access request; determine the mapping relationship between at least one interface parameter in the access request and the field in the metadata structure set according to the mapping relationship between the interface parameters in the historical access request and the field in the metadata structure set; According to the mapping relationship between at least one interface parameter in the access request and the fields in the metadata structure set, the at least one interface parameter is allocated to the fields in the metadata structure set to generate the structured object.

11. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.

12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 9.

13. A computer program product, comprising a computer program, wherein the computer program is executed by the computer to implement the method according to any one of claims 1 to 9.