Updated on 2022-02-21 GMT+08:00

Binding a Signature Key

Function

A signature key takes effect only after being bound to an API. When requesting the backend service, API Gateway uses the signature key to cryptographically sign requests. The backend service verifies the signature to identify request sources.

This API is used to bind a signature key to one or more published APIs.

Different signature keys can be bound to an API in different environments, but only one signature key can be bound to the API in the same environment.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

POST

/v1.0/apigw/sign-bindings

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

sign_id

Yes

String

Signature key ID

publish_ids

Yes

Array of strings

API publication record ID

Example request:

{
  "sign_id": "3a793b65a9034bdfae08924f149bfb4a",
  "publish_ids": [
    "374a6d5a-20c7-4ea1-82e1-19fce4556956",
    "65e6fe53-1ac3-4481-ba36-9f0bc6f22057"
  ]
}

Response

Table 3 Parameter description

Parameter

Type

Description

-

Dictionary

List of APIs bound to the signature key

Table 4 Parameter description of the API list

Parameter

Type

Description

id

String

Binding ID

api_id

String

API ID

api_name

String

API name

api_remark

String

Description of the API

group_name

String

Name of the API group to which the API belongs

api_type

Integer

API type

sign_id

String

Signature key ID

sign_name

String

Signature key name

sign_key

String

Signature key

sign_secret

String

Signature secret

env_id

String

ID of the environment in which the API has been published

env_name

String

Name of the environment in which the API has been published

binding_time

Timestamp

Time when the signature key is bound to the API

publish_id

String

ID of the publication record

Example response:

[
  {
    "id": "d8426fb090e442c4a56a35e451bea085",
    "api_id": "3c6769c6-ec61-4b45-b478-c60310dbaa1b",
    "api_name": "bbb",
    "api_remark": "",
    "group_name": "asd",
    "api_type": 1,
    "sign_id": "3a793b65a9034bdfae08924f149bfb4a",
    "sign_name": "signature01",
    "sign_key": "abcd_1234",
    "sign_secret": "******",
    "env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
    "env_name": "RELEASE",
    "binding_time": "2018-02-07T03:17:26.396039456Z",
    "publish_id": "23234202f5834ab69113fc1b790b6bed"
  },
  {
    "id": "97952732e6d7452d99de02db99acce27",
    "api_id": "d85c502a-f916-47e8-bba0-50537a2d1af2",
    "api_name": "aaa",
    "api_remark": "",
    "group_name": "asd",
    "api_type": 1,
    "sign_id": "3a793b65a9034bdfae08924f149bfb4a",
    "sign_name": "signature01",
    "sign_key": "abcd_1234",
    "sign_secret": "******",
    "env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
    "env_name": "RELEASE",
    "binding_time": "2018-02-07T03:17:26.39803282Z",
    "publish_id": "6581f68efddc4ff0815e156ec6ecfb52"
  }
]

Status Codes

Table 5 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error