Usage Planの作成

Prev Next

Classic/VPC環境で利用できます。

ユーザーが指定した条件に基づいて Usage Planを作成します。

リクエスト

リクエスト形式を説明します。リクエスト形式は次の通りです。

メソッド URI
POST /usage-plans

リクエストヘッダ

API Gatewayで共通して使用されるヘッダの詳細は、API Gatewayのリクエストヘッダをご参照ください。

リクエスト構文

リクエスト構文は次の通りです。

{
    "monthQuotaRequest" : 1,
    "dayQuotaRequest" : 6,
    "usagePlanDescription" : "usagePlanDescription",
    "rateRps" : 0,
    "quotaCondition" : "quotaCondition",
    "usagePlanName" : "usagePlanName"
}

リクエストボディ

リクエストボディの説明は次の通りです。

フィールド タイプ 必須の有無 説明
monthQuotaRequest Long Conditional 月別リクエスト処理限度(件/月)
  • 0~9,223,372,036,854,775,807
  • dayQuotaRequest入力時、必須
dayQuotaRequest Long Conditional 日別リクエスト処理限度(件/日)
  • 1~9,223,372,036,854,775,807
  • monthQuotaRequest入力時、必須
usagePlanDescription String Optional 作成する Usage Planの説明
  • 0~50文字
rateRps Long Optional リクエスト処理量(件/秒)
  • 1~2,147,483,647
quotaCondition String Optional 使用量制御条件
  • 2xx | 3xx | 4xx | 5xx | others
usagePlanName String Required 作成する Usage Planの名前
  • 0~45文字

リクエスト例

リクエストのサンプルコードは次の通りです。

curl --location --request POST 'https://apigateway.apigw.ntruss.com/api/v1/usage-plans' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data '{
    "monthQuotaRequest": 10,
    "dayQuotaRequest": 5,
    "rateRps": 2,
    "quotaCondition": "2xx",
    "usagePlanDescription": "usage plan",
    "usagePlanName": "usageplan000"
}'

レスポンス

レスポンス形式を説明します。

レスポンス構文

レスポンス構文は次の通りです。

{
    "usagePlan" : {
        "domainCode" : "domainCode",
        "usagePlanId" : "usagePlanId",
        "modifier" : "modifier",
        "associatedStagesCount" : 0,
        "dayQuotaRequest" : 6,
        "permission" : "permission",
        "rateRps" : 5,
        "usagePlanName" : "usagePlanName",
        "monthQuotaRequest" : 1,
        "tenantId" : "tenantId",
        "disabled" : true,
        "usagePlanDescription" : "usagePlanDescription",
        "quotaCondition" : "quotaCondition",
        "actionName" : "actionName"
    }
}

レスポンスステータスコード

API Gatewayで共通して使用されるレスポンスステータスコードの詳細は、API Gatewayのレスポンスステータスコードをご参照ください。

レスポンス例

レスポンスのサンプルコードは次の通りです。

{
    "usagePlan": {
        "tenantId": "***e230cebc1402ba89b148896951***",
        "usagePlanId": "***wthl***",
        "rateRps": 2,
        "usagePlanName": "usageplan000",
        "usagePlanDescription": "usage plan",
        "dayQuotaRequest": 5,
        "quotaCondition" : "2xx",
        "monthQuotaRequest": 10,
        "domainCode": "PUB",
        "associatedStagesCount": 0
    }
}