Interface opening method and device, electronic equipment and storage medium

By encapsulating the interface data rules for service call requests and response data, the stability risks and resource waste problems when integrating back-end systems into microservice architectures in the prior art are solved, and resource reuse and cost savings are achieved.

CN119226004APending Publication Date: 2024-12-31XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411280611.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing technology integrates stable back-end systems that did not consider the microservice architecture into the new microservice architecture by overturning and refactoring, which can easily cause human resources to waste and potential system stability risks.

Method used

By responding to the service call request initiated by the requester, the target interface matching the service call request is determined, and the request content and response data are encapsulated according to the interface data identification rules, so as to open the target interface to the requester, thereby reusing the back-end system service.

Benefits of technology

Make full use of existing resources, save costs, reduce system stability risks, and avoid waste of human resources and potential system stability problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226004A_ABST
    Figure CN119226004A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an interface opening method and device, electronic equipment and a storage medium, and relates to the technical field of computers.The method comprises the steps that in response to a service calling request initiated by a requester for a target service, a target interface matched with the service calling request is determined; according to an interface data identification rule corresponding to the target interface, packaging the request content of the service calling request, and sending the packaged request content to the target service through the target interface so as to obtain response data matched with the service calling request from the target service; and packaging the response data according to the interface data identification rule, and feeding back the packaged response data to the requester through the target interface so as to open the target interface to the requester. By adopting the technical scheme of the embodiment of the invention, the existing resources can be fully utilized, the cost is saved, and the system stability risk is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to an interface opening method, device, electronic device and storage medium. Background Art

[0002] Microservice architecture is to split complex and bloated monolithic applications into fine-grained services. Each split service is independently packaged and deployed, and then developed and maintained. To implement the microservice architecture, the general process is to define the OpenApi (Application Programming Interface) first and then develop the backend service. However, in real scenarios, there are many stable backend systems that cannot be integrated into the new microservice architecture because the microservice architecture was not considered during the early architecture design, and need to be overturned and reconstructed.

[0003] However, in the process of implementing the present invention, it is found that there are at least the following problems in the prior art:

[0004] Integrating a stable backend system that did not take the microservice architecture into consideration in the early architectural design into a new microservice architecture by overturning and reconstructing it can easily lead to a waste of human resources and pose a potential risk to system stability. Summary of the invention

[0005] The embodiments of the present invention provide an interface opening method, device, electronic device and storage medium to fully utilize existing resources, save costs and reduce system stability risks.

[0006] In a first aspect, an embodiment of the present invention provides an interface opening method, the method comprising:

[0007] Responding to a service call request for a target service initiated by a requester, determining a target interface that matches the service call request;

[0008] Encapsulating the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sending the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service;

[0009] The response data is encapsulated according to the interface data identification rule, and the encapsulated response data is fed back to the requester through the target interface, so as to open the target interface to the requester.

[0010] In a second aspect, an embodiment of the present invention further provides an interface opening device, the device comprising:

[0011] An interface determination module is used to respond to a service call request initiated by a requester for a target service and determine a target interface that matches the service call request;

[0012] A response data acquisition module, used to encapsulate the request content of the service call request according to the interface data identification rule corresponding to the target interface, and send the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service;

[0013] The data feedback module is used to encapsulate the response data according to the interface data identification rule, and feed back the encapsulated response data to the requester through the target interface to open the target interface to the requester.

[0014] In a third aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:

[0015] one or more processors;

[0016] A memory for storing one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the interface opening method provided by any embodiment of the present invention.

[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the interface opening method provided by any embodiment of the present invention.

[0019] The embodiments of the above invention have the following advantages or beneficial effects:

[0020] The technical solution of the present invention determines the target interface that matches the service call request by responding to the service call request initiated by the requesting party for the target service; encapsulates the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sends the encapsulated request content to the target service through the target interface to obtain response data that matches the service call request from the target service; encapsulates the response data according to the interface data identification rule, and feeds back the encapsulated response data to the requesting party through the target interface to realize opening the target interface to the requesting party. Because the request data and response data are encapsulated according to the interface data rule to achieve the purpose of content adaptation, thereby realizing the technical means of reusing the services of the back-end system, the prior art overcomes the technical problem that the stable back-end system that does not consider the microservice architecture in the early architecture design is integrated into the new microservice architecture by overturning and reconstructing, which is easy to cause waste of human resources and has potential system stability risks, thereby making full use of existing resources, saving costs, and reducing system stability risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A flowchart of an interface opening method provided by an embodiment of the present invention;

[0023] Figure 2 A flowchart of an interface opening method in a specific scenario is provided for this embodiment;

[0024] Figure 3 A schematic diagram of the structure of an interface opening device provided in an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0027] Before introducing the solutions of the present invention, the following background introduction is given.

