# US 2021/0344774 A1 · Method and apparatus for invoking application programming interface

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0344774 A1
- Document ID: US20210344774A1
- Status: Published application
- Kind: A1
- Application number: 17/374,732
- Filed: 2021-07-13
- Published: 2021-11-04
- Earliest claimed: 2019-01-14
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Cuili GE; Yanmei YANG; Yizhuang WU
- Web page: https://patentgrep.com/patent/US20210344774A1

## CPC

- G06F 8/36: Software reuse
- H04L 67/60: Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources (admission control or resource allocation H04L47/70)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

This application provides a method and an apparatus for invoking an application programming interface API, to determine a target exposing function network element used to invoke an API. The method includes: A first network element obtains routing information of an API, where the routing information is used to indicate a route for invoking the API, and the API is provided by a first exposing function network element and a second exposing function network element; the first network element obtains invocation parameter information of the API, where the invocation parameter information is used to handle the API; and the first network element determines a target exposing function network element in the first exposing function network element and the second exposing function network element based on the routing information and the invocation parameter information.

## Claims

### Claim 1

A method for invoking an application programming interface (API), comprising:
obtaining, by a first network element, routing information of an API, wherein the routing information is used to indicate a route for invoking the API, and the API is provided by a first exposing function network element and a second exposing function network element;
obtaining, by the first network element, invocation parameter information of the API, wherein the invocation parameter information is used to handle the API; and
determining, by the first network element, a target exposing function network element in the first exposing function network element and the second exposing function network element based on the routing information and the invocation parameter information.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the invocation parameter information comprises at least one of identification information of a terminal device or location information of the terminal device; and/or
the routing information comprises information about the first exposing function network element, information about the second exposing function network element, information about a first serving area corresponding to the API, and information about a second serving area corresponding to the API, wherein the API provided by the first exposing function network element corresponds to the first serving area, and the API provided by the second exposing function network element corresponds to the second serving area.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the first network element is a core function network element, and the obtaining, by the first network element, invocation parameter information of the API comprises:
receiving, by the first network element, the invocation parameter information of the API from a border exposing function network element; and
the method further comprises:
sending, by the first network element, information about the target exposing function network element to the border exposing function network element.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the first network element is the core function network element, and the obtaining, by a first network element, routing information of an API comprises:
receiving, by the first network element, the routing information of the API from a publishing function network element.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the first network element is the core function network element, and the method further comprises:
receiving, by the first network element, the information about the first exposing function network element, the information about the second exposing function network element, the information about the first serving area corresponding to the API, and the information about the second serving area corresponding to the API from a publishing function network element, wherein the API provided by the first exposing function network element corresponds to the first serving area, and the API provided by the second exposing function network element corresponds to the second serving area; and
the obtaining, by a first network element, routing information of an API comprises:
generating, by the first network element, the routing information of the API based on the information about the first exposing function network element, the information about the second exposing function network element, the information about the first serving area, and the information about the second serving area.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the first network element is a border exposing function network element, and the obtaining, by a first network element, routing information of an API comprises:
receiving, by the first network element, the routing information of the API from a core function network element or a publishing function network element.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the method further comprises:
sending, by the first network element, a request message, wherein the request message is used to request the routing information of the API, and the request message comprises identification information of the API.

### Claim 8 (depends on 1)

The method according to claim 1, wherein the routing information is an invocation routing rule of the API.

### Claim 9

A method for invoking an application programming interface (API), comprising:
obtaining, by a second network element, routing information of an API, wherein the routing information is used to indicate a route for invoking the API, and the API is provided by a first exposing function network element and a second exposing function network element; and
sending, by the second network element, the routing information to a border exposing function network element, wherein the routing information is used by the border exposing function network element to determine a target exposing function network element, and the target exposing function network element is determined in the first exposing function network element and the second exposing function network element.

### Claim 10 (depends on 9)

The method according to claim 9, wherein the routing information comprises information about the first exposing function network element, information about the second exposing function network element, information about a first serving area corresponding to the API, and information about a second serving area corresponding to the API, wherein the API provided by the first exposing function network element corresponds to the first serving area, and the API provided by the second exposing function network element corresponds to the second serving area.

### Claim 11 (depends on 9)

The method according to claim 9, wherein the second network element is a core function network element, and the method further comprises:
receiving, by the second network element, the information about the first exposing function network element, the information about the second exposing function network element, the information about the first serving area corresponding to the API, and the information about the second serving area corresponding to the API from a publishing function network element, wherein the API provided by the first exposing function network element corresponds to the first serving area, and the API provided by the second exposing function network element corresponds to the second serving area; and
the obtaining, by a second network element, routing information of an API comprises:
generating, by the second network element, the routing information of the API based on the information about the first exposing function network element, the information about the second exposing function network element, the information about the first serving area, and the information about the second serving area.

### Claim 12 (depends on 9)

The method according to claim 9, wherein before the sending, by the second network element, the routing information to a border exposing function network element, the method further comprises:
receiving, by the second network element, a request message from the border exposing function network element, wherein the request message is used to request the routing information, and the request message comprises identification information of the API; and
the sending, by the second network element, the routing information to a border exposing function network element comprises:
sending, by the second network element, the routing information to the border exposing function network element based on the request message.

### Claim 13 (depends on 9)

The method according to claim 9, wherein the routing information is an invocation routing rule of the API.

### Claim 14

A system, comprising a first network element and a second network element, wherein:
the second network element is configured to obtain routing information of an application programming interface (API), wherein the routing information is used to indicate a route for invoking the API, and the API is provided by a first exposing function network element and a second exposing function network element; and send the routing information to the first network element;
the first network element is configured to obtain the routing information of the API; obtain invocation parameter information of the API, wherein the invocation parameter information is used to handle the API; and determine a target exposing function network element in the first exposing function network element and the second exposing function network element based on the routing information and the invocation parameter information.

### Claim 15 (depends on 14)

The system according to claim 14, wherein the first network element is a border exposing function network element, and the first network element is configured to receive the routing information of the API from a core function network element or a publishing function network element.

### Claim 16 (depends on 15)

The system according to claim 15, wherein the first network element is further configured to:
send a request message, wherein the request message is used to request the routing information of the API, and the request message comprises identification information of the API.

### Claim 17 (depends on 14)

The system according to claim 14, wherein the routing information is an invocation routing rule of the API.

### Claim 18 (depends on 14)

The system according to claim 14, wherein the routing information comprises information about the first exposing function network element, information about the second exposing function network element, information about a first serving area corresponding to the API, and information about a second serving area corresponding to the API, wherein the API provided by the first exposing function network element corresponds to the first serving area, and the API provided by the second exposing function network element corresponds to the second serving area.

### Claim 19 (depends on 14)

The system according to claim 14, wherein the second network element is further configured to receive a request message from the border exposing function network element, wherein the request message is used to request the routing information, and the request message comprises identification information of the API; and
the second network element is configured to send the routing information to the border exposing function network element based on the request message.
