Open API (Application Program Interface) full-process processing method and device, equipment and medium

Through the API configuration interface and common component configuration, combined with service contracts and consumption records, early warning and downgrade strategies are implemented to solve the problems of low API development efficiency and unreasonable resource allocation, and achieve reasonable sharing and efficient use of API resources.

CN118567756APending Publication Date: 2024-08-30CAOS IOT TECHNOLOGY CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311317273.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-11
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the existing technology, API development efficiency in the industrial Internet field is low and lacks unified management capabilities, resulting in unreasonable allocation of API shared resources and inability to effectively improve the development efficiency of business APIs.

Method used

Obtain API configuration information through the API configuration interface, configure common components, including service authentication, circuit breaker, flow control and metering components, release after joint testing and verification, and perform early warning or downgrade according to the API consumption agreement and user consumption record in the service contract. Policy to restrict user calls.

Benefits of technology

It improves the efficiency of API development, realizes the reasonable configuration and sharing of API resources, and enhances the user experience and developer efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567756A
    Figure CN118567756A
Patent Text Reader

Abstract

The invention belongs to the technical field of software, and particularly relates to an open API full-process processing method and device, equipment and a medium, and the method comprises the steps: obtaining API configuration information through an API configuration interface, and obtaining a mapping relation between an external URL of an API and a back-end service according to the configuration information; performing universal component configuration on the API to obtain a configured open API; performing test joint debugging verification on the open API to determine that the open API can respond normally, and issuing the open API; and after the open API is published to the application market, obtaining a service contract between the open API and a corresponding user, and according to an API consumption agreement in the service contract and a consumption record of the user, determining whether to execute a corresponding early warning or degradation strategy for the user to call the open API so as to limit the user to call the open API. According to the method, an open API full-process processing scheme which can be applied to the industrial internet is provided, the development efficiency and the use efficiency are improved, and the user experience is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of software technology, and specifically relates to an open API full-process processing method, device, equipment and medium. Background Art

[0002] Currently, the industrial Internet field has many services that can be provided to the outside world. When customers need these services, they usually connect to each other separately. And when these APIs provide services to the outside world, each service needs to provide a set of authentication and current limiting related configurations, which makes development more difficult and leads to long delivery time.

[0003] Therefore, the existing technology cannot improve the development efficiency of business APIs because services are provided individually and lack the ability to manage services in a unified manner. In addition, it cannot reasonably and effectively allocate resources for API shared resources. Summary of the invention

[0004] In order to solve the problem that the existing technology cannot improve the development efficiency of business APIs and cannot reasonably and effectively allocate resources for API shared resources, the present application provides an open API full-process processing method, device, equipment and medium.

[0005] In a first aspect, the present application provides an open API full-process processing method, wherein the method comprises:

[0006] Obtain API configuration information through the API configuration interface, the API configuration information includes API basic information, defines API requests and backend services, and obtains the mapping relationship between the external URL of the API and the backend service based on the configuration information;

[0007] Performing general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component;

[0008] Testing and verifying the open API to ensure that the open API can respond normally, and publishing the open API;

[0009] After the open API is published to the application market, the service contract between the open API and the corresponding user is obtained, and according to the API consumption agreement in the service contract and the consumption record of the user, it is determined whether to execute a corresponding warning or downgrade strategy for the user's call to the open API to restrict the user from calling the open API.

[0010] In a possible implementation, determining whether to execute a corresponding warning for the user calling the open API according to the API consumption agreement in the service contract and the consumption record of the user includes:

[0011] Obtain the agreed consumption times and agreed consumption duration in the API consumption agreement;

[0012] Based on the actual number of consumption times and the remaining consumption time of the user recorded in the consumption record, determine whether the user has reached the warning condition corresponding to the warning, and issue a warning to the user who has reached the warning condition to remind the user that the service contract is about to expire.

[0013] In a possible implementation manner, determining whether the user meets the warning condition corresponding to the warning includes:

[0014] Obtaining a consumption frequency threshold and a consumption duration threshold in the warning rule, wherein the consumption frequency threshold and the consumption duration threshold are respectively less than the agreed consumption frequency and the agreed consumption duration;

[0015] If the actual number of consumption times is greater than or equal to the consumption times threshold, or the remaining consumption time is greater than or equal to the consumption time threshold, then the user has reached the warning condition.

