Updated on 2022-09-15 GMT+08:00

Authorizing an API to Apps

Description

An app cannot access any APIs after being created. To enable an app to access an API, authorize the API to the app. After the authorization is successful, the app can access the API within the validity period.

API authorization includes authorization and renewal.
  • Authorization: The authorized app can access the API within the validity period.
  • Renewal: You can extend the validity period.

URL

  • URI format

    POST /v1/{project_id}/service/apis/{api_id}/instances/{instance_id}/authorize

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

    api_id

    Yes

    String

    API ID

    instance_id

    Yes

    String

    Cluster ID

Request Message

  • Example request
    {
    "app_ids":["908489209a320df61607355c57c82882"],
    "time":"2021-01-01T10:00:00.000Z"
    }
  • Request parameter description

    Parameter

    Mandatory

    Type

    Description

    app_ids

    Yes

    String[]

    App IDs

    time

    Yes

    String

    End time, in ISO format (+0 time zone). The app can access the API before the end time. The time is accurate to hour.

Response

  • Example response

    None

Status Code

Status Code

Description

204

The API is authorized successfully.

For details about status codes, see Status Codes.