Global Schema - Create Or Update
API Management サービス インスタンスの新しいスキーマを作成するか、既存の指定したスキーマを更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}?api-version=2021-08-01
URI パラメーター
名前 | / | 必須 | 型 | 説明 |
---|---|---|---|---|
resource
|
path | True |
string |
リソース グループの名前。 |
schema
|
path | True |
string |
スキーマ ID 識別子。 現在のAPI Management サービス インスタンスで一意である必要があります。 |
service
|
path | True |
string |
API Management サービスの名前。 正規表現パターン: |
subscription
|
path | True |
string |
Microsoft Azure サブスクリプションを一意に識別するサブスクリプション資格情報。 サブスクリプション ID は、全ての修理依頼についてURI の一部を生じさせます。 |
api-version
|
query | True |
string |
クライアント要求で使用される API のバージョン。 |
要求ヘッダー
名前 | 必須 | 型 | 説明 |
---|---|---|---|
If-Match |
string |
エンティティの ETag。 エンティティを作成する場合は必須ではありませんが、エンティティを更新する場合は必須です。 |
要求本文
名前 | 必須 | 型 | 説明 |
---|---|---|---|
properties.schemaType | True |
スキーマの種類。 変更不可。 |
|
properties.description |
string |
自由形式のスキーマ エンティティの説明。 |
|
properties.value |
JSON ベース以外のスキーマの Json エンコード文字列。 |
応答
名前 | 型 | 説明 |
---|---|---|
200 OK |
スキーマの詳細が正常に更新されました。 ヘッダー ETag: string |
|
201 Created |
新しいスキーマが正常に追加されました。 ヘッダー ETag: string |
|
202 Accepted |
サービスの更新時に変更を受け入れた。 |
|
Other Status Codes |
操作に失敗した理由を説明するエラー応答。 |
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
名前 | 説明 |
---|---|
user_impersonation | ユーザー アカウントの借用 |
例
Api |
Api |
ApiManagementCreateSchema1
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2021-08-01
{
"properties": {
"description": "sample schema description",
"schemaType": "xml",
"value": "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n xmlns:tns=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n targetNamespace=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n elementFormDefault=\"qualified\">\r\n <xsd:element name=\"PurchaseOrder\" type=\"tns:PurchaseOrderType\"/>\r\n <xsd:complexType name=\"PurchaseOrderType\">\r\n <xsd:sequence>\r\n <xsd:element name=\"ShipTo\" type=\"tns:USAddress\" maxOccurs=\"2\"/>\r\n <xsd:element name=\"BillTo\" type=\"tns:USAddress\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"OrderDate\" type=\"xsd:date\"/>\r\n </xsd:complexType>\r\n\r\n <xsd:complexType name=\"USAddress\">\r\n <xsd:sequence>\r\n <xsd:element name=\"name\" type=\"xsd:string\"/>\r\n <xsd:element name=\"street\" type=\"xsd:string\"/>\r\n <xsd:element name=\"city\" type=\"xsd:string\"/>\r\n <xsd:element name=\"state\" type=\"xsd:string\"/>\r\n <xsd:element name=\"zip\" type=\"xsd:integer\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"country\" type=\"xsd:NMTOKEN\" fixed=\"US\"/>\r\n </xsd:complexType>\r\n</xsd:schema>"
}
}
応答のサンプル
location: https://management.azure.com/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2021-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1",
"type": "Microsoft.ApiManagement/service/schemas",
"name": "schema1",
"properties": {
"description": "sample schema description",
"schemaType": "xml",
"value": "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n xmlns:tns=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n targetNamespace=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n elementFormDefault=\"qualified\">\r\n <xsd:element name=\"PurchaseOrder\" type=\"tns:PurchaseOrderType\"/>\r\n <xsd:complexType name=\"PurchaseOrderType\">\r\n <xsd:sequence>\r\n <xsd:element name=\"ShipTo\" type=\"tns:USAddress\" maxOccurs=\"2\"/>\r\n <xsd:element name=\"BillTo\" type=\"tns:USAddress\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"OrderDate\" type=\"xsd:date\"/>\r\n </xsd:complexType>\r\n\r\n <xsd:complexType name=\"USAddress\">\r\n <xsd:sequence>\r\n <xsd:element name=\"name\" type=\"xsd:string\"/>\r\n <xsd:element name=\"street\" type=\"xsd:string\"/>\r\n <xsd:element name=\"city\" type=\"xsd:string\"/>\r\n <xsd:element name=\"state\" type=\"xsd:string\"/>\r\n <xsd:element name=\"zip\" type=\"xsd:integer\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"country\" type=\"xsd:NMTOKEN\" fixed=\"US\"/>\r\n </xsd:complexType>\r\n</xsd:schema>"
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1",
"type": "Microsoft.ApiManagement/service/schemas",
"name": "schema1",
"properties": {
"description": "sample schema description",
"schemaType": "xml",
"value": "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n xmlns:tns=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n targetNamespace=\"http://tempuri.org/PurchaseOrderSchema.xsd\"\r\n elementFormDefault=\"qualified\">\r\n <xsd:element name=\"PurchaseOrder\" type=\"tns:PurchaseOrderType\"/>\r\n <xsd:complexType name=\"PurchaseOrderType\">\r\n <xsd:sequence>\r\n <xsd:element name=\"ShipTo\" type=\"tns:USAddress\" maxOccurs=\"2\"/>\r\n <xsd:element name=\"BillTo\" type=\"tns:USAddress\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"OrderDate\" type=\"xsd:date\"/>\r\n </xsd:complexType>\r\n\r\n <xsd:complexType name=\"USAddress\">\r\n <xsd:sequence>\r\n <xsd:element name=\"name\" type=\"xsd:string\"/>\r\n <xsd:element name=\"street\" type=\"xsd:string\"/>\r\n <xsd:element name=\"city\" type=\"xsd:string\"/>\r\n <xsd:element name=\"state\" type=\"xsd:string\"/>\r\n <xsd:element name=\"zip\" type=\"xsd:integer\"/>\r\n </xsd:sequence>\r\n <xsd:attribute name=\"country\" type=\"xsd:NMTOKEN\" fixed=\"US\"/>\r\n </xsd:complexType>\r\n</xsd:schema>"
}
}
ApiManagementCreateSchema2
要求のサンプル
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2021-08-01
{
"properties": {
"description": "sample schema description",
"schemaType": "json",
"document": {
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
}
}
応答のサンプル
location: https://management.azure.com/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2021-08-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1",
"type": "Microsoft.ApiManagement/service/schemas",
"name": "schema1",
"properties": {
"description": "sample schema description",
"schemaType": "json",
"document": {
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1",
"type": "Microsoft.ApiManagement/service/schemas",
"name": "schema1",
"properties": {
"description": "sample schema description",
"schemaType": "json",
"document": {
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
}
}
定義
名前 | 説明 |
---|---|
Error |
エラー フィールド コントラクト。 |
Error |
エラー応答。 |
Global |
グローバル スキーマ コントラクトの詳細。 |
Schema |
スキーマの種類。 変更不可。 |
ErrorFieldContract
エラー フィールド コントラクト。
名前 | 型 | 説明 |
---|---|---|
code |
string |
プロパティ レベルのエラー コード。 |
message |
string |
プロパティ レベルエラーの人間が判読できる表現。 |
target |
string |
プロパティ名。 |
ErrorResponse
エラー応答。
名前 | 型 | 説明 |
---|---|---|
error.code |
string |
サービスによって定義されたエラー コード。 このコードは、応答に指定された HTTP エラー コードのサブステータスとして機能します。 |
error.details |
検証エラーが発生した場合に要求で送信される無効なフィールドの一覧。 |
|
error.message |
string |
人が判読できるエラーの表現。 |
GlobalSchemaContract
グローバル スキーマ コントラクトの詳細。
名前 | 型 | 説明 |
---|---|---|
id |
string |
リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
リソースの名前 |
properties.description |
string |
自由形式のスキーマ エンティティの説明。 |
properties.schemaType |
スキーマの種類。 変更不可。 |
|
properties.value |
JSON ベース以外のスキーマの Json エンコード文字列。 |
|
type |
string |
リソースの型。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts" |
SchemaType
スキーマの種類。 変更不可。
名前 | 型 | 説明 |
---|---|---|
json |
string |
Json スキーマの種類。 |
xml |
string |
Xml スキーマの種類。 |