[0028] 1. The relationship between OpenAPI and microservices is as follows:

[0029] API contract definition: In a microservice architecture, each microservice can expose one or more APIs for communicating with other services or clients. The OpenAPI specification can be used to define and describe the structure, function, and behavior of these APIs. By defining the API contract, microservices can clearly agree on the API input and output formats, available endpoints, parameters, and other information, making the integration between services clearer and more reliable.

[0030] API documentation and interaction: OpenAPI specifications can be used to generate interactive API documentation for developers to review and understand the APIs provided by each microservice. These documents can include detailed descriptions of the API, request examples, response examples, and parameter descriptions, etc., to help other developers correctly use and integrate these services.

[0031] Service discovery and registration: The service discovery and registration mechanism in the microservice architecture can be implemented using the endpoint information defined in the OpenAPI specification. The service registry can register and manage microservices based on the endpoint information in the OpenAPI specification, allowing other services or clients to discover and call specific APIs.

[0032] Code generation and consistency: The OpenAPI specification can be used to generate client and server-side code to use the microservice API in different programming languages ​​and frameworks. Through code generation, it can ensure that different microservices follow the same conventions and specifications when implementing and using APIs, improving the consistency and maintainability of the system.

[0033] 2. OpenAPI usage process

[0034] API documentation generation: OpenAPI specifications can be used to generate interactive API documentation. Developers can use various tools to automatically generate API documentation based on the OpenAPI specification, including request examples, response examples, parameter descriptions, etc. These documents provide a detailed description of the API functions and usage methods, helping other developers better understand and use the API.

[0035] Client code generation: The OpenAPI specification can be used to generate client code to use the API in different programming languages ​​and frameworks. Through code generation, developers can quickly build client applications that interact with the API. The generated client code usually includes the data structure of the API's request and response, network communication logic, etc., reducing the workload of manually writing repetitive code.

[0036] Server-side code generation: The OpenAPI specification can also be used to generate server-side code to implement APIs in different server environments. Through code generation, developers can quickly build server-side API implementations, including request routing and processing logic, parameter validation and processing, etc. The generated server-side code follows the interfaces and behaviors defined in the OpenAPI specification, ensuring the consistency and accuracy of the API.

[0037] API testing and verification: Based on the OpenAPI specification, developers can write automated test scripts to verify the correctness and consistency of the API. By using the structure and verification rules defined by the specification, you can check whether the API's requests and responses meet expectations. Such test scripts can help developers catch potential problems and errors and ensure the consistency and stability of the API in different environments.

[0038] The OpenAPI specification is written in JSON or YAML format and provides a unified way to describe the functions and behaviors of an API so that developers can better understand and use the API. The OpenAPI specification can be used to generate API documentation, perform API testing and verification, and generate client and server code.

[0039] It can be seen from the above steps that in order to realize microservice construction, the general process is to define OpenAPI first and then develop backend services. In real scenarios, many stable backend systems cannot be integrated into the new microservice architecture because the microservice architecture was not considered in the early architecture design. They need to be overturned and reconstructed, resulting in a waste of human resources and potential risks to system stability.

[0040] Figure 1 This is a flow chart of an interface opening method provided by an embodiment of the present invention. This embodiment is applicable to the case of opening the interface of the system backend service. The method can be executed by an interface opening device integrated in the server, and the device can be implemented by software and / or hardware. Figure 1 As shown, the method specifically comprises the following steps:

[0041] S110: respond to the service call request for the target service initiated by the requester, and determine a target interface that matches the service call request.

[0042] The target service may refer to a program, routine or process that executes a specified system function. A service call request may refer to a call request for a target service initiated by a client. For example, a request to access a website may include a service call request. A target interface may refer to an interface that cooperates with the target service to respond to the service call request. The number of target interfaces may be one or more.

[0043] In this embodiment, in response to the service call request initiated by the requester, a corresponding target interface is determined according to the target service targeted by the service call request and the request content.

[0044] In an optional implementation, determining the target interface that matches the service call request may include: obtaining the request method, the path of the requested resource, and the request content corresponding to the service call request; determining the routing rules of the service call request based on the request method, the path of the requested resource, and the request content, the routing rules being used to indicate the target interface that matches the service call request.