[0016] In a possible implementation, the method further includes:

[0017] If the actual number of consumption times of the API service by the user is equal to the agreed number of consumption times, or the remaining consumption time is zero, a first downgrade strategy is executed, wherein the first downgrade strategy includes: retaining the user's right to use the basic service items of the open API, and closing the user's right to use items other than the basic service items;

[0018] Acquire the actual execution duration according to the start time of executing the first downgrade strategy and the current time, and determine whether the actual execution duration is greater than or equal to the preset duration;

[0019] If so, a second downgrade strategy is executed for the user, where the second downgrade strategy is used to instruct to close the user's right to use the basic service item.

[0020] In a possible implementation, the obtaining of API configuration information through the API configuration interface includes:

[0021] In response to the user's configuration operation, an API configuration interface is displayed, wherein the API configuration interface is provided with selectable configuration controls, and the configuration controls include a basic information control, an API request definition control, and a backend service control that are sequentially set;

[0022] In response to the user's operation on the basic information control, a basic information configuration interface is displayed, and the API icon, API name and security authentication information are configured through the basic information configuration interface;

[0023] In response to the user's operation on the define API request control, display a define API request configuration interface, and configure protocol information and path information through the define API request configuration interface;

[0024] In response to the user's operation on the backend service control, a backend service configuration interface is displayed, and protocol information, request mode and path information are configured through the backend service configuration interface.

[0025] In a possible implementation, the general component includes a service authentication component and a service fuse component, wherein:

[0026] The service authentication component is used to receive the secret code and API request sent by the client application corresponding to the user, and if it is determined that the secret code is valid and the client application has the authority to access the API service, execute the call of the client application to the API service;

[0027] The service fuse component is used to switch the circuit breaker to an open state when the number of unresponse times exceeds a preset number when requesting the API service, and switch to a semi-open state after a preset time interval. If the next request is responded to, the circuit breaker switches to a closed state, otherwise it switches to an open state.

[0028] In a possible implementation, the general component further includes a service flow control component and a service metering component, wherein:

[0029] The service flow control component is used to perform flow control on users calling the open API through a token bucket algorithm;

[0030] The service metering component is used to record the number of times the user consumes the open API and the remaining consumption time, and when the number of times the API is consumed or the remaining consumption time reaches the API consumption agreement of the service contract, intercept the corresponding API request issued by the user.

[0031] In a second aspect, the present application provides an open API full-process processing device, the device comprising:

[0032] A configuration module is used to obtain API configuration information through an API configuration interface, wherein the API configuration information includes basic API information, defines API requests and backend services, and obtains a mapping relationship between the external URL of the API and the backend service based on the configuration information;

[0033] The configuration module is further used to perform general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component;

[0034] A testing module, used to test and verify the open API to determine whether the open API can respond normally and publish the open API;

[0035] A processing module is used to obtain the service contract between the open API and the corresponding user after the open API is released to the application market, and determine whether to execute a corresponding warning or downgrade strategy for the user's call to the open API based on the API consumption agreement in the service contract and the user's consumption record, so as to restrict the user from calling the open API.

[0036] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.

[0037] In a fourth aspect, the present application provides an electronic device, comprising: at least one processor and a memory; wherein:

[0038] The memory stores computer-executable instructions;

[0039] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method as described in any one of the first aspects.

[0040] The open API full-process processing method, device, equipment and medium provided in this application complete the API configuration and general component configuration through the API configuration interface to realize the corresponding functions of the open API. After testing and joint debugging verification, it is released to the application market for users to choose and use, and a service contract is established between the user and the open API. Based on the API consumption agreement in the service contract and the user's consumption record, the user's call to the open API is restricted. This method provides a full-process processing solution for the open API, improves development efficiency, service contracts and related early warning or downgrade strategies, realizes API resource sharing, and makes resources reasonably and effectively configured, improves the efficiency of the use of the open API, and enhances the experience of developers and users. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0042] Figure 1 The process of the open API full process processing method provided in the embodiment of this application Figure 1 ;

[0043] Figure 2 A schematic diagram of the API configuration interface provided in the embodiment of the present application;

[0044] Figure 3 The process of the open API full process processing method provided in the embodiment of this application Figure 2 ;

