モデルの変更

Prev Next

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

作成したボディモデルの内容を変更します。

リクエスト

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

メソッド URI
PUT /products/{product-id}/apis/{api-id}/models/{model-id}

リクエストヘッダ

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

リクエストパスパラメータ

パラメータの説明は次の通りです。

フィールド タイプ 必須の有無 説明
product-id String Required APIが属する Product ID
api-id String Required モデル内容を変更する対象の API ID
model-id String Required 対象モデルの ID

リクエスト構文

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

{
  "modelDescription" : "modelDescription",
  "modelSchema" : "modelSchema"
}

リクエストボディ

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

フィールド タイプ 必須の有無 説明
modelDescription String Optional モデルの説明
  • 0~300文字
modelSchema String Required モデルのスキーマ
  • JSON schemaを使用

リクエスト例

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

curl --location --request PUT 'https://apigateway.apigw.ntruss.com/api/v1/products/********o9/apis/cvcohvd2xj/models/tua1hd0pi4' \
--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 '{
  "modelDescription" : "test model for July update",
  "modelSchema" : "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"firstName\": {\n      \"type\": \"string\"\n    },\n    \"lastName\": {\n      \"type\": \"string\"\n    },\n    \"age\": {\n      \"description\": \"Age in years\",\n      \"type\": \"integer\",\n      \"minimum\": 3\n    }\n  },\n  \"required\": [\n    \"firstName\",\n    \"lastName\"\n  ]\n}"
}'

レスポンス

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

レスポンス構文

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

{
  "modelId" : "modelId",
  "apiId" : "apiId",
  "modelName" : "modelName",
  "modelDescription" : "modelDescription",
  "modelSchema" : "modelSchema"
}

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

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

レスポンス例

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

{
    "modelId": "tua1hd0pi4",
    "apiId": "cvcohvd2xj",
    "modelName": "testmodel",
    "modelDescription": "test model for July update",
    "modelSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"firstName\": {\n      \"type\": \"string\"\n    },\n    \"lastName\": {\n      \"type\": \"string\"\n    },\n    \"age\": {\n      \"description\": \"Age in years\",\n      \"type\": \"integer\",\n      \"minimum\": 3\n    }\n  },\n  \"required\": [\n    \"firstName\",\n    \"lastName\"\n  ]\n}"
}