Share via


Content Type - Create Or Update

開発者ポータルのコンテンツ タイプを作成または更新します。 コンテンツ タイプは、コンテンツ アイテムのプロパティ、検証ルール、制約を記述します。 カスタム コンテンツ タイプの識別子はプレフィックスで c- 始まる必要があります。 組み込みのコンテンツ タイプは変更できません。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}?api-version=2022-08-01

URI パラメーター

名前 / 必須 説明
contentTypeId
path True

string

コンテンツ タイプ識別子。

resourceGroupName
path True

string

リソース グループの名前。 名前の大文字と小文字は区別されます。

serviceName
path True

string

API Management サービスの名前。

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

ターゲット サブスクリプションの ID。

api-version
query True

string

この操作に使用する API バージョン。

要求ヘッダー

名前 必須 説明
If-Match

string

エンティティの ETag。 エンティティを作成する場合は必須ではありませんが、エンティティを更新する場合は必須です。

要求本文

名前 説明
properties.description

string

コンテンツ タイプの説明。

properties.id

string

コンテンツ タイプ識別子

properties.name

string

コンテンツ タイプ名。 長さは 1 ~ 250 文字にする必要があります。

properties.schema

object

コンテンツ タイプ スキーマ。

properties.version

string

コンテンツ タイプのバージョン。

応答

名前 説明
200 OK

ContentTypeContract

既存のコンテンツ タイプが正常に更新されました。

Headers

ETag: string

201 Created

ContentTypeContract

コンテンツ タイプが正常に作成されました。

Headers

ETag: string

Other Status Codes

ErrorResponse

操作に失敗した理由を説明するエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名前 説明
user_impersonation ユーザー アカウントの借用

ApiManagementCreateContentType

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/contentTypes/page?api-version=2022-08-01

{
  "properties": {
    "name": "Page",
    "description": "A regular page",
    "schema": {
      "properties": {
        "en_us": {
          "type": "object",
          "properties": {
            "title": {
              "title": "Title",
              "description": "Page title. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "description": {
              "title": "Description",
              "description": "Page description. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "keywords": {
              "title": "Keywords",
              "description": "Page keywords. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "permalink": {
              "title": "Permalink",
              "description": "Page permalink, e.g. '/about'.",
              "type": "string",
              "indexed": true
            },
            "documentId": {
              "title": "Document ID",
              "description": "Reference to page content document.",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "title",
            "permalink",
            "documentId"
          ]
        }
      },
      "additionalProperties": false
    },
    "version": "1.0.0"
  }
}

Sample Response

{
  "id": "/contentTypes/page",
  "type": "Microsoft.ApiManagement/service/contentTypes",
  "name": "page",
  "properties": {
    "name": "Page",
    "description": "A regular page",
    "schema": {
      "properties": {
        "en_us": {
          "type": "object",
          "properties": {
            "title": {
              "title": "Title",
              "description": "Page title. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "description": {
              "title": "Description",
              "description": "Page description. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "keywords": {
              "title": "Keywords",
              "description": "Page keywords. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "permalink": {
              "title": "Permalink",
              "description": "Page permalink, e.g. '/about'.",
              "type": "string",
              "indexed": true
            },
            "documentId": {
              "title": "Document ID",
              "description": "Reference to page content document.",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "title",
            "permalink",
            "documentId"
          ]
        }
      },
      "additionalProperties": false
    },
    "version": "1.0.0"
  }
}
{
  "id": "/contentTypes/page",
  "type": "Microsoft.ApiManagement/service/contentTypes",
  "name": "page",
  "properties": {
    "name": "Page",
    "description": "A regular page",
    "schema": {
      "properties": {
        "en_us": {
          "type": "object",
          "properties": {
            "title": {
              "title": "Title",
              "description": "Page title. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "description": {
              "title": "Description",
              "description": "Page description. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "keywords": {
              "title": "Keywords",
              "description": "Page keywords. This property gets included in SEO attributes.",
              "type": "string",
              "indexed": true
            },
            "permalink": {
              "title": "Permalink",
              "description": "Page permalink, e.g. '/about'.",
              "type": "string",
              "indexed": true
            },
            "documentId": {
              "title": "Document ID",
              "description": "Reference to page content document.",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "title",
            "permalink",
            "documentId"
          ]
        }
      },
      "additionalProperties": false
    },
    "version": "1.0.0"
  }
}

定義

名前 説明
ContentTypeContract

コンテンツ タイプコントラクトの詳細。

ErrorFieldContract

エラー フィールド コントラクト。

ErrorResponse

エラー応答。

ContentTypeContract

コンテンツ タイプコントラクトの詳細。

名前 説明
id

string

リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

リソースの名前

properties.description

string

コンテンツ タイプの説明。

properties.id

string

コンテンツ タイプ識別子

properties.name

string

コンテンツ タイプ名。 長さは 1 ~ 250 文字にする必要があります。

properties.schema

object

コンテンツ タイプ スキーマ。

properties.version

string

コンテンツ タイプのバージョン。

type

string

リソースの型。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"

ErrorFieldContract

エラー フィールド コントラクト。

名前 説明
code

string

プロパティ レベルのエラー コード。

message

string

プロパティ レベルエラーの人間が判読できる表現。

target

string

プロパティ名。

ErrorResponse

エラー応答。

名前 説明
error.code

string

サービスによって定義されたエラー コード。 このコードは、応答に指定された HTTP エラー コードのサブステータスとして機能します。

error.details

ErrorFieldContract[]

検証エラーが発生した場合に要求で送信される無効なフィールドの一覧。

error.message

string

人が判読できるエラーの表現。