[0045] Figure 4 The process of the open API full process processing method provided in the embodiment of this application Figure 3 ;

[0046] Figure 5 A diagram of an open API full-process processing device provided by an embodiment of the present invention;

[0047] Figure 6 A hardware schematic diagram of an electronic device provided by an embodiment of the present invention.

[0048] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0050] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein, for example.

[0051] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0052] Microservice architecture can decouple solutions by decomposing functions into discrete services, creating applications around business domain components, which can be independently developed, managed, and iterated. Cloud architecture and platform-based deployment, management, and service functions are used in decentralized components to make product delivery simpler. Therefore, the application of microservice architecture has gradually emerged, making the industrial Internet field have many services that can be provided to the outside world. However, in the development process, developers will face pain points such as difficulty in calling, difficulty in development, and high complexity of calling. For example, the number of systems and APIs has increased significantly, and the calling relationship between systems has become complicated and difficult to maintain. For APIs exposed to the outside world, strict control, such as security protection, traffic control, protocol conversion, and operation monitoring, requires more development workload and puts higher requirements on employees' skills. After microservices, various fine-grained APIs have better reusability, but it will increase the complexity of some front-end applications.

[0053] Therefore, the existing technology lacks the ability to uniformly manage the configuration and application of APIs. When customers need services, they need to connect to them separately. When the API provides services to the outside world, each service needs to provide a set of authentication and current limiting configurations. There is a lack of peripheral capabilities to uniformly encapsulate the API, resulting in a long process cycle from code writing to service delivery, development difficulties, and other problems.

[0054] Based on this, this solution proposes a full-process processing method for open API. According to business needs, API configuration information is obtained through the API configuration interface, including basic API information, definition of API requests and backend services, to complete API configuration, and further configure the API with common components to obtain an open API. After the open API is released, it is determined whether to execute the corresponding warning or downgrade strategy based on the service contract with the corresponding user, so that users can call the open API based on the service contract. This method can achieve unified management of open APIs and improve development efficiency. While the service contract realizes API resource sharing, it realizes reasonable resource allocation, improves the efficiency of API use, and enhances the experience of developers and users.

[0055] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0056] Figure 1 The process of the open API full process processing method provided in the embodiment of this application Figure 1 .like Figure 1 As shown, the method includes:

[0057] S101. Obtain API configuration information through an API configuration interface, wherein the API configuration information includes basic API information, defines API requests and backend services, and obtains a mapping relationship between the external URL of the API and the backend service based on the configuration information.

[0058] In this step, based on business needs, configure an API that meets the needs. During the configuration process, obtain API configuration information through the API configuration interface to complete the establishment of a mapping relationship between the API's external URL and the backend service. The API configuration interface displays the API configuration interface in response to the user's configuration operation, and completes the configuration of the API through the API configuration information entered by the user in the interface. Specifically, obtain the basic information of the API entered by the configuration personnel, such as the API icon, API name, and security authentication, and further obtain the API request defined by the configuration personnel. Finally, obtain the relevant information of the backend service entered by the configuration personnel, such as the protocol, request method, and path. It should be understood that the address exposed to the outside by the backend service can be a domain name or an IP address, and the real backend service is hidden from the user.

[0059] Figure 2 The API configuration interface diagram provided in the embodiment of the present application is as follows: Figure 2 As shown, exemplarily, in response to the user's configuration operation, an API configuration interface is displayed, wherein the API configuration interface is provided with selectable configuration controls, and the configuration controls include a basic information control, an API request definition control, and a backend service control that are sequentially set;

[0060] In response to the user's operation on the basic information control, a basic information configuration interface 201 is displayed, and the API icon, API name and security authentication information are configured through the basic information configuration interface.

[0061] When configuring the API icon, the user can select a suitable image as the API display cover by clicking the select file control; configuring security authentication information includes obtaining the selected security authentication method and the corresponding Key value name.

[0062] In response to the user's operation on the define API request control, a define API request configuration interface 202 is displayed, and the protocol information and path information are configured through the define API request configuration interface.

[0063] You can also select Method, i.e. request method, to improve the API request. At the same time, the path information of this interface indicates the API path exposed by the gateway.