[0045] Among them, the request method can be used to define the communication type and purpose, for example, GET (used to request the specified page information and return the entity body. This is the most common request method, used to obtain data from the server), POST (submit data to the specified resource for processing the request, such as submitting a form or uploading a file. The POST request may lead to the creation of new resources or the modification of existing resources), PUT (upload the latest content to the specified resource location, that is, the data transmitted by the client to the server replaces the content of the specified document), DELETE (submit a deletion request) and PATCH (used to locally modify resources). The path of the requested resource may refer to the storage path of the resource requested by the service call request, for example, the website url (uniform resource location). The request content may refer to the request body information of the service call request, which may include the parameters of the request. The routing rules of the service call request may refer to the rules for forwarding the service call request to the destination address.

[0046] In this embodiment, the deployed web service can monitor the service call request, thereby obtaining the request method of the service call request, and then deserialize the request body (json format) to extract the request content such as request parameters, and collect the request parameters into an intermediate container to transmit to the backend service. Then, according to the request method, the path of the request resource, the request parameters, etc., the rule for forwarding the service call request to the destination address is determined, so that according to the rule, which interfaces can cooperate to respond to the service call request can be determined.

[0047] Optionally, after determining the routing rule of the service call request, the method may further include: saving the routing rule in a preset database table; and modifying the routing rule in the preset database table in response to a routing rule modification instruction.

[0048] The preset database table may be an intermediate storage table. The routing rule modification instruction may refer to a modification instruction for the routing rules stored in the preset database table.

[0049] In this embodiment, the routing rules for calling the target service can be saved in a preset database table for repeated use. For example, if there is a need to modify a field in the routing rules, the modification can be completed in the preset database table.

[0050] S120. Encapsulate the request content of the service call request according to the interface data identification rule corresponding to the target interface, and send the encapsulated request content to the target service through the target interface to obtain response data matching the service call request from the target service.

[0051] The interface data identification rule may refer to a rule of a data format that can be identified by the target interface.

[0052] In this embodiment, the existing stable back-end system has not been developed in full compliance with the interface. In order to realize interface opening, the service call request for the target service in the back-end system can be processed according to the data format defined by the target interface (i.e., the interface data identification rule), so that the request content of the processed service call request can be sent to the target service of the back-end system to obtain the response data of the service call request from the target service.

[0053] Specifically, in an optional implementation, the request content of the service call request is encapsulated and processed according to the interface data identification rules corresponding to the target interface, which may include: replacing the parameter name and / or converting the parameter value in the request content according to the input parameter specification corresponding to the interface data identification rule to achieve encapsulation processing of the request content.

[0054] For example, if the service call request is a paging request, and the parameter name in the request content is "Page", and the parameter name that can be recognized by the target service of the back-end system is "P", then "Page" in the request content can be replaced with "P"; if a parameter value in the request content is in a string format, and the parameter value that can be recognized by the target service of the back-end system is a numerical value, then the parameter value in the string format in the request content can be converted to a numerical value.

[0055] In another optional implementation, encapsulating the request content of the service call request according to the interface data identification rules corresponding to the target interface may include: creating a data identification template for the target interface according to the input parameter specifications corresponding to the interface data identification rules; and encapsulating the request content of the service call request according to the data identification template.

[0056] Exemplarily, a corresponding data template can be created using template technology according to the input parameter specifications required by the target interface, and a template engine can be further used to encapsulate the request content of the service call request according to the data template into request data that complies with the target interface specifications.

[0057] Optionally, after creating a data identification template for the target interface according to the input parameter specification corresponding to the interface data identification rule, it may also include: saving the data identification template to a preset database table; and modifying the data identification template in the preset database table in response to a template modification instruction.

[0058] Similar to routing rules, the created data recognition template can be saved in a preset database table instead of being saved as a file. The advantage of this setting is that it is convenient to dynamically modify or load data recognition templates and routing rules.

[0059] Optionally, after modifying the corresponding rules in response to the routing rule modification instruction or the template modification instruction, a distributed coordination tool may be used to configure the synchronous loading of all program nodes executing this solution without restarting the program executing this solution.

[0060] S130, encapsulating the response data according to the interface data identification rule, and feeding back the encapsulated response data to the requester through the target interface, so as to open the target interface to the requester.

[0061] The response data may refer to the response result data of the target service to the service call request.

[0062] In this embodiment, similar to the encapsulation rules of the service call request, in order to enable the front-end requester to obtain the response data, the target interface can also encapsulate the response content of the response data and feed it back to the requester, thereby achieving the purpose of developing the target interface for the requester.

[0063] Optionally, encapsulating the response data according to the interface data identification rules may include: obtaining the response content of the response data; querying a preset database table to obtain a data identification template that matches the target interface; and encapsulating the response content according to the data identification template.

