Global Schema - Create Or Update
Crée ou met à jour le schéma spécifié existant du instance de service Gestion des API.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}?api-version=2021-08-01
Paramètres URI
Nom | Dans | Obligatoire | Type | Description |
---|---|---|---|---|
resource
|
path | True |
string |
Nom du groupe de ressources. |
schema
|
path | True |
string |
Identificateur d’ID de schéma. Doit être unique dans le instance de service Gestion des API actuel. |
service
|
path | True |
string |
Nom du service Gestion des API. Modèle d’expression régulière: |
subscription
|
path | True |
string |
Informations d’identification d’abonnement qui identifient de manière unique l’abonnement Microsoft Azure. L’ID d’abonnement fait partie de l’URI pour chaque appel de service. |
api-version
|
query | True |
string |
Version de l’API à utiliser avec la demande du client. |
En-tête de la demande
Nom | Obligatoire | Type | Description |
---|---|---|---|
If-Match |
string |
ETag de l’entité. Non obligatoire lors de la création d’une entité, mais obligatoire lors de la mise à jour d’une entité. |
Corps de la demande
Nom | Obligatoire | Type | Description |
---|---|---|---|
properties.schemaType | True |
Type de schéma. Non modifiable. |
|
properties.description |
string |
Description de l’entité de schéma de forme libre. |
|
properties.value |
Chaîne encodée au format Json pour un schéma non basé sur json. |
Réponses
Nom | Type | Description |
---|---|---|
200 OK |
Les détails du schéma ont été correctement mis à jour. En-têtes ETag: string |
|
201 Created |
Le nouveau schéma a été ajouté avec succès. En-têtes ETag: string |
|
202 Accepted |
Accepté la modification lors de la mise à jour du service. |
|
Other Status Codes |
Réponse d’erreur décrivant la raison de l’échec de l’opération. |
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory.
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom | Description |
---|---|
user_impersonation | Emprunter l’identité de votre compte d’utilisateur |
Exemples
Api |
Api |
ApiManagementCreateSchema1
Exemple de requête
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>"
}
}
Exemple de réponse
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
Exemple de requête
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
}
}
}
}
}
Exemple de réponse
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
}
}
}
}
}
Définitions
Nom | Description |
---|---|
Error |
Contrat de champ d’erreur. |
Error |
Réponse d’erreur. |
Global |
Détails du contrat de schéma global. |
Schema |
Type de schéma. Non modifiable. |
ErrorFieldContract
Contrat de champ d’erreur.
Nom | Type | Description |
---|---|---|
code |
string |
Code d'erreur de niveau propriété. |
message |
string |
Représentation lisible par l’homme de l’erreur au niveau des propriétés. |
target |
string |
Nom de propriété. |
ErrorResponse
Réponse d’erreur.
Nom | Type | Description |
---|---|---|
error.code |
string |
Code d'erreur défini par le service. Ce code sert de sous-état pour le code d'erreur HTTP spécifié dans la réponse. |
error.details |
Liste des champs non valides envoyés dans la demande, en cas d’erreur de validation. |
|
error.message |
string |
Représentation contrôlable de visu de l’erreur. |
GlobalSchemaContract
Détails du contrat de schéma global.
Nom | Type | Description |
---|---|---|
id |
string |
ID de ressource complet pour la ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
nom de la ressource. |
properties.description |
string |
Description de l’entité de schéma de forme libre. |
properties.schemaType |
Type de schéma. Non modifiable. |
|
properties.value |
Chaîne encodée au format Json pour un schéma non basé sur json. |
|
type |
string |
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts » |
SchemaType
Type de schéma. Non modifiable.
Nom | Type | Description |
---|---|---|
json |
string |
Type de schéma Json. |
xml |
string |
Type de schéma Xml. |