[0064] In response to the user's operation on the backend service control, a backend service configuration interface 203 is displayed, and protocol information, request mode and path information are configured through the backend service configuration interface.

[0065] The configuration request method includes obtaining the selected request method and request type. When the user enters the information required for configuration through the interface, the user can click the completion control to indicate that the API configuration information input is completed.

[0066] S102. Performing general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component.

[0067] In this step, common components play a very important role in the composition and use of open APIs, which runs through the initial use authentication of APIs, traffic control during use, system adaptability, and later service usage metering. By further adding the required common components to the configured API, the open API can have normal use functions and realize resource sharing.

[0068] Specifically, the general components include but are not limited to service authentication components, service circuit breakers, service flow control components and service metering components. The service authentication component is used to confirm the use rights of users who use open APIs. If the user has the use rights, the authentication allows the user to call the API; the service circuit breaker is used to disconnect the user request from the backend service when the number of gateway request failures exceeds a certain proportion, for example, more than 50%. When the backend service returns to normal, it switches back to the normal connection state to avoid sending a large number of invalid requests and affecting the system throughput; the service flow control component is used to control the request flow to the backend service so that the backend service can bear the pressure that does not exceed its own capacity; the service metering component is used to record the number of times the user consumes the API and restrict the user's use according to the service contract.

[0069] Exemplarily, the service authentication component is used to receive a secret code and an API request sent by a client application corresponding to the user, and if it is determined that the secret code is valid and the client application has the authority to access the API service, execute the call of the client application to the API service;

[0070] Specifically, the encryption algorithm of the password can adopt the JDK (Java SE Development kit) standard DESede algorithm, and then perform Base64 encoding on this basis to improve the security strength of the password.

[0071] The service fuse component is used to switch the circuit breaker to an open state when the number of unresponse times exceeds a preset number when requesting the API service, and switch to a semi-open state after a preset time interval. If the next request is responded to, the circuit breaker switches to a closed state, otherwise it switches to an open state.

[0072] Specifically, when the circuit breaker switches to the open state, all requests will fail directly and will not be sent to the backend service. When the circuit breaker switches to the semi-open state, the return status of the next request will be judged. If the request is successful, it means that the circuit breaker can be switched to the closed state.

[0073] The service flow control component is used to perform flow control on users calling the open API through a token bucket algorithm;

[0074] Specifically, the system can add tokens to the bucket at a constant time interval. If the token bucket is full of tokens, it will stop adding tokens immediately. When a new request arrives, each request will take a token from the token bucket. If there is no token in the current bucket, the system will block or refuse to serve the request.

[0075] The service metering component is used to record the number of times the user consumes the open API and the remaining consumption time, and when the number of times the API is consumed or the remaining consumption time reaches the API consumption agreement of the service contract, intercept the corresponding API request issued by the user.

[0076] Specifically, each open API has a total count function for tenants. Each time a request is successful, the counter will be decremented based on a preset value, and the message can be sent to the monitoring platform through the message middleware. The monitoring platform records the log flow of the request. At the same time, in order to facilitate the calculation and analysis of the usage of the open API, the usage records can be regularly summarized in batches, and the incremental summary results can be written to the database, and the number of API usages summarized in the database can be updated.

[0077] S103: Test and verify the open API to determine whether the open API can respond normally, and then publish the open API.

[0078] In this step, after the open API is configured, in order to ensure that it can be used normally, you can perform a test before publishing to simulate the call of the open API. If it responds normally, it means that the function is normal. At this time, the open API can be published so that users can choose to use it.

[0079] S104. After the open API is published to the application market, a service contract between the open API and the corresponding user is obtained, and according to the API consumption agreement in the service contract and the consumption record of the user, a determination is made whether to execute a corresponding warning or downgrade strategy for the user's call to the open API, so as to restrict the user from calling the open API.

[0080] In this step, when the user chooses to use an open API according to demand, he or she can establish usage rights by creating a service contract between the user and the corresponding open API. The service contract can stipulate the number of consumption times or consumption period for the API chosen by the user, and restrict the user's consumption based on the user's actual consumption.

[0081] Exemplarily, obtaining the agreed consumption times and the agreed consumption duration in the API consumption agreement;

