Application programming interface (API) calling method, API publishing function and electronic equipment
Through the first API publishing function, the service requirements are sent to the CAPIF core function, the matching second APF is determined, and the interaction permission is obtained, and the API is called directly from the second APF is solved, which solves the problem of low API call efficiency and realizes more efficient API calls.
Patent Information
- Application Number
- CN202411718848.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, API calls are low and cannot be directly perceived through API publishing function (APF), which increases the delay of API calls and limits the calling permissions.
The service requirements are sent to the CAPIF core function (CCF) through the first API publishing function (APF) to determine a second APF that can provide an API that matches the service requirements. Then, an authorization request is sent to the CCF, permission to interact with the second APF, and the matching API is called directly from the second APF.
It reduces the process of API calls, improves the efficiency of API calls, reduces the network burden on CCF, and improves network performance.
Smart Images

Figure CN119537059A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to an application programming interface (API) calling method, an API publishing function and an electronic device. Background Art
[0002] 3GPP defines a common API open framework (CAPIF), which provides network capabilities to the outside world in a unified manner. That is, by providing API interfaces, it supports third-party applications to call the services and functions of the network and other applications through the Application Programming Interface (API). Summary of the invention
[0003] A technical problem to be solved by the present disclosure is: how to improve the calling efficiency of the API.
[0004] According to a first aspect of some embodiments of the present disclosure, there is provided an application programming interface API calling method, which is executed by a first API publishing function APF, including: sending business requirements to a CAPIF core function CCF to determine a second APF through the CCF, wherein the second APF can provide an API that matches the business requirements; sending an authorization request to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF; after obtaining permission to interact with the second APF, calling an API that matches the business requirements from the second APF.
[0005] In some embodiments, sending business requirements to the CAPIF core function CCF to determine the second APF through the CCF includes: sending business requirements to the CCF, wherein the business requirements include information of the first APF and information of the required API; receiving a business response sent by the CCF, wherein the business response includes information of the second APF and information of the API matching the business requirements.
[0006] In some embodiments, the information of the first APF includes at least one of the identification of the first APF and the authentication and authorization information of the first APF; and / or the first information of the required API includes at least one of the type of the required API and the purpose of the required API.
[0007] In some embodiments, the information of the second APF includes the identifier of the second APF; and / or the second information of the API matching the business requirements includes at least one of the matching degree of the API matching the business requirements and the business requirements, the name of the API matching the business requirements, status information, available area, and interface configuration, the status information is used to indicate whether the API matching the business requirements is activated, and the interface configuration includes at least one of IP information, port information, and uniform resource identifier URI information.
[0008] In some embodiments, sending a business requirement to the CCF includes: sending a first business requirement to the CCF to retrieve information about an API that matches the business requirement in the CCF, wherein the first business requirement includes information about the first APF and information about the required API; in response to not retrieving information about an API that matches the business requirement in the CCF, sending a second business requirement to the CCF, wherein the second business requirement is used to instruct the CCF to broadcast the first business requirement to the APFs registered on the CCF.
[0009] In some embodiments, calling a matching API from a second APF includes: sending a call request to the second APF, wherein the call request includes information of the first APF, information of an API matching the business requirement, and access control information, wherein the access control information indicates that the first APF has permission to interact with the second APF; and receiving a call response from the second APF.
[0010] In some embodiments, the API calling method also includes: sending a subscription request to the second APF, wherein the subscription request includes information of the first APF, information of the subscribed API, and access control information, and the access control information indicates that the first APF has the authority to interact with the second APF; and receiving a subscription response from the second APF.
[0011] In some embodiments, the first APF and the second APF are registered in the CCF.
[0012] In some embodiments, the first APF and the second APF are located in the trust domain of the same API provider.
[0013] According to a second aspect of some embodiments of the present disclosure, an APF is provided, where the APF is a first APF, including: a first sending module, configured to send business requirements to a CAPIF core function CCF, so as to determine a second APF through the CCF, wherein the second APF can provide an API that matches the business requirements; a second sending module, configured to send an authorization request to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF; and a calling module, configured to call an API that matches the business requirements from the second APF after obtaining permission to interact with the second APF.
[0014] According to a third aspect of some embodiments of the present disclosure, there is provided an API calling system, comprising: the first APF as described above; the second APF; and the CCF, wherein the CCF is configured to determine the second APF.
[0015] In some embodiments, the CCF is configured to: receive business requirements from a first APF, wherein the business requirements include information about the first APF and information about a required API; broadcast the business requirements to APFs registered with the CCF; receive a response from a second APF, wherein the response indicates that the second APF can provide an API that matches the business requirements; and send a business response to the first APF, wherein the business response includes information about the second APF and information about an API that matches the business requirements.
[0016] In some embodiments, the CCF is configured to: receive an authorization request from a first APF, wherein the authorization request includes information of the first APF and information of a second APF; send an interaction request to a second APF, wherein the interaction request includes information of the first APF and access control information corresponding to the second APF; receive an interaction response from the second APF, wherein the interaction response indicates that the second APF is allowed to interact with the first APF; send an authorization response to the first APF, wherein the authorization response includes access control information, and the access control information is used to indicate that the first APF has the authority to interact with the second APF.
[0017] According to a fourth aspect of some embodiments of the present disclosure, an electronic device is provided, comprising: a processor; and a memory coupled to the processor, for storing instructions, which, when executed by the processor, causes the processor to execute the API calling method as described above.
[0018] According to a fifth aspect of some embodiments of the present disclosure, a computer-readable storage medium is provided, on which computer instructions are stored, wherein the instructions, when executed by a processor, implement the API calling method as described above.
[0019] According to a sixth aspect of some embodiments of the present disclosure, a computer program product is provided, comprising instructions, which, when executed by a processor, cause the processor to execute the API calling method as described above.
[0020] The present disclosure sends business requirements to CCF through the first APF to determine the second APF that can provide an API matching the business requirements. The first APF then obtains the permission to interact with the second APF from CCF, so that the first APF and the second APF can interact directly, that is, the first APF can directly call the API published by the second APF, thereby reducing the API calling process and improving the API calling efficiency.
[0021] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0023] Figure 1 A flowchart of an API calling method according to some embodiments of the present disclosure is shown.
[0024] Figure 2 A schematic diagram of a process in which a first APF requests other APFs to retrieve API information through a CCF according to some embodiments of the present disclosure is shown.
[0025] Figure 3 A schematic diagram of a process of establishing interconnection between a first APF and a second APF according to some embodiments of the present disclosure is shown.
[0026] Figure 4 A schematic diagram of the process of API subscription between APFs according to some embodiments of the present disclosure is shown.
[0027] Figure 5 A schematic diagram of a process of a first APF retrieving an API through a second APF according to some embodiments of the present disclosure is shown.
[0028] Figure 6 A structural schematic diagram of the CAPIF architecture according to some embodiments of the present disclosure is shown.
[0029] Figure 7 A schematic diagram of the structure of an APF according to some embodiments of the present disclosure is shown.
[0030] Figure 8 A structural schematic diagram of an API calling system according to some embodiments of the present disclosure is shown.
[0031] Fig. 9 A schematic structural diagram of an electronic device according to some embodiments of the present disclosure is shown.
[0032] Fig.10 A schematic structural diagram of an electronic device according to some other embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0033] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0034] The CAPIF architecture includes the CAPIF Core Function (CCF), API Exposing Function (AEF), API Publishing Function (APF) and API Management Function (AMF). AEFs in different trust domains can interact with each other to transfer API callers' API calls, but the interaction process between other modules is not clear, and it is impossible to achieve interaction within the same trust domain or across trust domains.
[0035] For example, when APIs are opened and authorized between different application APPs, the APP that calls the API (i.e., the API caller) can only obtain relevant API information through CCF and cannot directly perceive it through APF, thereby increasing the latency of the API call and restricting its calling permissions, which significantly reduces the user's business experience when using the APP.
[0036] Based on this, the present disclosure provides an API calling method. Through the API calling method of the present disclosure, different APFs in the same trust domain can interact directly, thereby improving the API calling efficiency.
[0037] Figure 1 FIG. 1 is a flow chart showing an API calling method according to some embodiments of the present disclosure. Figure 1 As shown, the method of this embodiment is executed by the first APF, and includes steps S102 to S106.
[0038] In step S102, the business requirements are sent to the CAPIF core function CCF to determine the second APF through the CCF, wherein the second APF can provide an API matching the business requirements.
[0039] APF is pre-registered with CCF. When the first APF cannot provide the API required by the business demand, that is, when the API information retrieved by the first APF from CCF cannot match the business demand, the first APF sends the business demand to CCF to determine the second APF that can provide the API matching the business demand through CCF.
[0040] That is, the first APF and the second APF are registered in the CCF. In this way, the CCF determines the second APF from other APFs registered with itself according to the service requirements of the first APF.
[0041] The first APF and the second APF are located in the trust domain of the same API provider. The trust domain is determined, for example, based on the API publishing operator. If the first APF and the second APF are published by the same operator, the first APF and the second APF are considered to be in the same trust domain (or trusted domain). Alternatively, the trust domain can be configured according to business conditions as required.
[0042] In some embodiments, sending business requirements to the CAPIF core function CCF to determine the second APF through the CCF includes: sending business requirements to the CCF, wherein the business requirements include information of the first APF and information of the required API; receiving a business response sent by the CCF, wherein the business response includes information of the second APF and information of the API matching the business requirements.
[0043] The first APF sends a business requirement to the CCF. The business requirement carries the information of the first APF and the required API information, so that the business requirement is broadcast to other APFs registered on the CCF through the CCF. Other APFs determine whether they can meet the API required by the business requirement based on the information of the first APF and the required API information. If it can be provided, a response is sent to the CCF, and the CCF informs the first APF of the information of the other APFs that sent the response.
[0044] In some embodiments, sending a business requirement to the CCF includes: sending a first business requirement to the CCF to retrieve information about an API that matches the business requirement in the CCF, wherein the first business requirement includes information about the first APF and information about the required API; in response to not retrieving information about an API that matches the business requirement in the CCF, sending a second business requirement to the CCF, wherein the second business requirement is used to instruct the CCF to broadcast the first business requirement to the APFs registered on the CCF.
[0045] In some embodiments, the information of the first APF includes at least one of the identification of the first APF and the authentication and authorization information of the first APF; and / or the first information of the required API includes at least one of the type of the required API and the purpose of the required API.
[0046] The authentication and authorization information of the first APF is used to determine the API that matches the business requirements. The authentication and authorization information of the first APF can indicate the first APF's calling authority over the API. For example, API1 needs to authenticate its identity. If the authentication and authorization information of the first APF indicates that the first APF has completed identity authentication, then the first APF can directly call API1, so that API1 has a higher degree of match with the business requirements; if the authentication and authorization information of the first APF indicates that the first APF has not completed identity authentication, then the first APF cannot directly call API1, so that API1 has a lower degree of match with the business requirements. Subsequently, the first APF can choose to call an API with a higher degree of match to better meet business needs.
[0047] In some embodiments, the information of the second APF includes the identifier of the second APF; and / or the second information of the API matching the business requirements includes at least one of the matching degree of the API matching the business requirements and the business requirements, the name of the API matching the business requirements, status information, available area, and interface configuration, the status information is used to indicate whether the API matching the business requirements is activated, and the interface configuration includes at least one of IP information, port information, and uniform resource identifier URI information.
[0048] The first APF selects the API to be called according to the matching degree combined with the status information, the available area, etc., and calls the selected API according to the name, the interface configuration, etc.
[0049] In some embodiments, when the CCF fails to find a second APF that can provide a service that matches the service requirement, the CCF informs the first APF of the result. The first APF can feed back the result to the user so that the user can adjust the service requirement.
[0050] After the first APF receives the information of the second APF sent by the CCF, it can request direct interaction with the second APF through the following steps.
[0051] In step S104, an authorization request is sent to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF.
[0052] The authorization request, for example, includes the identifier of the first APF and the identifier of the second APF.
[0053] After receiving the authorization request sent by the first APF, the CCF sends an interaction request to the second APF to inquire whether the second APF is allowed to interact with the first APF. The interaction request includes, for example, the identification of the first APF and the access control information (eg, Token) allocated to the second APF.
[0054] After receiving a response from the second APF allowing interaction with the first APF, the CCF authorizes the first APF, that is, sends the access control information corresponding to the second APF to the first APF, such as sending the Token to the first APF. In this way, the first APF has the authority to interact with the second APF.
[0055] In step S106, after obtaining the permission to interact with the second APF, an API matching the business requirement is called from the second APF.
[0056] In some embodiments, calling a matching API from a second APF includes: sending a call request to the second APF, wherein the call request includes information of the first APF, information of an API matching the business requirement, and access control information, wherein the access control information indicates that the first APF has permission to interact with the second APF; and receiving a call response from the second APF.
[0057] After obtaining permission to interact with the second APF, the first APF can use the access control information to directly call the second APF for information that matches the business needs, or directly retrieve API information from the second APF based on business needs, or request a subscription from the second APF so that it can obtain the API information of interest in a timely manner in the future.
[0058] In some embodiments, the API calling method also includes: sending a subscription request to the second APF, wherein the subscription request includes information of the first APF, information of the subscribed API, and access control information, and the access control information indicates that the first APF has the authority to interact with the second APF; and receiving a subscription response from the second APF.
[0059] Figure 2 FIG. 1 shows a flow chart of a first APF requesting other APFs to retrieve API information through a CCF according to some embodiments of the present disclosure. Figure 2 As shown, the method of this embodiment includes steps S200 to S208.
[0060] In step S200, both the first APF and the second APF are registered in advance on the CCF.
[0061] In step S202, the first APF receives a local request and needs to obtain relevant API information.
[0062] In step S204, after receiving the local request, the first APF searches the CCF for relevant API information through a search process and obtains a reply message from the CCF indicating that no relevant API information is found.
[0063] In step S206, the first APF did not obtain the required API information after searching, so it requested the CCF to broadcast to other APIs, which included the required API information (for example, the ID of the first APF, the authentication and authorization information of the first APF, the type of required API, the purpose of the required API call, etc.).
[0064] In step S208, after the CCF agrees to the broadcast request of the first APF, it sends a broadcast request to other APFs registered with the CCF, inquiring the APF that can provide the required API, including information such as the API type and the purpose of the API call.
[0065] When the first APF needs to obtain API information but fails to retrieve the relevant API information in CCF, that is, the first APF cannot provide the required API and needs to use other APFs. The first APF determines other APFs that can provide the required API through CCF, so that it can directly interact with other APFs to obtain the required API. That is, the first APF does not need to interact with CCF in the process of calling the required API later. This can not only reduce the process of API calls, but also divert the traffic of CCF, reduce the network burden of CCF, and improve network performance.
[0066] Figure 3 FIG. 2 shows a schematic diagram of a process of establishing interconnection between a first APF and a second APF according to some embodiments of the present disclosure. Figure 3 As shown, the method of this embodiment includes steps S302 to S312.
[0067] In step S302, the second APF that can provide the API required by the first APF initiates an API publishing process to the CCF.
[0068] In step S304, after receiving the reply from the second APF, CCF sends a retrieval response (i.e., a business response) to the first APF. The business response includes, for example, the ID of the second APF, the name of the API, the status of whether the API is activated, the available area of the API, and specific information of the interface, such as: IP address, port, URI, etc.
[0069] In step S306, after the first APF saves the information related to the API that the second APF can provide, it sends an authorization request to the CCF to request the CCF to authorize the first APF to interact directly with the second APF, which includes the IDs of the first APF and the second APF, the authorization and authentication information of the first APF, etc.
[0070] In step S308, the CCF sends the interaction request of the first APF to the second APF, which includes the ID of the first APF and the Token authentication instruction assigned to the second APF (access control information used for interaction between the first APF and the second APF), wherein the Token is used as the interaction credential.
[0071] In step S310, after obtaining the consent of the second APF, the CCF allocates an authorization Token to the first APF.
[0072] In step S312, the first APF subscribes to the relevant API publishing events from the second APF according to the allocated Token, and retrieves the relevant API information through the second APF.
[0073] After obtaining the permission to interact directly with the second APF through CCF, the first APF can directly subscribe to the relevant API from the second APF or directly retrieve the relevant API. This improves the efficiency of calling the API, enhances the information retrieval capability between different applications, and can also improve the user experience of IoT applications.
[0074] Figure 4 FIG. 2 shows a schematic diagram of a process of subscribing to an API between APFs according to some embodiments of the present disclosure. Figure 4 As shown, the method of this embodiment includes steps S402 to S406.
[0075] In step S402, after obtaining authorization from the CCF, the first APF sends an API publishing information subscription request to the second APF, which includes the ID of the first APF, the Token information allocated by the CCF, the subscribed API information, etc.
[0076] In step S404, the second APF authenticates the first APF, that is, compares the Token information and ID in the first APF request with the Token information and ID issued by the CCF when establishing the interconnection. If they match, proceed to the next step.
[0077] In step S406, after the second APF successfully authenticates the request of the first APF, the second APF sends an API publishing API information subscription reply to the first APF, indicating that the first APF's API publishing information subscription is successful.
[0078] After the first APF obtains the permission to interact directly with the second APF, that is, after the first APF establishes interconnection with the second APF, the first APF can subscribe to the API of interest to the second APF in order to obtain the information of the API of interest in a timely manner, so that the API can be called in a timely manner to serve business needs.
[0079] Figure 5FIG. 1 shows a flow chart of a first APF retrieving an API through a second APF according to some embodiments of the present disclosure. Figure 5 As shown, the method of this embodiment includes steps S502 to S506.
[0080] In step S502, after establishing interconnection with the second APF, the first APF sends an API search request to the second APF, which includes the name, type, purpose, ID of the first APF and authentication token information of the API;
[0081] In step S504, the second APF retrieves the API according to the request information of the first APF;
[0082] In step S506, the second APF sends the search result to the first APF, which includes the retrieved API information and the matching degree.
[0083] After the first APF establishes interconnection with the second APF, it can retrieve the API from the second APF at any time according to local requests, that is, business needs, to obtain relevant API information. That is, business needs can be met through the first APF and the second APF, which can meet business needs more timely and fully.
[0084] The following describes the API calling method of the present invention by taking the vehicle to everything (V2X) intelligent driving scenario as an example.
[0085] In the case of V2X smart driving, when the terminal of the vehicle software APP1 needs to access the location of other cars, if the required information is accessed through CCF, the terminal of APP1 needs to access the information through the path of CCF-AEF-resource provider (resource owner). When the position of a vehicle within the detection range of the vehicle software APP1 changes and is no longer within the detection range, the resource provider needs to withdraw the API access rights of the corresponding location according to the process of the CAPIF architecture. When a vehicle that has moved out of the detection range re-enters the detection range, it is necessary to obtain access authorization through the CCF path again. Since the access path of this process in V2X is long and a large delay is generated, a shorter path needs to be taken to optimize the location acquisition process of smart driving. The API calling method disclosed in the present invention enables direct communication between APFs and reduces API calling delays. The following are the specific steps.
[0086] In step S1, the cloud APF1 of the vehicle software APP1 periodically communicates with the CCF, and requests other APFs to retrieve relevant information of the location API through the CCF, including steps S1.1 to S1.3.
[0087] In step S1.1, the terminal of APP1 requests the cloud APF1 to retrieve API information;
[0088] In step S1.2, CCF retrieves the API according to the requirements of APF1, where APF1 indicates that it needs to obtain the location API related information published by the APF associated with other vehicles within the intelligent driving range;
[0089] In step S1.3, when CCF replies to APF1 with relevant information about other car cloud APFs within the detection range, and the location APIs of these cars have not yet been opened, that is, have not been published through the cloud APF, APF1 requests CCF to send a broadcast to the APFs of these cars, asking which APFs can open the vehicle's location API.
[0090] In step S2, APF1 establishes interconnection with the APF of the open location API, including steps S2.1 to S2.5.
[0091] In step S2.1, the APF that allows the location API to be opened initiates an API publishing process to the CCF, informing the CCF that the location API of the corresponding vehicle is allowed to be opened.
[0092] In step S2.2, CCF sends a reply message to the cloud APF1 of the vehicle software APP1, which includes the API information opened by the APF in step 2.1.
[0093] In step S2.3, APF1 then requests authorization from CCF, indicating that it needs to directly establish interconnection with the APF in step 2.1.
[0094] In step S2.4, CCF forwards APF1's request to the APF in step 2.1, attaches the verification Token generated locally by CCF to the request, and after obtaining the consent of APF in step 2.1, CCF informs APF1 and issues the corresponding verification Token to it.
[0095] In step S2.5, APF1 establishes a connection with the corresponding car cloud APF based on the Token, requests to subscribe to the change event of the location API, and requests to retrieve the information of the location API in the corresponding APF.
[0096] Figure 6 FIG. 4 shows a schematic diagram of the structure of the CAPIF architecture according to some embodiments of the present disclosure. Figure 6As shown in the figure, different APFs in the same API provider trusted domain can communicate directly, for example, the APF of APP1 can communicate directly with the APF of APP2. In this way, the API caller (such as APP1 in the above) can use the APIs published by APP1 and APP2. CAPIF-9 in the figure is the reference point for interaction between different APFs in the same API provider trusted domain.
[0097] The present disclosure sends business requirements to CCF through the first APF to determine the second APF that can provide an API matching the business requirements. The first APF then obtains the permission to interact with the second APF from CCF, so that the first APF and the second APF can interact directly, that is, the first APF can directly call the API published by the second APF, thereby reducing the API calling process and improving the API calling efficiency.
[0098] This disclosure adds the interaction process between APFs in the trusted domain of the API provider to the original CAPIF architecture, and improves the process and transmission parameters for APFs to retrieve and subscribe to API information through other APFs, so that APFs can interact directly and call APIs. This not only improves the efficiency of API calls, but also helps to balance the network load when network capabilities are open and improve network performance.
[0099] Figure 7 Schematic diagram of the structure of APF according to some embodiments of the present disclosure is shown. APF is the first APF mentioned above, such as Figure 7 As shown, the first APF 70 includes modules 710-730.
[0100] The first sending module 710 is configured to send the business requirement to the CAPIF core function CCF, so as to determine the second APF through the CCF, wherein the second APF can provide an API matching the business requirement;
[0101] The second sending module 720 is configured to send an authorization request to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF;
[0102] The calling module 730 is configured to call an API matching the business requirement from the second APF after obtaining the permission to interact with the second APF.
[0103] In some embodiments, the first sending module 710 is configured to send business requirements to the CCF, wherein the business requirements include information of the first APF and information of the required API; and receive a business response sent by the CCF, wherein the business response includes information of the second APF and information of the API matching the business requirements.
[0104] In some embodiments, the information of the first APF includes at least one of the identification of the first APF and the authentication and authorization information of the first APF; and / or the first information of the required API includes at least one of the type of the required API and the purpose of the required API.
[0105] In some embodiments, the information of the second APF includes the identifier of the second APF; and / or the second information of the API matching the business requirements includes at least one of the matching degree of the API matching the business requirements and the business requirements, the name of the API matching the business requirements, status information, available area, and interface configuration, the status information is used to indicate whether the API matching the business requirements is activated, and the interface configuration includes at least one of IP information, port information, and uniform resource identifier URI information.
[0106] In some embodiments, the first sending module 710 is configured to send a first business requirement to the CCF to retrieve information about an API that matches the business requirement in the CCF, wherein the first business requirement includes information about the first APF and information about the required API; in response to not retrieving information about an API that matches the business requirement in the CCF, sending a second business requirement to the CCF, wherein the second business requirement is used to instruct the CCF to broadcast the first business requirement to the APFs registered on the CCF.
[0107] In some embodiments, the calling module 730 is configured to send a calling request to the second APF, wherein the calling request includes information of the first APF, information of an API matching the business requirements, and access control information, wherein the access control information indicates that the first APF has the authority to interact with the second APF; and receive a calling response from the second APF.
[0108] In some embodiments, the first APF 70 is also configured to send a subscription request to the second APF, wherein the subscription request includes information of the first APF, information of the subscribed API, and access control information, wherein the access control information indicates that the first APF has the authority to interact with the second APF; and receive a subscription response from the second APF.
[0109] In some embodiments, the first APF and the second APF are registered in the CCF.
[0110] In some embodiments, the first APF and the second APF are located in the trust domain of the same API provider.
[0111] The present disclosure sends business requirements to CCF through the first APF to determine the second APF that can provide an API matching the business requirements. The first APF then obtains the permission to interact with the second APF from CCF, so that the first APF and the second APF can interact directly, that is, the first APF can directly call the API published by the second APF, thereby reducing the API calling process and improving the API calling efficiency.
[0112] Figure 8 FIG. 1 shows a schematic diagram of the structure of an API calling system according to some embodiments of the present disclosure. Figure 8 As shown, the API calling system 80 includes the first APF 810 as described above; the second APF 820; and the CCF 830, where the CCF is configured to determine the second APF.
[0113] In some embodiments, the CCF is configured to: receive business requirements from a first APF, wherein the business requirements include information about the first APF and information about a required API; broadcast the business requirements to APFs registered with the CCF; receive a response from a second APF, wherein the response indicates that the second APF can provide an API that matches the business requirements; and send a business response to the first APF, wherein the business response includes information about the second APF and information about an API that matches the business requirements.
[0114] In some embodiments, the CCF is configured to: receive an authorization request from a first APF, wherein the authorization request includes information of the first APF and information of a second APF; send an interaction request to a second APF, wherein the interaction request includes information of the first APF and access control information corresponding to the second APF; receive an interaction response from the second APF, wherein the interaction response indicates that the second APF is allowed to interact with the first APF; send an authorization response to the first APF, wherein the authorization response includes access control information, and the access control information is used to indicate that the first APF has the authority to interact with the second APF.
[0115] The first APF in the embodiments of the present disclosure can be implemented by various computing devices or computer systems. Fig. 9 as well as Fig.10 Give a description.
[0116] Fig. 9 FIG. 1 shows a schematic diagram of the structure of an electronic device according to some embodiments of the present disclosure. Fig. 9 As shown, the electronic device 90 of this embodiment includes: a memory 910 and a processor 920 coupled to the memory 910 , and the processor 920 is configured to execute the API calling method in any of some embodiments of the present disclosure based on instructions stored in the memory 910 .
[0117] The memory 910 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, a database, and other programs.
[0118] Fig.10 FIG. 2 shows a schematic diagram of the structure of an electronic device according to some other embodiments of the present disclosure. Fig.10 As shown, the electronic device 100 of this embodiment includes: a memory 1010 and a processor 1020, which are similar to the memory 910 and the processor 920, respectively. It can also include an input and output interface 1030, a network interface 1040, a storage interface 1050, etc. These interfaces 1030, 1040, 1050 and the memory 1010 and the processor 1020 can be connected, for example, via a bus 1060. Among them, the input and output interface 1030 provides a connection interface for input and output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 1040 provides a connection interface for various networked devices, for example, it can be connected to a database server or a cloud storage server, etc. The storage interface 1050 provides a connection interface for external storage devices such as SD cards and USB flash drives.
[0119] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements any of the aforementioned API calling methods when executed by a processor.
[0120] An embodiment of the present disclosure further provides a computer program product, comprising instructions, which, when executed by a processor, enable the processor to execute any one of the aforementioned API calling methods.
[0121] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0122] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0125] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. An application programming interface API calling method, executed by a first API publishing function APF, comprising: Sending a business requirement to a CAPIF core function CCF to determine a second APF through the CCF, wherein the second APF can provide an API matching the business requirement; Sending an authorization request to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF; After obtaining the permission to interact with the second APF, the API matching the business requirement is called from the second APF.
2. The API calling method according to claim 1, wherein: The sending of the service requirement to the CAPIF core function CCF to determine the second APF through the CCF includes: Sending a service requirement to the CCF, wherein the service requirement includes information of the first APF and information of the required API; Receive a service response sent by the CCF, wherein the service response includes information of the second APF and information of the API matching the service requirement.
3. The API calling method according to claim 2, wherein: The information of the first APF includes at least one of an identification of the first APF and authentication and authorization information of the first APF; and / or The first information of the required API includes at least one of the type of the required API and the purpose of the required API.
4. The API calling method according to claim 2, wherein: The information of the second APF includes an identifier of the second APF; and / or The second information of the API that matches the business requirement includes at least one of the matching degree of the API that matches the business requirement and the business requirement, the name of the API that matches the business requirement, status information, available area, and interface configuration. The status information is used to indicate whether the API that matches the business requirement is activated, and the interface configuration includes at least one of IP information, port information, and uniform resource identifier URI information.
5. The API calling method according to claim 2, wherein: The sending of the service requirement to the CCF includes: Sending a first service requirement to the CCF to retrieve information of an API matching the service requirement in the CCF, wherein the first service requirement includes information of the first APF and information of the required API; In response to not retrieving information of an API matching the service requirement in the CCF, sending a second service requirement to the CCF, wherein the second service requirement is used to instruct the CCF to broadcast the first service requirement to the APF registered on the CCF.
6. The API calling method according to claim 1, wherein: The calling the matching API from the second APF comprises: Sending a call request to the second APF, wherein the call request includes information of the first APF, information of the API matching the business requirement, and access control information, wherein the access control information indicates that the first APF has the authority to interact with the second APF; Receive a call response from the second APF.
7. The API calling method according to claim 1, further comprising: Sending a subscription request to the second APF, wherein the subscription request includes information of the first APF, information of the subscribed API, and access control information, wherein the access control information indicates that the first APF has the authority to interact with the second APF; Receive a subscription response from the second APF.
8. The API calling method according to claim 1, wherein: The first APF and the second APF are registered in the CCF.
9. The API calling method according to claim 1, wherein: The first APF and the second APF are located in the trust domain of the same API provider.
10. An APF, wherein the APF is a first APF, comprising: A first sending module is configured to send a business requirement to a CAPIF core function CCF, so as to determine a second APF through the CCF, wherein the second APF can provide an API matching the business requirement; A second sending module is configured to send an authorization request to the CCF, wherein the authorization request is used to obtain permission to interact with the second APF; The calling module is configured to call the API matching the business requirement from the second APF after obtaining the permission to interact with the second APF.
11. An API calling system, comprising: The first APF as claimed in claim 10; Second APF; The CCF is configured to determine the second APF.
12. The API calling system according to claim 11, wherein: The CCF is configured to: receiving a service requirement of the first APF, wherein the service requirement includes information of the first APF and information of a required API; Broadcasting the service requirements to the APF registered with the CCF; receiving a response from the second APF, wherein the response indicates that the second APF can provide an API matching the service requirement; Send a service response to the first APF, wherein the service response includes information about the second APF and information about the API that matches the service requirement.
13. The API calling system according to claim 12, wherein: The CCF is configured to: receiving an authorization request from the first APF, wherein the authorization request includes information about the first APF and information about the second APF; Sending an interaction request to the second APF, wherein the interaction request includes information of the first APF and access control information corresponding to the second APF; receiving an interaction response from the second APF, wherein the interaction response indicates that the second APF is allowed to interact with the first APF; An authorization response is sent to the first APF, wherein the authorization response includes access control information, and the access control information is used to indicate that the first APF has the authority to interact with the second APF.
14. An electronic device comprising: processor; as well as A memory coupled to the processor, for storing instructions, wherein when the instructions are executed by the processor, the processor executes the API calling method according to any one of claims 1 to 9.
15. A computer-readable storage medium having computer instructions stored thereon, wherein: When the instruction is executed by the processor, the API calling method according to any one of claims 1 to 9 is implemented. 16 . A computer program product comprising instructions, which, when executed by a processor, cause the processor to execute the API calling method according to claim 1 .