Custom interface construction methods, devices, computer equipment, and storage media
Patent Information
- Application Number
- CN202211717360.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2042-12-29
AI Technical Summary
[0002]在现有技术方案中,客户无法自定义接口,需要对每个厂家的各类接口进行适配开发,各个厂家的接口不统一,而且多数时候厂家提供的接口中存在大量客户不关心的信息,或者接口中压根没有客户想要的信息,例如数据中心要监控服务器的CPU(centralprocessing unit,中央处理器)/HDD(Hard Disk Drive,机械硬盘)/内存等各种部件的序列号信息,按照往常设计各个厂家会要求客户获取CPU/HDD/内存的至少3个专有API(Application Programming Interface,应用程序编程接口),如果可以允许客户进行接口自定义,自定义接口仅从CPU/HDD/内存信息中取得序列号信息,这样BMC(BaseboardManagement Controller,基板管理控制器)和客户侧均需要处理大量不需要的数据,提高了BMC和客户应用的响应时间,也提高了厂家运行成本以用于提升BMC硬件运行能力或者为客户提供定制服务
[0027]上述自定义接口构建方法、装置、计算机设备和存储介质,所述方法包括:在基板管理控制器中构建应用程序编程接口数据池;响应于客户端访问权限验证通过结果,基于所述应用程序编程接口数据池提取用于自定义应用程序编程接口的所有键值以及所述所有键值对应的标识;根据预设规则对所述所有键值进行JSON组合排序生成目标应用程序编程接口,将所述目标应用程序编程接口返回至所述客户端,本申请增强了基板管理控制器的可维护性及降低了维护成本,减少了客户应用程序编程接口定制,提升了客户和基板管理控制器的处理效率,降低基板管理控制器因为出现冗余信息需要造成的性能需求和硬件成本增加。
Smart Images