[0082] Based on the actual number of consumption times and the remaining consumption time of the user recorded in the consumption record, determine whether the user has reached the warning condition corresponding to the warning, and issue a warning to the user who has reached the warning condition to remind the user that the service contract is about to expire.

[0083] If the consumption record shows that the consumption agreement of the service contract has been used up, then consider implementing a downgrade strategy for the user, so that even if the service contract has expired, the user can still get a certain degree of functional support for a period of time to avoid complete interruption and affect the user experience. The above method provides flexibility and controllability for the backend service.

[0084] The open API full-process processing method provided in this embodiment completes the API configuration and general component configuration through the API configuration interface to realize the corresponding functions of the open API, and is released to the application market after testing and joint debugging verification for users to choose and use, and establishes a service contract between the user and the open API, and restricts the user's call to the open API based on the API consumption agreement in the service contract and the user's consumption record. This method provides a full-process processing solution for the open API, improves development efficiency, service contracts and related early warning or downgrade strategies, realizes API resource sharing, and makes resources reasonably and effectively configured, improves the efficiency of the use of the open API, and enhances the experience of developers and users.

[0085] Figure 3 The process of the open API full process processing method provided in the embodiment of this application Figure 2 .like Figure 3 As shown, in this embodiment Figure 1 Based on the embodiment, the process of determining whether a user calls an open API to execute a corresponding warning is described in detail. The method includes:

[0086] S301. Obtain the agreed consumption times and agreed consumption duration in the API consumption agreement.

[0087] In this step, the agreed consumption frequency and agreed consumption duration are obtained according to the API consumption agreement in the service contract. It should be understood that the service contract is an agreement between the user and the corresponding API. Therefore, one user can correspond to one service contract content, which may include the consumption agreement between the user and one or more APIs used by the user. The agreed consumption frequency and agreed consumption duration indicate the total amount of consumption that the user can consume for a single API. When the user's consumption frequency or consumption duration reaches the content in the consumption agreement, the user will no longer have the right to use the API.

[0088] S302: Obtain a consumption frequency threshold and a consumption duration threshold in the warning rule, wherein the consumption frequency threshold and the consumption duration threshold are respectively smaller than the agreed consumption frequency and the agreed consumption duration.

[0089] In this step, in order to remind the user that the API is about to be consumed, monitoring can be performed through the consumption count threshold and the consumption duration threshold. It should be understood that the consumption count threshold or the consumption duration threshold is respectively smaller than the agreed consumption count or the agreed consumption duration. For example, a numerical value corresponding to a certain proportion of the agreed consumption count or the agreed consumption duration can be set as the threshold.

[0090] S303. If the actual number of consumption times is greater than or equal to the consumption times threshold, or the remaining consumption time is greater than or equal to the consumption time threshold, the user has reached the warning condition, and a warning is issued to the user who reaches the warning condition to remind the user that the service contract is about to expire.

[0091] In this step, based on the actual number of consumption times or the remaining consumption time obtained in real time, determine whether the corresponding threshold has been reached. If it has been reached, it means that the API is about to be consumed and the warning conditions have been met. At this time, it is necessary to warn the user to inform him that the service contract is about to expire.

[0092] It should be noted that the actual number of consumptions or the remaining consumption time can be recorded and obtained through the service metering component, in which the request counter is preset with the agreed number of consumptions according to the service contract. Each time the user consumes, the value in the request counter is decremented. At the same time, the agreed consumption time can also be preset, and the remaining consumption time is counted down according to the current time. When the user reaches the warning condition, the user can be prompted and a one-click renewal window or channel can be displayed to the user to support the user to directly choose to renew the open API currently in use.

[0093] The open API full-process processing method provided in this embodiment, by presetting the consumption frequency threshold and the consumption time threshold, warns the user according to the user's actual consumption data to remind the user that the service contract is about to expire. This method records the user's consumption situation and warns the user when the consumption is about to be completed, avoiding the inconvenience of the user's subsequent use, enhancing the user experience, and facilitating the continuous development of the business.

[0094] Figure 4 The process of the open API full process processing method provided in the embodiment of this application Figure 3 .like Figure 4 As shown, in this embodiment Figure 3 Based on the embodiment, the process of a user calling an open API to further execute a downgrade strategy is described in detail. The method includes:

[0095] S401. If the actual number of consumption times of the API service by the user is equal to the agreed number of consumption times, or the remaining consumption time is zero, execute the first downgrade strategy.

[0096] The first downgrade strategy includes: retaining the user's right to use the basic service items of the open API, and closing the user's right to use items other than the basic service items.

[0097] In this step, further, when the agreed number of consumptions or the agreed consumption duration in the service contract has been consumed and the user has not renewed the contract, the basic service items of the open API can be retained for the user to ensure that the user can continue to use it. It should be understood that under the first downgrade strategy, the open API can provide basic functional support to meet the user's minimum needs, such as read-only data access, execution of core business logic, etc., to minimize the impact on the user. When a user is downgraded, a prompt message can be sent to the user, including the reason for the downgrade and guidance measures, so that the user can understand the reason for the downgrade and provide relevant support and solutions. When the user chooses to accept the solution or renew the open API, the use function of the open API is restored to the user, so that the open API can respond to the user's request normally, and when the function is restored, a notification can be sent to the user to inform the user that the open API can be used normally.

[0098] S402: Acquire actual execution duration according to the start time of executing the first downgrade strategy and the current time, and determine whether the actual execution duration is greater than or equal to a preset duration.

[0099] S403: If yes, execute a second downgrade strategy for the user, where the second downgrade strategy is used to instruct to close the user's right to use the basic service item.

[0100] It should be noted that when the user's consumption time under the first downgrade strategy reaches the preset time, and the user does not accept the solution or renew the contract, the second downgrade strategy can be implemented for the user, and the user's remaining access rights to the basic service items will also be closed, so that the user's access rights to the open API are completely disabled. This situation may mean that the user no longer needs to continue to use the open API. After excessive use of the first downgrade strategy, the user's association with the open API can be directly terminated.

[0101] S404: If not, continue to execute the first downgrade strategy.

[0102] The open API full-process processing method provided in this embodiment implements corresponding downgrade strategies for users, provides basic function support or completely disables the service for users whose service contracts have been exhausted, reduces the impact of user usage during a period of time after the contract expires, avoids complete interruption that affects user experience, improves the flexibility and controllability of open API use, and enhances user experience.

[0103] Figure 5 A diagram of an open API full-process processing device provided by an embodiment of the present invention, such as Figure 5 As shown, the processing device 50 includes: a configuration module 501 , a testing module 502 and a processing module 503 .

[0104] Configuration module 501, used to obtain API configuration information through the API configuration interface, the API configuration information includes API basic information, defines API requests and backend services, and obtains the mapping relationship between the external URL of the API and the backend service according to the configuration information;

[0105] The configuration module 501 is further used to perform general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component;

[0106] The testing module 502 is used to test and verify the open API to determine whether the open API can respond normally and publish the open API;

[0107] Processing module 503 is used to obtain the service contract between the open API and the corresponding user after the open API is released to the application market, and determine whether to execute a corresponding warning or downgrade strategy for the user's call to the open API based on the API consumption agreement in the service contract and the user's consumption record, so as to restrict the user from calling the open API.

[0108] Figure 6 Schematic diagram of the hardware of the electronic device provided by the embodiment of the present invention. Figure 6 As shown, the electronic device 60 provided in this embodiment includes: at least one processor 601 and a memory 602. The device 60 also includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus 604.

[0109] In a specific implementation process, at least one processor 601 executes the computer-executable instructions stored in the memory 602, so that at least one processor 601 executes the above method.

[0110] The specific implementation process of the processor 601 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0111] In the above Figure 6In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0112] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0113] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0114] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method described above is implemented.

[0115] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0116] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0117] The division of the units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.

[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0119] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0120] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0121] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0122] So far, the technical solution of the present application has been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present application is obviously not limited to these specific embodiments, and the above embodiments are only used to illustrate the technical solution of the present application rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. An open API full-process processing method, characterized in that: The method comprises: Obtain API configuration information through the API configuration interface, the API configuration information includes API basic information, defines API requests and backend services, and obtains the mapping relationship between the external URL of the API and the backend service based on the configuration information; Performing general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component; Testing and verifying the open API to ensure that the open API can respond normally, and publishing the open API; After the open API is published to the application market, the service contract between the open API and the corresponding user is obtained, and according to the API consumption agreement in the service contract and the consumption record of the user, it is determined whether to execute a corresponding warning or downgrade strategy for the user's call to the open API to restrict the user from calling the open API.

