Global Schema - Create Or Update
Crea una nueva o actualiza el esquema especificado existente de la instancia de servicio API Management.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}?api-version=2022-08-01
Parámetros de identificador URI
Nombre | En | Requerido | Tipo | Description |
---|---|---|---|---|
resource
|
path | True |
string |
Nombre del grupo de recursos. El nombre distingue mayúsculas de minúsculas. |
schema
|
path | True |
string |
Identificador de identificador de esquema. Debe ser único en la instancia de servicio API Management actual. |
service
|
path | True |
string |
Nombre del servicio API Management. Regex pattern: |
subscription
|
path | True |
string |
Identificador de la suscripción de destino. |
api-version
|
query | True |
string |
Versión de API que se usará para la operación. |
Encabezado de la solicitud
Nombre | Requerido | Tipo | Description |
---|---|---|---|
If-Match |
string |
ETag de la entidad. No es necesario al crear una entidad, pero es necesario al actualizar una entidad. |
Cuerpo de la solicitud
Nombre | Requerido | Tipo | Description |
---|---|---|---|
properties.schemaType | True |
Tipo de esquema. El valor es inmutable. |
|
properties.description |
string |
Descripción de la entidad de esquema de forma libre. |
|
properties.value |
Cadena codificada en Json para el esquema no basado en json. |
Respuestas
Nombre | Tipo | Description |
---|---|---|
200 OK |
Los detalles del esquema se actualizaron correctamente. Headers ETag: string |
|
201 Created |
El nuevo esquema se agregó correctamente. Headers ETag: string |
|
202 Accepted |
Aceptó el cambio al actualizar el servicio. |
|
Other Status Codes |
Respuesta de error que describe el motivo del error de la operación. |
Seguridad
azure_auth
Flujo de OAuth2 de Azure Active Directory.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nombre | Description |
---|---|
user_impersonation | suplantación de su cuenta de usuario |
Ejemplos
Api |
Api |
ApiManagementCreateSchema1
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2022-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>"
}
}
Sample Response
location: https://management.azure.com/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2022-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
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2022-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
}
}
}
}
}
Sample Response
location: https://management.azure.com/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/schemas/schema1?api-version=2022-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
}
}
}
}
}
Definiciones
Nombre | Description |
---|---|
Error |
Contrato de campo de error. |
Error |
Respuesta de error. |
Global |
Detalles del contrato de esquema global. |
Schema |
Tipo de esquema. El valor es inmutable. |
ErrorFieldContract
Contrato de campo de error.
Nombre | Tipo | Description |
---|---|---|
code |
string |
Código de error de nivel de propiedad. |
message |
string |
Representación legible del error de nivel de propiedad. |
target |
string |
Nombre de propiedad. |
ErrorResponse
Respuesta de error.
Nombre | Tipo | Description |
---|---|---|
error.code |
string |
Código del error definido por el servicio. Este código funciona como estado secundario del código de error HTTP especificado en la respuesta. |
error.details |
La lista de campos no válidos que se envían en la solicitud, en caso de error de validación. |
|
error.message |
string |
Representación legible del error. |
GlobalSchemaContract
Detalles del contrato de esquema global.
Nombre | Tipo | Description |
---|---|---|
id |
string |
Identificador de recurso completo del recurso. Por ejemplo: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
Nombre del recurso. |
properties.description |
string |
Descripción de la entidad de esquema de forma libre. |
properties.schemaType |
Tipo de esquema. El valor es inmutable. |
|
properties.value |
Cadena codificada en Json para el esquema no basado en json. |
|
type |
string |
Tipo de recurso. Por ejemplo, "Microsoft.Compute/virtualMachines" o "Microsoft.Storage/storageAccounts" |
SchemaType
Tipo de esquema. El valor es inmutable.
Nombre | Tipo | Description |
---|---|---|
json |
string |
Tipo de esquema JSON. |
xml |
string |
Tipo de esquema XML. |