Figure CN116185655B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of baseboard management controllers, and in particular to a method, apparatus, computer device, and storage medium for constructing a custom interface. Background Technology
[0002] In existing technical solutions, customers cannot customize interfaces and need to adapt and develop various interfaces from different manufacturers. The interfaces from different manufacturers are not uniform, and often the interfaces provided by manufacturers contain a lot of information that customers do not care about, or do not contain any information that customers want at all. For example, data centers need to monitor the serial number information of various components such as CPU (central processing unit), HDD (hard disk drive), and memory of servers. According to the usual design, each manufacturer will require customers to obtain at least three proprietary APIs (Application Programming Interfaces) for CPU / HDD / memory. If customers are allowed to customize the interface, and the customized interface only obtains the serial number information from the CPU / HDD / memory information, then both the BMC (Baseboard Management Controller) and the customer side need to process a lot of unnecessary data, which increases the response time of the BMC and the customer application, and also increases the operating costs of the manufacturer to improve the operating capabilities of the BMC hardware or provide customized services to customers.
[0003] Therefore, there is an urgent need to propose a custom interface construction method, device, computer equipment, and storage medium that can enhance the maintainability of BMC, reduce maintenance costs, reduce customer API customization, and improve the processing efficiency of customers and BMC. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, and storage medium for building custom interfaces that can enhance the maintainability of BMC, reduce maintenance costs, reduce customer API customization, and improve the processing efficiency of customers and BMC, in order to address the above-mentioned technical problems.
[0005] On the one hand, a custom interface construction method is provided, applied to a baseboard management controller, the method comprising:
[0006] Step A: Build an application programming interface (API) data pool in the baseboard management controller;
[0007] Step B: In response to the client access permission verification result, extract all key-value pairs used for the custom application programming interface and the identifiers corresponding to all key-value pairs based on the application programming interface data pool;
[0008] Step C: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0009] In one embodiment, the method further includes: constructing the application programming interface data pool in the baseboard management controller includes: selecting the identifier and key value of the authorized application; describing the identifier and key value of the authorized application in a data format of a preset database to generate first data; and adding the first data to the preset database to form the application programming interface data pool.
[0010] In one embodiment, the method further includes: verifying the access rights of the client, which includes: receiving an application programming interface (API) data pool access request sent by the client; parsing the API data pool access request; obtaining basic information corresponding to the client based on the parsing result, the basic information including the client's IP address and a first login credential; and verifying the client's access rights based on the basic information corresponding to the client.
[0011] In one embodiment, the method further includes: verifying the client's access rights based on the client's corresponding basic information, which includes: in response to the IP address detection result, sending a first verification interface to the client for input verification of the first login credential; in response to the successful input verification of the first login credential, sending a second verification interface and a second login credential to the client for input verification; in response to the successful input verification of the second login credential, obtaining the sending duration of the second login credential, and determining that the client has access rights when the sending duration is less than or equal to a preset threshold.
[0012] In one embodiment, the step of extracting all key values for the custom application programming interface and the identifiers corresponding to all key values based on the application programming interface data pool includes: in response to the access permission verification result of the client, initiating a key value extraction request to the key value query interface provided by the baseboard management controller; the application programming interface data pool transmits all key values of the authorized applications and their identifiers to the client according to the key value extraction request.
[0013] In one embodiment, the method further includes: generating a target application programming interface by combining and sorting all the key-value pairs according to preset rules using JSON; the client defining the path name of the application programming interface and determining the key-value pairs to be returned corresponding to the path name; numbering and classifying each key-value pair using JSON format to generate a target JSON data structure; and mapping the target JSON data structure to the path name one-to-one to generate the target application programming interface and storing it in a database.
[0014] In one embodiment, the method of returning the target application programming interface to the client includes: receiving a target application programming interface access request sent by the client; calling the target JSON data structure corresponding to the path name carried in the target application programming interface access request; and returning the target JSON data structure to the client.
[0015] On the other hand, a custom interface construction apparatus is provided, the apparatus comprising:
[0016] The data pool construction module is used to build application programming interface data pools in the baseboard management controller;
[0017] The key-value extraction module is used to extract all key-values used for the custom application programming interface and the identifiers corresponding to all key-values based on the application programming interface data pool in response to the client access permission verification result.
[0018] The interface generation module is used to generate a target application programming interface by combining and sorting all the key-value pairs according to preset rules, and then return the target application programming interface to the client.
[0019] In another aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0020] Step A: Build an application programming interface (API) data pool in the baseboard management controller;
[0021] Step B: In response to the client access permission verification result, extract all key-value pairs used for the custom application programming interface and the identifiers corresponding to all key-value pairs based on the application programming interface data pool;
[0022] Step C: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0023] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0024] Step A: Build an application programming interface (API) data pool in the baseboard management controller;
[0025] Step B: In response to the client access permission verification result, extract all key-value pairs used for the custom application programming interface and the identifiers corresponding to all key-value pairs based on the application programming interface data pool;
[0026] Step C: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0027] The aforementioned custom interface construction method, apparatus, computer device, and storage medium, the method comprising: constructing an application programming interface (API) data pool in a baseboard management controller; in response to a client access permission verification result, extracting all key-value pairs used for custom APIs and the identifiers corresponding to all key-value pairs based on the API data pool; performing JSON combination and sorting on all key-value pairs according to preset rules to generate a target API; and returning the target API to the client. This application enhances the maintainability of the baseboard management controller and reduces maintenance costs, reduces the customization of client APIs, improves the processing efficiency of both the client and the baseboard management controller, and reduces the performance requirements and hardware costs of the baseboard management controller caused by redundant information. Attached Figure Description
[0028] Figure 1 This is an application environment diagram of a custom interface construction method in one embodiment;
[0029] Figure 2 This is a flowchart illustrating a custom interface construction method in one embodiment;
[0030] Figure 3 This is a structural block diagram of a custom interface construction device in one embodiment;
[0031] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] It should be understood that, in the description of this application, unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."
[0034] It should also be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0035] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0036] As can be seen from the background technology, in the existing technical solutions, customers cannot customize the interface and need to adapt and develop various interfaces from each manufacturer. The interfaces of different manufacturers are not uniform, and in most cases, the interfaces provided by manufacturers contain a lot of information that customers do not care about, or the interfaces do not contain any information that customers want at all. As a result, both the board management controller and the customer side need to process a lot of unnecessary data, which increases the application response time and also increases the manufacturer's operating costs in order to improve the hardware operation capabilities of the board management controller or provide customized services to customers.
[0037] To address the aforementioned technical issues, this application provides a method, apparatus, computer equipment, and storage medium for constructing custom interfaces, establishing an application programming interface (API) data pool for clients to customize data interfaces. This enhances the maintainability of the baseboard management controller, reduces maintenance costs, minimizes client API customization, and improves the processing efficiency of both the client and the baseboard management controller.
[0038] The custom interface construction method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with a data processing platform set on server 104 via a network. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 104 can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0039] Example 1
[0040] In one embodiment, such as Figure 2 As shown, a custom interface construction method is provided, which can be applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:
[0041] S1: Build an application programming interface data pool in the baseboard management controller.
[0042] It should be noted that the aforementioned Baseboard Management Controller is the BMC (Baseboard Management Controller), which has RESTful interfaces, IPMI (Intelligent Platform Management Interface), Redfish interfaces, etc. The application programming interface is API (Application Programming Interface), which consists of a set of predefined functions. The purpose is to provide applications and developers with the ability to access a set of routines based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.
[0043] Specifically, building an application programming interface (API) data pool in the baseboard management controller includes:
[0044] Select the identifier and key value of the application to be granted permissions. Application authorization refers to the manufacturer granting permissions to the existing applications before the baseboard management controller leaves the factory, so that the client can independently define the application programming interface. The identifier of the application to be granted permissions is the meaning corresponding to the key value.
[0045] The identifier and key value of the application with the granted permissions are described in a preset database data format to generate first data, wherein the data format includes column data information sorted according to the identifier information order;
[0046] The first data is added to the preset database to form the application programming interface data pool.
[0047] S2: In response to the client access permission verification result, extract all key values used for the custom application programming interface and the identifiers corresponding to all key values based on the application programming interface data pool.
[0048] It should be noted that verifying the client's access permissions includes:
[0049] Receive the application programming interface data pool access request sent by the client;
[0050] The application programming interface data pool access request is parsed;
[0051] The basic information corresponding to the client is obtained based on the parsing results. The basic information includes the client's IP address and the first login credential, wherein the first login credential is the password preset by the baseboard management controller before leaving the factory.
[0052] The client's access permissions are verified based on the basic information corresponding to the client.
[0053] Furthermore, the step of verifying the client's access rights based on the basic information corresponding to the client includes:
[0054] The IP address is checked to determine whether the corresponding IP address belongs to the authorized baseboard management controller. If it does, the next step is executed; otherwise, it is determined that the client does not have the access permission.
[0055] In response to the IP address detection result, a first verification interface is sent to the client to verify the input of the first login credential. If the verification fails, it is determined that the client does not have access rights. If the verification passes, the next step is executed.
[0056] In response to the successful input verification result of the first login credential, a second verification interface and a second login credential are sent to the client for input verification. The second login credential can be an SMS verification code. If the verification fails, it is determined that the client does not have access rights. If the verification is successful, the next step is executed.
[0057] In response to the successful input verification result of the second login credential, the sending duration of the second login credential is obtained. When the sending duration is less than or equal to a preset threshold, it is determined that the client has access rights.
[0058] Furthermore, the step of extracting all key-value pairs used for custom application programming interfaces (APIs) and the identifiers corresponding to all key-value pairs based on the API data pool includes:
[0059] In response to the client's access permission verification result, a key value extraction request is initiated to the key value query interface provided by the baseboard management controller. The key value query interface can be in the form of RESTful, etc., and can query all key values in the BMCAPI data pool that can be used for custom APIs and provide the meaning of the key values.
[0060] The application programming interface data pool transmits all key values and their identifiers of the applications to be granted permissions to the client based on the key-value extraction request.
[0061] S3: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0062] It should be noted that this step is as follows:
[0063] After the client receives all the key-value pairs, the client defines the path name of the application programming interface and determines the key-value pairs to be returned for each path name according to its requirements:
[0064] Each key value is assigned a JSON format number and hierarchical structure to generate a target JSON data structure. For example, the key values located in the first-level JSON directory are numbered 1, 2, 3, 4..., the second-level key values located in a certain first-level JSON data structure are numbered x1, x2, x3, x4..., and so on. The key values that need to be returned by the API are assigned JSON numbers. This kind of JSON numbering can be called JSON format numbering.
[0065] The target JSON data structure is mapped one-to-one with the path name to generate the target application programming interface, which is then stored in the database.
[0066] Furthermore, returning the target application programming interface to the client includes:
[0067] Receive the target application programming interface access request sent by the client;
[0068] The target JSON data structure corresponding to the path name is invoked based on the path name carried in the target application programming interface access request;
[0069] The target JSON data structure is returned to the client.
[0070] When a user makes a call, the API retrieves the key-value pairs requested by the user from the API data pool, performs JSON combination and sorting according to the user's requirements, and returns the results as requested, thus completing the entire process of creating a user-defined API. If the user needs a new API, the above process can be repeated to rebuild the custom API.
[0071] To verify the technical effects of the solution adopted in this application, this embodiment takes a client-side physical machine centralized management as an example for testing. Based on the traditional technical solution, it is necessary to access 10 URLs to obtain all the information you want. However, by using the custom URL of this application, you can obtain only the information you want. During the test, you only need to obtain the information of a self-defined URL. The efficiency of polling and managing data is improved by 10 times, and the data processing efficiency is also greatly improved. It is no longer necessary to repeatedly process unnecessary JSON data, and the system running efficiency is greatly improved.
[0072] The aforementioned custom interface construction method includes: constructing an application programming interface (API) data pool in the baseboard management controller; in response to the client access permission verification result, extracting all key-value pairs used for custom APIs and the identifiers corresponding to all key-value pairs based on the API data pool; performing JSON combination and sorting on all key-value pairs according to preset rules to generate a target API; and returning the target API to the client. This application enhances the maintainability of the baseboard management controller and reduces maintenance costs, reduces the customization of customer APIs, improves the processing efficiency of both the customer and the baseboard management controller, and reduces the performance requirements and hardware costs of the baseboard management controller caused by redundant information.
[0073] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0074] Example 2
[0075] In one embodiment, such as Figure 3As shown, a custom interface construction device is provided, including: a data pool construction module, a key-value extraction module, and an interface generation module, wherein:
[0076] The data pool construction module is used to build application programming interface data pools in the baseboard management controller;
[0077] The key-value extraction module is used to extract all key-values used for the custom application programming interface and the identifiers corresponding to all key-values based on the application programming interface data pool in response to the client access permission verification result.
[0078] The interface generation module is used to generate a target application programming interface by combining and sorting all the key-value pairs according to preset rules, and then return the target application programming interface to the client.
[0079] In a preferred embodiment of the present invention, the data pool construction module is specifically used for:
[0080] Select the identifier and key-value pair of the application to which permissions are to be granted;
[0081] The identifier and key value of the application with granted permissions are described in a preset database data format to generate the first data;
[0082] The first data is added to the preset database to form the application programming interface data pool.
[0083] In a preferred embodiment of the present invention, the key-value extraction module is specifically used for:
[0084] Receive the application programming interface data pool access request sent by the client;
[0085] The application programming interface data pool access request is parsed;
[0086] Based on the parsing results, the basic information corresponding to the client is obtained, including the client's IP address and first login credential;
[0087] The client's access permissions are verified based on the basic information corresponding to the client.
[0088] In a preferred embodiment of the present invention, the key-value extraction module is further configured to:
[0089] In response to the IP address detection result, a first verification interface is sent to the client to verify the input of the first login credential;
[0090] In response to the successful input verification result of the first login credential, a second verification interface and a second login credential are sent to the client for input verification;
[0091] In response to the successful input verification result of the second login credential, the sending duration of the second login credential is obtained. When the sending duration is less than or equal to a preset threshold, it is determined that the client has access rights.
[0092] In a preferred embodiment of the present invention, the key-value extraction module is further configured to:
[0093] In response to the client's access permission verification result, a key value extraction request is initiated to the key value query interface provided by the baseboard management controller;
[0094] The application programming interface data pool transmits all key values and their identifiers of the applications to be granted permissions to the client based on the key-value extraction request.
[0095] In a preferred embodiment of the present invention, the interface generation module is specifically used for:
[0096] The client defines the path name of the application programming interface and determines the key-value pair to be returned for that path name according to its requirements:
[0097] Each key-value pair is numbered and hierarchically arranged in JSON format to generate the target JSON data structure;
[0098] The target JSON data structure is mapped one-to-one with the path name to generate the target application programming interface, which is then stored in the database.
[0099] In a preferred embodiment of the present invention, the interface generation module is further configured to:
[0100] Receive the target application programming interface access request sent by the client;
[0101] The target JSON data structure corresponding to the path name is invoked based on the path name carried in the target application programming interface access request;
[0102] The target JSON data structure is returned to the client.
[0103] Specific limitations regarding the custom interface construction device can be found in the limitations on the custom interface construction method described above, and will not be repeated here. Each module in the aforementioned custom interface construction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0104] Example 3
[0105] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a custom interface construction method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0106] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0107] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0108] S1: Build an application programming interface data pool in the baseboard management controller;
[0109] S2: In response to the client access permission verification result, extract all key-value pairs used for the custom application programming interface and the identifiers corresponding to all key-value pairs from the application programming interface data pool;
[0110] S3: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0111] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0112] Select the identifier and key-value pair of the application to which permissions are to be granted;
[0113] The identifier and key value of the application with granted permissions are described in a preset database data format to generate the first data;
[0114] The first data is added to the preset database to form the application programming interface data pool.
[0115] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0116] Receive the application programming interface data pool access request sent by the client;
[0117] The application programming interface data pool access request is parsed;
[0118] Based on the parsing results, the basic information corresponding to the client is obtained, including the client's IP address and first login credential;
[0119] The client's access permissions are verified based on the basic information corresponding to the client.
[0120] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0121] In response to the IP address detection result, a first verification interface is sent to the client to verify the input of the first login credential;
[0122] In response to the successful input verification result of the first login credential, a second verification interface and a second login credential are sent to the client for input verification;
[0123] In response to the successful input verification result of the second login credential, the sending duration of the second login credential is obtained. When the sending duration is less than or equal to a preset threshold, it is determined that the client has access rights.
[0124] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0125] In response to the client's access permission verification result, a key value extraction request is initiated to the key value query interface provided by the baseboard management controller;
[0126] The application programming interface data pool transmits all key values and their identifiers of the applications to be granted permissions to the client based on the key-value extraction request.
[0127] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0128] The client defines the path name of the application programming interface and determines the key-value pair to be returned for that path name according to its requirements:
[0129] Each key-value pair is numbered and hierarchically arranged in JSON format to generate the target JSON data structure;
[0130] The target JSON data structure is mapped one-to-one with the path name to generate the target application programming interface, which is then stored in the database.
[0131] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0132] Receive the target application programming interface access request sent by the client;
[0133] The target JSON data structure corresponding to the path name is invoked based on the path name carried in the target application programming interface access request;
[0134] The target JSON data structure is returned to the client.
[0135] Example 4
[0136] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0137] S1: Build an application programming interface data pool in the baseboard management controller;
[0138] S2: In response to the client access permission verification result, extract all key-value pairs used for the custom application programming interface and the identifiers corresponding to all key-value pairs from the application programming interface data pool;
[0139] S3: Perform JSON combination and sorting on all the key-value pairs according to preset rules to generate the target application programming interface, and return the target application programming interface to the client.
[0140] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0141] Select the identifier and key-value pair of the application to which permissions are to be granted;
[0142] The identifier and key value of the application with granted permissions are described in a preset database data format to generate the first data;
[0143] The first data is added to the preset database to form the application programming interface data pool.
[0144] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0145] Receive the application programming interface data pool access request sent by the client;
[0146] The application programming interface data pool access request is parsed;
[0147] Based on the parsing results, the basic information corresponding to the client is obtained, including the client's IP address and first login credential;
[0148] The client's access permissions are verified based on the basic information corresponding to the client.
[0149] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0150] In response to the IP address detection result, a first verification interface is sent to the client to verify the input of the first login credential;
[0151] In response to the successful input verification result of the first login credential, a second verification interface and a second login credential are sent to the client for input verification;
[0152] In response to the successful input verification result of the second login credential, the sending duration of the second login credential is obtained. When the sending duration is less than or equal to a preset threshold, it is determined that the client has access rights.
[0153] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0154] In response to the client's access permission verification result, a key value extraction request is initiated to the key value query interface provided by the baseboard management controller;
[0155] The application programming interface data pool transmits all key values and their identifiers of the applications to be granted permissions to the client based on the key-value extraction request.
[0156] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0157] The client defines the path name of the application programming interface and determines the key-value pair to be returned for that path name according to its requirements:
[0158] Each key-value pair is numbered and hierarchically arranged in JSON format to generate the target JSON data structure;
[0159] The target JSON data structure is mapped one-to-one with the path name to generate the target application programming interface, which is then stored in the database.
[0160] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0161] Receive the target application programming interface access request sent by the client;
[0162] The target JSON data structure corresponding to the path name is invoked based on the path name carried in the target application programming interface access request;
[0163] The target JSON data structure is returned to the client.
[0164] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0165] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0166] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for constructing a custom interface, characterized in that, Applied to a baseboard management controller, the method includes: Constructing an application programming interface (API) data pool in a baseboard management controller includes: selecting the identifier and key value of an application with granted permissions, wherein the application with granted permissions is an application that exists and is granted permissions before the baseboard management controller leaves the factory, for the client to define the API independently, and the identifier of the application with granted permissions is the meaning corresponding to the key value; describing the identifier and key value of the application with granted permissions in a data format of a preset database to generate first data; and adding the first data to the preset database to form the API data pool. In response to the client access permission verification result, based on the application programming interface data pool, all key values used for the custom application programming interface and the identifiers corresponding to all key values are extracted, including: initiating a key value extraction request to the key value query interface provided by the baseboard management controller, and the application programming interface data pool transmitting all key values of the application to be granted permission and their identifiers to the client according to the key value extraction request; The target application programming interface (API) is generated by combining and sorting all the key-value pairs according to preset rules using JSON. This includes: the client defining the path name of the API and determining the key-value pairs to be returned corresponding to the path name; numbering and classifying each key-value pair using JSON format to generate a target JSON data structure; and mapping the target JSON data structure to the path name to generate the target API and storing it in the database. Returning the target application programming interface to the client includes: receiving a target application programming interface access request sent by the client; calling the target JSON data structure corresponding to the path name carried in the target application programming interface access request; and returning the target JSON data structure to the client.
2. The custom interface construction method according to claim 1, characterized in that, Verifying the client's access permissions includes: Receive the application programming interface data pool access request sent by the client; The application programming interface data pool access request is parsed; Based on the parsing results, the basic information corresponding to the client is obtained, including the client's IP address and first login credential; The client's access permissions are verified based on the basic information corresponding to the client.
3. The custom interface construction method according to claim 2, characterized in that, The process of verifying the client's access rights based on the client's basic information includes: In response to the IP address detection result, a first verification interface is sent to the client to verify the input of the first login credential; In response to the successful input verification result of the first login credential, a second verification interface and a second login credential are sent to the client for input verification; In response to the successful input verification result of the second login credential, the sending duration of the second login credential is obtained. When the sending duration is less than or equal to a preset threshold, it is determined that the client has access rights.
4. A custom interface construction device, characterized in that, The apparatus for implementing the method as described in any one of claims 1-3, the apparatus comprising: The data pool construction module is used to build application programming interface data pools in the baseboard management controller; The key-value extraction module is used to extract all key-values used for the custom application programming interface and the identifiers corresponding to all key-values based on the application programming interface data pool in response to the client access permission verification result. The interface generation module is used to generate a target application programming interface by combining and sorting all the key-value pairs according to preset rules, and then return the target application programming interface to the client.
5. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Substrate managing controller and data processing method thereof
CN103019905A
Application programming interface creating method and device
CN110083384A