Application program interface management method and device, program product and electronic equipment
By obtaining call relationship information from the normalized code of calling application program interface and saving it to the management platform, the problem of low efficiency in query APIs in the existing technology is solved, and automated management and rapid query of API related information is realized.
Patent Information
- Application Number
- CN202510361915.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, when querying which website or APP is used on, or when querying which side of the API is used which fields are used, it is necessary to manually search code or grab packets, resulting in low query efficiency.
Automatic management and query are achieved by obtaining call relationship information from the normalized code that calls the application program interface and saving field information to the application program interface management platform according to the preset mapping relationship.
It improves the efficiency of querying application program interfaces and related information, eliminates the limitations of human operations and equipment resources, and realizes the rapid acquisition of page and field information associated with APIs.
Smart Images

Figure CN120295694A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technologies, and more specifically, to an application programming interface management method, an application programming interface management device, a computer program product, and an electronic device. Background Art
[0002] This section aims to provide background or context for the embodiments of the present disclosure recited in the claims. The description herein is not admitted to be prior art merely by virtue of being included in this section.
[0003] Currently, the information content displayed on a web page or a mobile application (APP) page is usually obtained by a server application programming interface (API) to obtain corresponding fields, and then through the conversion process of front-end code, and finally displayed on the corresponding interactive page of the user.
[0004] In a page, multiple APIs may be called, so n pairs of relationships between the called APIs and the fields used in this API will be formed; and in a complete website or APP, there are m, so m*n relationship pairs will be formed. Summary of the Invention
[0005] However, when a user wants to query which website or APP an API is used on, or to query which fields an API specifically uses on which website or APP, it can only be confirmed by manually searching the code or packet capture, resulting in low query efficiency.
[0006] In view of this, the present disclosure provides an application programming interface management method, an application programming interface management device, a computer program product, and an electronic device to improve the efficiency of querying application programming interfaces and related information of application programming interfaces to a certain extent.
[0007] According to a first aspect of the present disclosure, there is provided an application programming interface management method, the method including:
[0008] Obtaining call relationship information of an application programming interface from standardized code that calls the application programming interface;
[0009] Saving field information included in the call relationship information to an application programming interface management platform according to the call relationship information and a preset mapping relationship; the preset mapping relationship includes a correspondence between field information and storage indication information of the application programming interface management platform;
[0010] Providing a preset service for a caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0011] In a possible implementation, before obtaining the call relationship information of the application programming interface from the normalized code for calling the application programming interface, the method further includes:
[0012] Configuring call writing rules for writing application programming interface call code corresponding to each platform, where each of the call writing rules is used to standardize the writing position information of each piece of information indicating the application programming interface in the code written for the corresponding platform.
[0013] In a possible implementation, before obtaining the call relationship information of the application programming interface from the normalized code for calling the application programming interface, the method further includes:
[0014] Configuring call function rules corresponding to each platform, where each of the call function rules is used to standardize the code description information of the call method for calling the application programming interface.
[0015] In a possible implementation, obtaining the call relationship information of the application programming interface from the normalized code for calling the application programming interface includes:
[0016] Obtaining the interface description data of the application programming interface;
[0017] Obtaining the call relationship information of the application programming interface according to the interface description data of the application programming interface.
[0018] In a possible implementation, obtaining the call relationship information of the application programming interface according to the interface description data of the application programming interface includes:
[0019] Establishing a first mapping relationship between the call platform, the called application programming interface, and the fields used by the called application programming interface under each page identification information;
[0020] Establishing a second mapping relationship between each of the page identification information and the project identification information;
[0021] Obtaining the call relationship information of the application programming interface according to the first mapping relationship and the second mapping relationship.
[0022] In a possible implementation, according to the call relationship information and a preset mapping relationship, saving the field information included in the call relationship information to the application programming interface management platform includes:
[0023] Determining each piece of field information included in the call relationship information, respectively matching it with each storage indication information of the application programming interface management platform, and obtaining matching result information;
[0024] Save the field information included in the call relationship information to the application programming interface management platform according to the matching result information.
[0025] In a possible implementation manner, providing a preset service for a caller of an application programming interface according to the field information stored in the application programming interface management platform includes:
[0026] Receive a call relationship query request, where the call relationship query request carries first identification information of a first application programming interface;
[0027] Determine a query result from the field information stored in the application programming interface management platform according to the first identification information;
[0028] Determine visualization information of the query result to display the visualization information to a query object.
[0029] In a possible implementation manner, the method further includes:
[0030] Determine whether a preset scanning moment is reached;
[0031] If the current moment reaches the preset scanning moment, statically scan the normalized code again to obtain call relationship information of a new application programming interface, and update the field information stored in the application programming interface management platform based on the call relationship information of the new application programming interface.
[0032] According to a second aspect of the present disclosure, there is provided an application programming interface management device, where the device includes:
[0033] An obtaining unit, configured to obtain call relationship information of an application programming interface from the normalized code of the called application programming interface;
[0034] A saving unit, configured to save the field information included in the call relationship information to the application programming interface management platform according to the call relationship information and a preset mapping relationship; the preset mapping relationship includes a corresponding relationship between the field information and storage indication information of the application programming interface management platform;
[0035] A processing unit, configured to provide a preset service for a caller of an application programming interface according to the field information stored in the application programming interface management platform.
[0036] In a possible implementation manner, the device further includes a configuration unit, configured to:
[0037] Configure call writing rules for writing application programming interface call codes corresponding to each platform, where each call writing rule is used to standardize the writing position information of each piece of information indicating the application programming interface in the writing code of the corresponding platform.
[0038] In a possible implementation, the device further includes a configuration unit, which is used for:
[0039] Configure the call function rules corresponding to each platform, where each of the call function rules is a code description information for standardizing the call mode of the application programming interface.
[0040] In a possible implementation, the obtaining unit is specifically used for:
[0041] Obtain the interface description data of the application programming interface;
[0042] Obtain the call relationship information of the application programming interface according to the interface description data of the application programming interface.
[0043] In a possible implementation, the obtaining unit is specifically used for:
[0044] Establish a first mapping relationship between the call platform, the called application programming interface, and the fields used by the called application programming interface under each page identification information;
[0045] Establish a second mapping relationship between each of the page identification information and the project identification information;
[0046] Obtain the call relationship information of the application programming interface according to the first mapping relationship and the second mapping relationship.
[0047] In a possible implementation, the saving unit is specifically used for:
[0048] Determine each field information included in the call relationship information, and respectively match it with each storage indication information of the application programming interface management platform to obtain matching result information;
[0049] Save the field information included in the call relationship information to the application programming interface management platform according to the matching result information.
[0050] In a possible implementation, the processing unit is specifically used for:
[0051] Receive a call relationship query request, where the call relationship query request carries the first identification information of the first application programming interface;
[0052] Determine a query result from the field information saved in the application programming interface management platform according to the first identification information;
[0053] Determine the visualization information of the query result to display the visualization information to the query object.
[0054] In a possible implementation, the device further includes an update unit configured to:
[0055] Determine whether a preset scanning time is reached;
[0056] If the current time reaches the preset scanning time, statically scan the normalized code again to obtain call relationship information of new application programming interfaces, and update the field information stored in the application programming interface management platform based on the call relationship information of the new application programming interfaces.
[0057] According to a third aspect of the present disclosure, there is provided a computer program product including a computer program, which when executed by a processor implements the method according to the first aspect and its possible implementations.
[0058] According to a fourth aspect of the present disclosure, there is provided an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to execute the method according to the first aspect and its possible implementations.
[0059] The technical solution of the present disclosure has the following beneficial effects:
[0060] In the embodiments of the present disclosure, call relationship information of application programming interfaces can be obtained from the normalized code for calling application programming interfaces, and then, according to the call relationship information and a preset mapping relationship, the field information included in the call relationship information is stored in the application programming interface management platform; the preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform. Further, preset services can be provided for callers of application programming interfaces according to the field information stored in the application programming interface management platform.
[0061] As can be seen, in the embodiments of the present disclosure, the code for invoking the application programming interface can be standardized first, so as to ensure that the obtained call relationship information of the application programming interface can be standardized and managed as much as possible, improving the service efficiency of providing services to callers subsequently. Then, the field information included in the call relationship information is saved to the application programming interface management platform. In this way, when the caller of the application programming interface triggers various service requests, preset services can be provided to the caller of the application programming interface based on the field information saved in the application programming interface management platform automatically. In other words, the embodiments of the present disclosure can realize automatically obtaining and maintaining the relationship between the page and the terminal, the called API, and the used API fields on the application programming interface management platform, thus eliminating all manual operations and restrictions on device resources. By searching for the API or page identifier, all pages associated with the API or all API information used under the page can be quickly obtained, without the caller having to manually search throughout the process, greatly improving the efficiency of querying the application programming interface and related information of the application programming interface.
[0062] Other features and advantages of the present disclosure will be described in the following specification, and some of them will become obvious from the specification, or be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure can be achieved and obtained through the structures specifically pointed out in the written specification, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] To more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following briefly introduces the drawings required to be used in the embodiments of the present disclosure. Obviously, the following introduced drawings are only some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0064] Figure 1 Showing a schematic diagram of an application scenario in this exemplary embodiment;
[0065] Figure 2 Showing a schematic flowchart of an application programming interface management method in this exemplary embodiment;
[0066] Figure 3 Showing a schematic diagram of the process of application programming interface management in this exemplary embodiment;
[0067] Figure 4 Showing a schematic structural diagram of an application programming interface management device in this exemplary embodiment;
[0068] Figure 5 Showing a schematic structural diagram of an electronic device in this exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0069] To make the objectives, technical solutions, and advantages of the present disclosure clearer and more understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present disclosure. Without conflict, the embodiments in the present disclosure and the features in the embodiments may be combined with each other arbitrarily. And although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here.
[0070] The terms "including" and any variations thereof in the specification and claims of the present disclosure are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0071] One or more of the embodiments of the present disclosure, "more than one" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item)" or similar expressions thereof refer to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c may be single or multiple.
[0072] It should be noted that the terms "first", "second", etc. in the specification, claims, and the above-mentioned drawings of the present disclosure are used to distinguish similar objects and do not necessarily describe a specific order, sequence, size, and priority. For example, the first normalization call method and the second normalization call method in the embodiments of the present disclosure are only used to distinguish different normalization call methods. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present disclosure described here can be implemented in an order other than those illustrated or described here. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present disclosure. On the contrary, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0073] The exemplary embodiments of the present disclosure will be described below with reference to the accompanying drawings. The accompanying drawings are schematic diagrams of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, or in hardware modules or integrated circuits, or in networks, processors, or microcontrollers. The embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein. The features, structures, or characteristics described in the present disclosure may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of the embodiments of the present disclosure. However, those skilled in the art should be aware that one or more of the specific details may be omitted when implementing the technical solutions of the present disclosure, or other methods, components, devices, steps, etc. may be used to replace one or more of the specific details.
[0074] It should be noted that in the embodiments of the present disclosure, some industry-existing solutions such as certain software, components, models, etc. may be mentioned. They should be regarded as exemplary, and their purpose is only to illustrate the feasibility in the implementation of the technical solutions of the present disclosure, but it does not mean that the applicant has already or necessarily used this solution. In the technical solutions of the present disclosure, the collection, dissemination, use, and display of various information of the object to be processed all comply with relevant national laws and regulations. Summary of the Invention
[0076] Currently, in the related art, when a user wants to query on which website or APP an API is used, or query which fields are used by the API on which specific end, it can only be confirmed by manually searching the code or packet capturing, resulting in low query efficiency.
[0077] Specifically, in the related art, when querying which APIs are used on a certain page of a certain terminal or APP, this information can be obtained through packet capture. For example, on the World Wide Web (web) terminal (the relevant terminal side of an application or service running based on a web browser), the developer tools (such as F12) can be used for packet capture. On the mobile terminal, a network debugging tool (such as Charles) can be used to connect to the computer proxy for packet capture. It can be seen that although there may be some detailed differences in the packet capture methods on different terminals, the prerequisite for execution is that there is a corresponding physical machine or virtual machine, enter the specified page, and use the tool to perform packet capture to obtain API information. That is to say, all the above operations rely on a real operating environment. If the page address cannot be obtained or the corresponding device cannot be used, packet capture cannot be completed. That is, relatively high requirements are put forward for the above-mentioned solutions in terms of human resources and device assets. If the corresponding requirements cannot be met, not only the query efficiency is low, but also it is impossible to accurately query which APIs are used on a certain page.
[0078] Specifically, in the related art, when querying which fields of a certain API are specifically used on a certain page of a certain terminal, only the front-end developers can obtain real and accurate information by querying the code, and other personnel cannot directly obtain it. It is necessary to find the front-end developers of the corresponding project of the corresponding page of the corresponding terminal for cooperation to query which fields of a certain API are specifically used on a certain page of a certain terminal. The whole process is relatively cumbersome, reducing the efficiency of querying which fields of a certain API are specifically used on a certain page of a certain terminal.
[0079] In view of this, the present disclosure provides an application programming interface management method. Through this method, the call relationship information of the application programming interface can be obtained from the standardized code for calling the application programming interface, and then according to the call relationship information and the preset mapping relationship, the field information included in the call relationship information is saved to the application programming interface management platform; the preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform. Further, the preset service can be provided for the callers of the application programming interface according to the field information saved in the application programming interface management platform.
[0080] It can be seen that in the embodiments of the present disclosure, the code for invoking the application programming interface can be normalized first, so as to ensure that the call relationship information obtained for the application programming interface can be managed in a normalized manner as much as possible, improving the service efficiency of subsequent services provided to callers. Then, the field information included in the call relationship information is saved to the application programming interface management platform. In this way, when the caller of the application programming interface triggers various service requests, preset services can be provided to the caller of the application programming interface based on the field information saved in the application programming interface management platform automatically. In other words, the embodiments of the present disclosure can realize automatically obtaining and maintaining the relationship between pages and terminals, invoking APIs, and using API fields on the application programming interface management platform, thereby eliminating all manual operations and restrictions on device resources. Through the search for API or page identifiers, all pages associated with the API or all API information used under the page can be quickly obtained, without the need for the caller to manually search throughout the process, greatly improving the efficiency of querying the application programming interface and related information of the application programming interface.
[0081] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure will be specifically introduced below.
[0082] Overview of Application Scenarios
[0083] To better understand the technical solutions provided by the embodiments of the present disclosure, some simple introductions to the application scenarios applicable to the technical solutions provided by the embodiments of the present disclosure will be given below. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present disclosure rather than to limit them. In specific implementations, the technical solutions provided by the embodiments of the present disclosure can be flexibly applied according to actual needs.
[0084] To introduce the content of the embodiments of the present disclosure more clearly, some key terms will be introduced below:
[0085] Application Programming Interface (API): It is a set of definitions, protocols, and tools used to achieve communication between the client and the server, specifying the specifications of requests and responses and the data interaction format to promote development efficiency, function reuse, and system integration.
[0086] Packet capture: It is a network technology means that captures the data packets transmitted on the network for analyzing the content of these data packets. It is commonly used in aspects such as network fault troubleshooting, performance optimization, security auditing, and protocol analysis.
[0087] Static code scanning: It is a process of analyzing the structure, syntax, semantics, etc. of code text without actually running the code. It can be used to find potential security vulnerabilities, code defects, and non-compliant parts in the code, and can also extract values from normalized code.
[0088] Abstract Syntax Tree (AST): It is a tree-like structure obtained after lexical analysis and syntax analysis of source code. It uses nodes to represent structural elements in the source code and edges to represent relationships between elements, abstracting the source code, removing details such as formatting, and presenting syntax and semantic information.
[0089] In the embodiments of the present disclosure, the application programming interface management technology can be applied to business scenarios that require API management, such as business scenarios for managing APIs of audio and video websites or APPs, or business scenarios for managing APIs of shopping websites or APPs, or business scenarios for managing APIs of social websites or APPs. The embodiments of the present disclosure do not limit this.
[0090] Please refer to Figure 1 as shown in Figure 1 This is an application scenario to which the technical solution of the embodiments of the present disclosure can be applied. In this scenario schematic diagram, it includes a terminal device 110 and an electronic device 120. Among them, the terminal device 110 can be one or more, and an application programming interface management platform can be set on each terminal device 110, so that different users can log in to the application programming interface management platform deployed on the corresponding terminal device 110. Figure 1 One is taken as an example for illustration. The electronic device is a service device corresponding to the application programming interface management platform, and the terminal device 110 and the electronic device 120 communicate through one or more networks 130.
[0091] In the embodiments of the present disclosure, the electronic device 120 can obtain the call relationship information of the application programming interface from the standardized code for calling the application programming interface, and then save the field information included in the call relationship information to the application programming interface management platform according to the call relationship information and a preset mapping relationship. The preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform, and the preset service can be provided for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0092] In this way, when a user wants to query the call relationship, the user can log in to the application programming interface management platform through the corresponding terminal device 110, send a call relationship query request to the electronic device 120, and then the electronic device can respond to the call relationship query request according to the field information saved in the application programming interface management platform, for example, determine the query result, determine the visualization information of the query result, and send the visualization information of the query result to the terminal device 110, so that the terminal device 110 can display the visualization information of the query result to the user.
[0093] In the embodiments of the present disclosure, Figure 1 the terminal device 110 in may be a mobile phone, a tablet computer (PAD), a personal computer, a smart TV, a smart watch, a smart speaker, a smart vehicle-mounted device, a wearable device, etc., but is not limited thereto.
[0094] In the embodiments of the present disclosure, Figure 1 the electronic device 120 in may also be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers. It may also be a cloud server or a cloud server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms, but is not limited thereto.
[0095] Of course, the method provided in the embodiments of the present disclosure is not limited to Figure 1 the application scenarios shown, and may also be used in other possible application scenarios. For example, if only the electronic device 120 executes the application program interface management method, the embodiments of the present disclosure do not limit it.
[0096] Exemplary Method
[0097] To further illustrate the technical solutions provided in the embodiments of the present disclosure, the following will be described in detail with reference to the accompanying drawings and specific implementation manners. Although the embodiments of the present disclosure provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or non-creative labor. In steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided in the embodiments of the present disclosure. When the method is actually processed or executed by the device, it may be executed in the method order shown in the embodiments or drawings or executed in parallel.
[0098] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of an application program interface management method in the embodiments of the present disclosure. The process of the method may be executed by an electronic device, for example, the electronic device may be Figure 1 the electronic device 120 in, and the specific implementation process of the method is as follows:
[0099] Step 201: Obtain the call relationship information of the application program interface from the normalized code for calling the application program interface.
[0100] In an embodiment of the present disclosure, before an electronic device obtains the call relationship information of an application programming interface from the normalized code for calling the application programming interface, it may configure call writing rules for each platform for writing the call code of the application programming interface. Each call writing rule is used to specify the writing position information of each piece of information indicating the application programming interface in the code written for the corresponding platform. That is to say, in the embodiment of the present disclosure, considering that different terminals may have different ways of calling the API, a normalized call method can be defined for the technology stack of each terminal. Among them, the foregoing platforms can be understood as different terminals, such as the web terminal, the iPhone Operating System (iOS) terminal, the Android terminal, and the Personal Computer (PC) terminal.
[0101] Optionally, for front-end code writing, a common API call method is defined in different technology stacks. For example, taking the web terminal as an example, when writing code in the js language, the normalized code is defined as:
[0102]
[0103] That is to say, the call writing rule includes: using the fetch method to request the API at https: / / example.com / api / data, obtaining the data.name and data.age fields in the response response json, and recording the currently running os and the page url identifier. The url is unique within the scope of the same terminal. That is to say, one url points to only one object. It should be noted that in other locations outside the normalized code, the solution provided by the present disclosure allows developers to add business code arbitrarily. In this way, other services can be provided for developers without affecting the use of this function, improving the experience of developers.
[0104] In an embodiment of the present disclosure, before an electronic device obtains the call relationship information of an application programming interface from the normalized code for calling the application programming interface, it may also configure call function rules for each platform. Each call function rule is used to specify the code description information of the call method for calling the application programming interface. That is to say, in the embodiment of the present disclosure, a function for collecting information can be pre-configured for each language for writing the API call code. The languages for writing the API call code are, for example, Python, Java, js, PHP, Swift, C, C#, etc.
[0105] It can be seen that in the embodiments of the present disclosure, the electronic device can pre-configure the call writing rules for writing application programming interface call codes corresponding to each platform respectively, and / or pre-configure the call function rules corresponding to each platform respectively. In this way, it is convenient to collect call relationship information subsequently, improve the collection efficiency of call relationship information, and enhance the standardization of call relationship information management.
[0106] In the embodiments of the present disclosure, the electronic device can obtain the interface description data of the application programming interface. Among them, the interface description data includes at least one of the API value, the attribute field path in the API response, the operating system running, and the page.
[0107] In a possible implementation manner, the electronic device can collect the interface description data of the application programming interface by means of static code scanning. Specifically, when the code main branch is deployed in the production environment, a static code scan for collecting interface description data can be triggered, so that the API call situation of the main branch running in the production environment can be searched. Of course, it can also be that a static code scan for collecting interface description data is executed when deployed in any environment, and the Git branch information needs to be obtained before executing the static code scan, so that the API call situation of a page under different branches can be obtained.
[0108] For example, taking the web side as an example, the electronic device can use the abstract syntax tree analysis tool Babel to extract the API value requested by the fetch method: for example, it is https: / / example.com / api / data, the attribute field paths used in the API response: for example, they are data.name, data.age, the operating system running (Operating System, running os): for example, it is web, and the page: for example, it is the example Url.
[0109] Furthermore, the electronic device can obtain the call relationship information of the application programming interface according to the interface description data of the application programming interface.
[0110] Optionally, the electronic device can establish a first mapping relationship among the call platform, the called application programming interface, and the fields used by the called application programming interface under each page identification information; and establish a second mapping relationship between each page identification information and the project identification information, and then can obtain the call relationship information of the application programming interface according to the first mapping relationship and the second mapping relationship.
[0111] For example, if the project identification information is xxx, the page identification information is urla, the calling platform is the ios client, the called application programming interface is API1, and the fields used by the called application programming interface are Params2 = {p11, p12...}, then a first mapping relationship can be established among urla, the ios client, API1, and Params2 = {p11, p12...}; and a second mapping relationship can be established between urla and xxx, so that the call relationship information of the application programming interface can be obtained according to the first mapping relationship and the second mapping relationship, that is, for the ios client, on the page with the page identification information of urla in the project with the project identification information of xxx, API1 needs to be called, and the fields used by API1 are Params2 = {p11, p12...}.
[0112] Step 202: Save the field information included in the call relationship information to the application programming interface management platform according to the call relationship information and the preset mapping relationship; the preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform.
[0113] In the embodiment of the present disclosure, the electronic device can determine each field information included in the call relationship information, respectively match it with each storage indication information of the application programming interface management platform to obtain the matching result information, and then save the field information included in the call relationship information to the application programming interface management platform according to the matching result information. That is to say, in the embodiment of the present disclosure, a corresponding storage space is set for each field information, so that when the application programming interface management platform provides preset services for subsequent callers, it can quickly query the field information and improve the query efficiency.
[0114] Step 203: Provide a preset service for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0115] In the embodiment of the present disclosure, the electronic device can provide a preset service for the caller of the application programming interface according to the field information saved in the application programming interface management platform. Herein, the preset service can be understood as some service configurations or function options pre-set by the application programming interface management platform, such as query functions or search functions, etc., which are not limited in the embodiment of the present disclosure.
[0116] Optionally, the electronic device can receive a call relationship query request, the call relationship query request carries the first identification information of the first application programming interface, and then determine the query result from the field information saved in the application programming interface management platform according to the first identification information. In addition, the visualization information of the query result can also be determined to display the visualization information to the query object.
[0117] For example, the application programming interface management platform can determine the path of the API according to the first identification information of the API, so that it can query the page that calls the API, the field information used, and the end to which the page belongs according to the path.
[0118] Optionally, the electronic device can receive a call information query request, which carries the identification information of the platform and the identification information of the page, and then determine the query result corresponding to the call information query request from the field information stored in the application programming interface management platform according to the identification information of the platform and the identification information of the page.
[0119] For example, the application programming interface management platform can query which APIs and fields are used under this page through the identification information of the platform and the identification information of the page, so as to obtain the query result corresponding to the call information query request.
[0120] It can be seen that in the embodiments of the present disclosure, the call information and the call relationship information can be quickly obtained through the application programming interface management platform, so as to improve the query efficiency of the call information and the call relationship information, and further improve the user experience.
[0121] In a possible implementation manner, the electronic device can also determine whether the preset scanning time is reached; if the current time reaches the preset scanning time, the normalized code is statically scanned again to obtain the call relationship information of the new application programming interface, and the field information stored in the application programming interface management platform is updated based on the call relationship information of the new application programming interface. The preset scanning time can be determined correspondingly based on the actual implementation. For example, it is determined according to the preset update period of the field information, or it can be determined according to the preset update period of the application programming interface management platform. This is not limited in the embodiments of the present disclosure.
[0122] That is to say, in the embodiments of the present disclosure, considering that in the actual implementation, the field information of the API and the call relationship information of the API may be changed, therefore, the field information stored in the application programming interface management platform can be updated periodically, so as to ensure that the field information when providing the preset service for the user is the latest information, that is, to ensure the accuracy of the queried call relationship information and call information. In this way, on the basis of improving the query efficiency, the query accuracy can also be improved, and the user experience can be further improved.
[0123] In the embodiments of the present disclosure, in order to introduce the application programming interface management method provided by the present disclosure more clearly, the following takes a specific example for introduction.
[0124] Please refer to Figure 3, the electronic device can define a standardized calling method for the technology stacks of the web, iOS, Android, and PC platforms. For example, a standardized calling method for the technology stacks of the aforementioned four platforms can be defined by adopting calling writing rules or calling and calling function rules. Then, the electronic device can use the static code scanning method to scan and process the web page a, iOS page b, Android page c, and PC page d, so as to obtain the call relationship information of the application programming interface. Further, the electronic device can preset a mapping relationship according to the obtained call relationship information and save the field information included in the call relationship information to the application programming interface management platform. In this way, when the user searches for field information or call relationship information on the application programming interface management platform, the application programming interface management platform can quickly reply to the user without manual processing and manual coordination, greatly improving the response efficiency of query information.
[0125] Exemplary Device
[0126] An exemplary embodiment of the present disclosure also provides an application programming interface management device. Refer to Figure 4 As shown, the application programming interface management device 400 includes the following program units:
[0127] An obtaining unit 401, configured to obtain the call relationship information of the application programming interface from the standardized code for calling the application programming interface;
[0128] A saving unit 402, configured to save the field information included in the call relationship information to the application programming interface management platform according to the call relationship information and a preset mapping relationship; the preset mapping relationship includes the correspondence between the field information and the storage indication information of the application programming interface management platform;
[0129] A processing unit 403, configured to provide a preset service for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0130] In a possible implementation manner, the device further includes a configuration unit, configured to:
[0131] Configure the call writing rules for writing the application programming interface call code corresponding to each platform, where each call writing rule is used to standardize the writing position information of each piece of information indicating the application programming interface in the writing code of the corresponding platform.
[0132] In a possible implementation manner, the device further includes a configuration unit, configured to:
[0133] Configure call function rules corresponding to each platform, where each of the call function rules is used to standardize the code description information of the call method for calling an application programming interface.
[0134] In a possible implementation manner, the obtaining unit 401 is specifically configured to:
[0135] Obtain the interface description data of the application programming interface;
[0136] Obtain the call relationship information of the application programming interface according to the interface description data of the application programming interface.
[0137] In a possible implementation manner, the obtaining unit 401 is specifically configured to:
[0138] Establish a first mapping relationship among the call platform, the called application programming interface, and the fields used by the called application programming interface under each page identification information;
[0139] Establish a second mapping relationship between each of the page identification information and the project identification information;
[0140] Obtain the call relationship information of the application programming interface according to the first mapping relationship and the second mapping relationship.
[0141] In a possible implementation manner, the saving unit 402 is specifically configured to:
[0142] Determine each field information included in the call relationship information, and respectively match it with each storage indication information of the application programming interface management platform to obtain matching result information;
[0143] Save the field information included in the call relationship information to the application programming interface management platform according to the matching result information.
[0144] In a possible implementation manner, the processing unit 403 is specifically configured to:
[0145] Receive a call relationship query request, where the call relationship query request carries the first identification information of the first application programming interface;
[0146] Determine a query result from the field information saved in the application programming interface management platform according to the first identification information;
[0147] Determine the visualization information of the query result to display the visualization information to the query object.
[0148] In a possible implementation manner, the device further includes an updating unit for:
[0149] Determine whether the preset scanning time is reached;
[0150] If the current time reaches the preset scanning time, statically scan the normalized code again to obtain the call relationship information of the new application programming interface, and update the field information stored in the application programming interface management platform based on the call relationship information of the new application programming interface.
[0151] The specific details of each part of the above device have been described in detail in the implementation manner of the method part. For the details not disclosed, please refer to the implementation manner of the method part, so they will not be elaborated here.
[0152] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0153] Exemplary Program Product
[0154] The exemplary embodiments of the present disclosure also provide a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the above application programming interface management method.
[0155] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on signals such as electricity, magnetism, light, electromagnetic, infrared, etc., including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), etc. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as read-only memory, NAND Flash, etc.
[0156] In one embodiment, the computer program product may be an intangible product containing a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as an executable file storing a computer program, a digital file such as an installation package.
[0157] The code of a computer program can be written in one or more programming languages. Examples of programming languages include C, Java, C++, etc. The program code can be executed entirely on the user's computing device, or partially on the user's computing device, or executed as an independent software package, or partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or it can be connected to an external computing device (e.g., through an Internet connection provided by an operator).
[0158] A computer program can be carried or transmitted by signals such as electricity, magnetism, light, electromagnetic, infrared, etc. An electronic device can convert the signal carrying the computer program into a digital signal and then run the computer program. When the computer program runs on an electronic device, its code is used to cause the electronic device to execute (more specifically, to cause the processor of the electronic device to execute) the method steps of various exemplary embodiments of the present disclosure. For example, it can execute the above application programming interface management method, which includes the following steps: Step 201: Obtain the call relationship information of the application programming interface from the normalized code of the calling application programming interface; Step 202: According to the call relationship information and a preset mapping relationship, save the field information included in the call relationship information to the application programming interface management platform; the preset mapping relationship includes the correspondence between the field information and the storage indication information of the application programming interface management platform; Step 203: Provide a preset service for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0159] By implementing the above method steps through a computer program, the call relationship information of the application programming interface can be obtained from the normalized code of the calling application programming interface, and then, according to the call relationship information and the preset mapping relationship, the field information included in the call relationship information can be saved to the application programming interface management platform; the preset mapping relationship includes the correspondence between the field information and the storage indication information of the application programming interface management platform. Further, a preset service can be provided for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0160] It can be seen that in the embodiments of the present disclosure, the code for invoking the application programming interface can be standardized first, so as to ensure that the obtained call relationship information of the application programming interface can be standardized and managed as much as possible, improving the service efficiency of subsequent services provided to callers. Then, the field information included in the call relationship information is saved to the application programming interface management platform. In this way, when the caller of the application programming interface triggers various service requests, preset services can be provided to the caller of the application programming interface based on the field information saved in the application programming interface management platform automatically. In other words, the embodiments of the present disclosure can realize automatically obtaining and maintaining the relationship between the page and the terminal, the invoked API, and the used API fields on the application programming interface management platform, thereby eliminating all manual operations and restrictions on device resources. Through the search of the API or page identifier, all pages associated with the API or all API information used under the page can be quickly obtained, without the need for the caller to manually search throughout the process, greatly improving the efficiency of querying the application programming interface and related information of the application programming interface.
[0161] Exemplary Electronic Device
[0162] An exemplary embodiment of the present disclosure also provides an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as a computer program. The processor executes the executable instructions to perform the method steps of various exemplary embodiments of the present disclosure.
[0163] Reference is made below Figure 5 , and the electronic device is exemplarily described in the form of a general computing device. It should be understood that Figure 5 the displayed electronic device 500 is only an example and should not impose limitations on the functions and usage scope of the embodiments of the present disclosure.
[0164] As Figure 5 shown, the electronic device 500 may include: a processor 510, a memory 520, a bus 530, an I / O (input / output) interface 540, and a network adapter 550.
[0165] The memory 520 may include volatile memory, such as RAM 521 and a cache unit 522, and may also include non-volatile memory, such as ROM 523. The memory 520 may further include one or more program modules 524. Such program modules 524 include but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment. For example, the program module 524 may include each unit in the above device.
[0166] The processor 510 may include one or more processing units. For example, the processor 510 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor, and / or an NPU (Neural-Network Processing Unit), etc.
[0167] The processor 510 can be used to execute the executable instructions stored in the memory 520. For example, it can execute the above application programming interface management method, which includes the following steps: Step 201: Obtain the call relationship information of the application programming interface from the normalized code for calling the application programming interface; Step 202: According to the call relationship information and the preset mapping relationship, save the field information included in the call relationship information to the application programming interface management platform; the preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform; Step 203: Provide a preset service for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0168] By executing the above method steps through the processor 510, the call relationship information of the application programming interface can be obtained from the normalized code for calling the application programming interface, and then, according to the call relationship information and the preset mapping relationship, the field information included in the call relationship information can be saved to the application programming interface management platform; the preset mapping relationship includes the corresponding relationship between the field information and the storage indication information of the application programming interface management platform. Further, a preset service can be provided for the caller of the application programming interface according to the field information saved in the application programming interface management platform.
[0169] As can be seen, in the embodiments of the present disclosure, the code for invoking the application programming interface can be standardized first, so as to ensure as much as possible that the obtained call relationship information of the application programming interface can be standardized and managed, improving the service efficiency of providing services to callers subsequently. Then, the field information included in the call relationship information is saved to the application programming interface management platform. In this way, when the caller of the application programming interface triggers various service requests, preset services can be provided to the caller of the application programming interface based on the field information saved in the application programming interface management platform automatically. In other words, the embodiments of the present disclosure can realize automatically obtaining and maintaining the relationship between the page and the terminal, the invoked API, and the used API fields on the application programming interface management platform, thus eliminating all manual operations and restrictions on device resources. By searching for the API or page identifier, all pages associated with the API, or all API information used under the page, can be quickly obtained without the need for the caller to manually search, greatly improving the efficiency of querying the application programming interface and related information of the application programming interface.
[0170] The bus 530 is used to implement the connection between different components of the electronic device 500, and may include a data bus, an address bus, and a control bus.
[0171] The electronic device 500 can communicate with one or more external devices 900 (such as a keyboard, a mouse, an external controller, etc.) through the I / O interface 540.
[0172] The electronic device 500 can communicate with one or more networks through the network adapter 550. For example, the network adapter 550 can provide mobile communication solutions such as 3G / 4G / 5G, or provide wireless communication solutions such as wireless local area network, Bluetooth, and near field communication. The network adapter 550 can communicate with other modules of the electronic device 500 through the bus 530.
[0173] Although Figure 5 not shown in the figure, other hardware and / or software modules can also be provided in the electronic device 500, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0174] As can be seen from the above, the technical solution of the present disclosure can be implemented as a method, a device, a system, a computer program product, a storage medium, an electronic device, and so on. Those skilled in the art can understand that various aspects of the present disclosure can be specifically implemented in the following forms, that is: a complete hardware implementation manner, a complete software implementation manner (including firmware, microcode, etc.), or an implementation manner combining hardware and software aspects, such as can be respectively referred to as "circuit", "module", or "system".
[0175] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. Those skilled in the art will readily think of other embodiments based on the specific embodiments provided by the present disclosure. Therefore, the specific embodiments provided by the present disclosure are only exemplary, and the scope and spirit of the present disclosure are pointed out by the claims, which should cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include the common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure.
Claims
1. An application programming interface management method, characterized in that, The method includes: Obtaining call relationship information of an application programming interface from normalized code for calling the application programming interface; Saving field information included in the call relationship information to an application programming interface management platform according to the call relationship information and a preset mapping relationship; the preset mapping relationship includes a corresponding relationship between field information and storage indication information of the application programming interface management platform; Providing a preset service for a caller of the application programming interface according to the field information saved in the application programming interface management platform.
2. The method according to claim 1, wherein Before obtaining call relationship information of an application programming interface from normalized code for calling the application programming interface, the method further includes: Configuring call writing rules for writing application programming interface call code corresponding to each platform, where each call writing rule is used to standardize the writing position information of each piece of information indicating the application programming interface in the written code of the corresponding platform.
3. The method according to claim 1, characterized in that Before obtaining call relationship information of an application programming interface from normalized code for calling the application programming interface, the method further includes: Configuring call function rules corresponding to each platform, where each call function rule is used to standardize code description information of a call manner for calling the application programming interface.
4. The method according to any one of claims 1 - 3, characterized in that Obtaining call relationship information of an application programming interface from normalized code for calling the application programming interface includes: Obtaining interface description data of the application programming interface; Obtaining call relationship information of the application programming interface according to the interface description data of the application programming interface.
5. The method according to claim 4, wherein Obtaining call relationship information of an application programming interface according to the interface description data of the application programming interface includes: Establishing a first mapping relationship between a call platform, a called application programming interface, and fields used by the called application programming interface under each page identification information; Establishing a second mapping relationship between each piece of page identification information and project identification information; Obtaining call relationship information of the application programming interface according to the first mapping relationship and the second mapping relationship.
6. The method according to claim 1, wherein Saving field information included in the call relationship information to the application programming interface management platform according to the call relationship information and a preset mapping relationship includes: Determining each piece of field information included in the call relationship information, respectively matching with each piece of storage indication information of the application programming interface management platform, and obtaining matching result information; Saving field information included in the call relationship information to the application programming interface management platform according to the matching result information.
7. The method according to claim 1, wherein Providing a preset service for a caller of the application programming interface according to the field information saved in the application programming interface management platform includes: Receiving a call relationship query request carrying first identification information of a first application programming interface; Determining a query result from the field information saved in the application programming interface management platform according to the first identification information; Determining visualization information of the query result to display the visualization information to a query object.
8. An application programming interface management device, characterized in that The device includes: An obtaining unit, configured to obtain call relationship information of an application programming interface from normalized code for calling the application programming interface; A storage unit, configured to save the field information included in the call relationship information to an application programming interface management platform according to the call relationship information and a preset mapping relationship; the preset mapping relationship includes a corresponding relationship between the field information and storage indication information of the application programming interface management platform; A processing unit, configured to provide a preset service for a caller of an application programming interface according to the field information saved in the application programming interface management platform.
9. An electronic device, characterized in that, Comprising: A processor; A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the method according to any one of claims 1-7 by executing the executable instructions.
10. A computer program product having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the method according to any one of claims 1-7 is implemented.