Global Schema - Create Or Update
Создает новую или обновляет существующую указанную схему экземпляра службы Управление API.
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 |
Идентификатор идентификатора схемы. Должен быть уникальным в текущем экземпляре службы Управление API. |
service
|
path | True |
string |
Имя службы Управление API. Шаблон регулярного выражения: |
subscription
|
path | True |
string |
Учетные данные подписки, которые однозначно идентифицируют подписку Microsoft Azure. Идентификатор подписки формирует часть 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
Поток OAuth2 в Azure Active Directory.
Тип:
oauth2
Flow:
implicit
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 |
Полный идентификатор ресурса. Пример : /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. |