2. The method according to claim 1, characterized in that The determining, according to the API consumption agreement in the service contract and the consumption record of the user, whether to execute a corresponding warning for the user calling the open API includes: Obtain the agreed consumption times and agreed consumption duration in the API consumption agreement; Based on the actual number of consumption times and the remaining consumption time of the user recorded in the consumption record, determine whether the user has reached the warning condition corresponding to the warning, and issue a warning to the user who has reached the warning condition to remind the user that the service contract is about to expire.

3. The method according to claim 2, characterized in that The determining whether the user meets the warning condition corresponding to the warning includes: Obtaining a consumption frequency threshold and a consumption duration threshold in the warning rule, wherein the consumption frequency threshold and the consumption duration threshold are respectively less than the agreed consumption frequency and the agreed consumption duration; If the actual number of consumption times is greater than or equal to the consumption times threshold, or the remaining consumption time is greater than or equal to the consumption time threshold, then the user has reached the warning condition.

4. The method according to claim 2, characterized in that: The method further comprises: If the actual number of consumption times of the API service by the user is equal to the agreed number of consumption times, or the remaining consumption time is zero, a first downgrade strategy is executed, wherein the first downgrade strategy includes: retaining the user's right to use the basic service items of the open API, and closing the user's right to use items other than the basic service items; Acquire the actual execution duration according to the start time of executing the first downgrade strategy and the current time, and determine whether the actual execution duration is greater than or equal to the preset duration; If so, a second downgrade strategy is executed for the user, where the second downgrade strategy is used to instruct to close the user's right to use the basic service item.

5. The method according to claim 1, characterized in that The obtaining of API configuration information through the API configuration interface includes: In response to the user's configuration operation, an API configuration interface is displayed, wherein the API configuration interface is provided with selectable configuration controls, and the configuration controls include a basic information control, an API request definition control, and a backend service control that are sequentially set; In response to the user's operation on the basic information control, a basic information configuration interface is displayed, and the API icon, API name and security authentication information are configured through the basic information configuration interface; In response to the user's operation on the define API request control, display a define API request configuration interface, and configure protocol information and path information through the define API request configuration interface; In response to the user's operation on the backend service control, a backend service configuration interface is displayed, and protocol information, request mode and path information are configured through the backend service configuration interface.

6. The method according to claim 1, characterized in that The general components include a service authentication component and a service fuse component, wherein: The service authentication component is used to receive the secret code and API request sent by the client application corresponding to the user, and if it is determined that the secret code is valid and the client application has the authority to access the API service, execute the call of the client application to the API service; The service fuse component is used to switch the circuit breaker to an open state when the number of unresponse times exceeds a preset number when requesting the API service, and switch to a semi-open state after a preset time interval. If the next request is responded to, the circuit breaker switches to a closed state, otherwise it switches to an open state.

7. The method according to claim 6, characterized in that The general components also include a service flow control component and a service metering component, wherein: The service flow control component is used to perform flow control on users calling the open API through a token bucket algorithm; The service metering component is used to record the number of times the user consumes the open API and the remaining consumption time, and when the number of times the API is consumed or the remaining consumption time reaches the API consumption agreement of the service contract, intercept the corresponding API request issued by the user.

8. An open API full-process processing device, characterized in that: The device comprises: A configuration module is used to obtain API configuration information through an API configuration interface, wherein the API configuration information includes basic API information, defines API requests and backend services, and obtains a mapping relationship between the external URL of the API and the backend service based on the configuration information; The configuration module is further used to perform general component configuration on the API to obtain a configured open API, wherein the general component includes at least one of a service authentication component, a service fuse component, a service flow control component, and a service metering component; A testing module, used to test and verify the open API to determine whether the open API can respond normally and publish the open API; A processing module is used to obtain the service contract between the open API and the corresponding user after the open API is released to the application market, and determine whether to execute a corresponding warning or downgrade strategy for the user's call to the open API based on the API consumption agreement in the service contract and the user's consumption record, so as to restrict the user from calling the open API.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: at least one processor and memory; wherein, The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Contract processing method and device based on intelligent agent

    CN120975983A