[0064] In this embodiment, after the request content of the encapsulated service call request is sent to the target service, the response data can be obtained, and then the response data (json format) can be deserialized into an object, and then the preset database table can be queried to obtain the data identification template of the target interface, and the template engine can be used to encapsulate the response content of the response data according to the data template and encapsulate it into response data that meets the target interface specification.

[0065] The technical solution of the present invention determines the target interface that matches the service call request by responding to the service call request initiated by the requesting party for the target service; encapsulates the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sends the encapsulated request content to the target service through the target interface to obtain response data that matches the service call request from the target service; encapsulates the response data according to the interface data identification rule, and feeds back the encapsulated response data to the requesting party through the target interface to realize opening the target interface to the requesting party. Because the request data and response data are encapsulated according to the interface data rule to achieve the purpose of content adaptation, thereby realizing the technical means of reusing the services of the back-end system, the prior art overcomes the technical problem that the stable back-end system that does not consider the microservice architecture in the early architecture design is integrated into the new microservice architecture by overturning and reconstructing, which is easy to cause waste of human resources and has potential system stability risks, thereby making full use of existing resources, saving costs, and reducing system stability risks.

[0066] In order to enable those skilled in the art to better understand the interface opening method of this embodiment, Figure 2 A flowchart of an interface opening method in a specific scenario is provided for this embodiment.

[0067] Get the call request of service 2, determine the routing rules (indicating the target interface of service 2) according to the request method, the path of the requested resource and the request content, encapsulate the request data according to the request adaptation rule (data identification template) of the target interface, send the encapsulated request data to service 2, and encapsulate the response data fed back by service 2 according to the response adaptation rule (data identification template) to obtain the encapsulated response data. The routing rules and data identification templates can be saved to the rule table (i.e., the preset database table). If the routing rules are modified or the data identification template is modified in response to the modification instruction, the distributed coordination tool can be used to notify each node to reload the modified rules.

[0068] The following is an embodiment of an interface opening device provided in an embodiment of the present invention. The device and the interface opening method of the above-mentioned embodiment 1 belong to the same inventive concept. For details not described in detail in the embodiment of the interface opening device, reference can be made to the contents of the above-mentioned embodiments.

[0069] Figure 3 A schematic diagram of the structure of an interface opening device provided in an embodiment of the present invention is shown in FIG. Figure 3 As shown, the device specifically includes: an interface determination module 310 , a response data acquisition module 320 and a data feedback module 330 .

[0070] in:

[0071] The interface determination module 310 is used to respond to the service call request initiated by the requester for the target service and determine the target interface matching the service call request;

[0072] A response data acquisition module 320 is used to encapsulate the request content of the service call request according to the interface data identification rule corresponding to the target interface, and send the encapsulated request content to the target service through the target interface to obtain response data matching the service call request from the target service;

[0073] The data feedback module 330 is used to encapsulate the response data according to the interface data identification rule, and feed back the encapsulated response data to the requester through the target interface to open the target interface to the requester.

[0074] The technical solution of the present invention determines the target interface that matches the service call request by responding to the service call request initiated by the requesting party for the target service; encapsulates the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sends the encapsulated request content to the target service through the target interface to obtain response data that matches the service call request from the target service; encapsulates the response data according to the interface data identification rule, and feeds back the encapsulated response data to the requesting party through the target interface to realize opening the target interface to the requesting party. Because the request data and response data are encapsulated according to the interface data rule to achieve the purpose of content adaptation, thereby realizing the technical means of reusing the services of the back-end system, the prior art overcomes the technical problem that the stable back-end system that does not consider the microservice architecture in the early architecture design is integrated into the new microservice architecture by overturning and reconstructing, which is easy to cause waste of human resources and has potential system stability risks, thereby making full use of existing resources, saving costs, and reducing system stability risks.

[0075] Optionally, the interface determination module 310 may be specifically configured to:

[0076] Obtain the request method, requested resource path and request content corresponding to the service call request;

[0077] A routing rule for the service call request is determined according to the request method, the path of the request resource and the request content, wherein the routing rule is used to indicate a target interface that matches the service call request.

[0078] Optionally, the interface opening device further includes a routing rule modification module, which is used to, after determining the routing rule of the service call request:

[0079] Saving the routing rules in a preset database table;

[0080] In response to the routing rule modification instruction, the routing rules in the preset database table are modified.

[0081] Optionally, the response data acquisition module 320 may be specifically used for:

[0082] According to the input parameter specification corresponding to the interface data identification rule, the parameter name in the request content is replaced and / or the parameter value is converted to achieve encapsulation processing of the request content.

[0083] Optionally, the response data acquisition module 320 may be specifically used for:

[0084] Creating a data identification template for the target interface according to an input parameter specification corresponding to the interface data identification rule;

[0085] The request content of the service call request is encapsulated according to the data identification template.

[0086] Optionally, the interface opening device further includes a data identification template modification module, which is used to, after creating the data identification template of the target interface according to the input parameter specification corresponding to the interface data identification rule:

[0087] Saving the data recognition template in a preset database table;

[0088] In response to the template modification instruction, the data identification template in the preset database table is modified.

[0089] Optionally, the data feedback module 330 may be specifically used for:

[0090] Obtaining the response content of the response data;

[0091] Querying the preset database table to obtain a data recognition template matching the target interface;

[0092] The response content is encapsulated according to the data identification template.

[0093] The interface opening device provided in the embodiment of the present invention can execute the interface opening method provided in the first embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the interface opening method.

[0094] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 4 A block diagram of an exemplary server 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The server 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0095] like Figure 4 As shown, the server 12 is in the form of a general purpose computing device. The components of the server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0096] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0097] The server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 12, including volatile and non-volatile media, removable and non-removable media.

[0098] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0099] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0100] The server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the server 12, and / or may communicate with any device that enables the server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the server 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0101] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing an interface opening method provided in the first embodiment of the present invention, the method comprising:

[0102] Responding to a service call request for a target service initiated by a requester, determining a target interface that matches the service call request;

[0103] Encapsulating the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sending the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service;

[0104] The response data is encapsulated according to the interface data identification rule, and the encapsulated response data is fed back to the requester through the target interface, so as to open the target interface to the requester.

[0105] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the interface opening method provided by any embodiment of the present invention.

[0106] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of an interface opening method provided in the above embodiment of the present invention are implemented. The method includes:

[0107] Responding to a service call request for a target service initiated by a requester, determining a target interface that matches the service call request;

[0108] Encapsulating the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sending the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service;

[0109] The response data is encapsulated according to the interface data identification rule, and the encapsulated response data is fed back to the requester through the target interface, so as to open the target interface to the requester.

[0110] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0111] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0112] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0113] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0114] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0115] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. An interface opening method, characterized in that: The method comprises: Responding to a service call request for a target service initiated by a requester, determining a target interface that matches the service call request; Encapsulating the request content of the service call request according to the interface data identification rule corresponding to the target interface, and sending the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service; The response data is encapsulated according to the interface data identification rule, and the encapsulated response data is fed back to the requester through the target interface, so as to open the target interface to the requester.

2. The method according to claim 1, characterized in that Determining a target interface that matches the service call request includes: Obtain the request method, requested resource path and request content corresponding to the service call request; A routing rule for the service call request is determined according to the request method, the path of the request resource and the request content, wherein the routing rule is used to indicate a target interface that matches the service call request.

3. The method according to claim 2, characterized in that After determining the routing rule of the service call request, the method further includes: Saving the routing rules in a preset database table; In response to the routing rule modification instruction, the routing rules in the preset database table are modified.

4. The method according to claim 1, characterized in that: According to the interface data identification rule corresponding to the target interface, encapsulating the request content of the service call request includes: According to the input parameter specification corresponding to the interface data identification rule, the parameter name in the request content is replaced and / or the parameter value is converted to achieve encapsulation processing of the request content.

5. The method according to claim 1, characterized in that According to the interface data identification rule corresponding to the target interface, encapsulating the request content of the service call request includes: Creating a data identification template for the target interface according to an input parameter specification corresponding to the interface data identification rule; The request content of the service call request is encapsulated according to the data identification template.

6. The method according to claim 5, characterized in that After creating the data identification template of the target interface according to the input parameter specification corresponding to the interface data identification rule, the method further includes: Saving the data recognition template in a preset database table; In response to the template modification instruction, the data identification template in the preset database table is modified.

7. The method according to claim 6, characterized in that The response data is encapsulated according to the interface data identification rule, including: Obtaining the response content of the response data; Querying the preset database table to obtain a data recognition template matching the target interface; The response content is encapsulated according to the data identification template.

8. An open device for an open application program interface, characterized in that: include: An interface determination module is used to respond to a service call request initiated by a requester for a target service and determine a target interface that matches the service call request; A response data acquisition module, used to encapsulate the request content of the service call request according to the interface data identification rule corresponding to the target interface, and send the encapsulated request content to the target service through the target interface, so as to obtain response data matching the service call request from the target service; The data feedback module is used to encapsulate the response data according to the interface data identification rule, and feed back the encapsulated response data to the requester through the target interface to open the target interface to the requester.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the interface opening method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the interface opening method described in any one of claims 1 to 7 is implemented.