We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
MaterialsConsole

API Console Operation Guide

You can use HMS APIs provided by the HUAWEI API Console to create a project and build high-quality apps.

1. Performing Registration and Sign-in

1. Register as a developer and sign in to HUAWEI Developers.

2. Complete identity verification. For details, please refer to Registration and Verification.

2. Creating a Project

1. Go to Console >My APIs > New project.

2. Set Name and click OK.

3. Adding an API

Click Add API from library and find the required API in API Library.

The following page shows the API Library.

4. Creating a Credential

API credentials are unique identifiers that must be created before you call an API. Currently, the following types of credentials are supported:

Service account key: Machine-verifies app-level identity across servers.

OAuth 2.0 client ID: Lets your app access user-authorized data using project APIs.

API key: Identifies your project to check quota and access.

4.1 Creating a Service Account Key

The following uses Nearby Service as an example to describe how to create a service account key:

1. Go to Console > API Services > My APIs > Add API from library. In API Library, find and click Nearby Service.

2. Click Enable. The API is successfully enabled.

3. Go to Console > API Services > Credentials, select the Service account key, and click Create credential.

4. Click Generate public and private keys. The public key is displayed in Public key, and the private key is saved locally.

5. Click Create and download JSON. The service account key is successfully created.

NOTE

If you do not click Generate public and private keys, the downloaded JSON file does not contain the private key information.

6. Click Manage service accounts and click Add in the Operation column of a service account to add more keys for the service account.

A maximum of 100 public-private key pairs can be added for each service account.

4.2 Creating an OAuth Client ID

The following uses Ads Kit as an example to describe how to create an OAuth client ID:

1. Go to Console > API Services > My APIs > Add API from library. In API Library, find and click Ads Kit.

2. Click Enable. The API is successfully enabled.

.

3. Go to Console > API Services > Credentials, select the OAuth 2.0 client ID, and click Create credential.

4. Set Product type to a value, for example, Mobile app.

5. Enter other information as required.

6. Click Create. The OAuth 2.0 client ID is successfully created.

4.3 Creating an API Key

The following uses ML Kit as an example to describe how to create an API key:

1. Go to Console > API Services > My APIs > Add API from library. In API Library, find and click ML Kit.

2. Click Enable. The API is successfully enabled.

NOTE

You will need to sign an agreement for some APIs before they can be enabled.

3. Go to Console > API Services > Credentials, select the API Key, and click Create credential.

4. Select API key and click Create credential, the API key is successfully created.

5. (Optional) In the dialog box that is displayed, click Restrict to set restrictions on the key to prevent unauthorized use or quota theft.

The restrictions include App restrictions and API restrictions.

App restrictions: control which websites or apps can use your key. Set up to one app restriction per key.

API restrictions: specify the enabled APIs that this key can call.

Search
Enter a keyword.