Global Schema - Create Or Update
Tworzy nowy lub aktualizuje istniejący określony schemat wystąpienia usługi API Management.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}?api-version=2022-08-01
Parametry identyfikatora URI
Nazwa | W | Wymagane | Typ | Opis |
---|---|---|---|---|
resource
|
path | True |
string |
Nazwa grupy zasobów. W nazwie jest uwzględniana wielkość liter. |
schema
|
path | True |
string |
Identyfikator identyfikatora schematu. Musi być unikatowa w bieżącym wystąpieniu usługi API Management. |
service
|
path | True |
string |
Nazwa usługi API Management. Regex pattern: |
subscription
|
path | True |
string |
Identyfikator subskrypcji docelowej. |
api-version
|
query | True |
string |
Wersja interfejsu API do użycia dla tej operacji. |
Nagłówek żądania
Nazwa | Wymagane | Typ | Opis |
---|---|---|---|
If-Match |
string |
ETag jednostki. Nie jest wymagane podczas tworzenia jednostki, ale wymagane podczas aktualizowania jednostki. |
Treść żądania
Nazwa | Wymagane | Typ | Opis |
---|---|---|---|
properties.schemaType | True |
Typ schematu. Niezmienne. |
|
properties.description |
string |
Opis jednostki schematu w formie bezpłatnej. |
|
properties.value |
Ciąg zakodowany w formacie Json dla schematu opartego na formacie json. |
Odpowiedzi
Nazwa | Typ | Opis |
---|---|---|
200 OK |
Szczegóły schematu zostały pomyślnie zaktualizowane. Headers ETag: string |
|
201 Created |
Nowy schemat został pomyślnie dodany. Headers ETag: string |
|
202 Accepted |
Zaakceptowano zmianę podczas aktualizowania usługi. |
|
Other Status Codes |
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się. |
Zabezpieczenia
azure_auth
Przepływ OAuth2 usługi Azure Active Directory.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nazwa | Opis |
---|---|
user_impersonation | personifikacja konta użytkownika |
Przykłady
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
}
}
}
}
}
Definicje
Nazwa | Opis |
---|---|
Error |
Błąd Kontrakt pola. |
Error |
Odpowiedź na błąd. |
Global |
Szczegóły kontraktu schematu globalnego. |
Schema |
Typ schematu. Niezmienne. |
ErrorFieldContract
Błąd Kontrakt pola.
Nazwa | Typ | Opis |
---|---|---|
code |
string |
Kod błędu poziomu właściwości. |
message |
string |
Czytelna dla człowieka reprezentacja błędu na poziomie właściwości. |
target |
string |
Nazwa właściwości. |
ErrorResponse
Odpowiedź na błąd.
Nazwa | Typ | Opis |
---|---|---|
error.code |
string |
Kod błędu zdefiniowany przez usługę. Ten kod służy jako podstan kodu błędu HTTP określonego w odpowiedzi. |
error.details |
Lista nieprawidłowych pól wysyłanych w żądaniu w przypadku błędu walidacji. |
|
error.message |
string |
Czytelna dla człowieka reprezentacja błędu. |
GlobalSchemaContract
Szczegóły kontraktu schematu globalnego.
Nazwa | Typ | Opis |
---|---|---|
id |
string |
W pełni kwalifikowany identyfikator zasobu dla zasobu. Ex — /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
name |
string |
Nazwa zasobu |
properties.description |
string |
Opis jednostki schematu w formie bezpłatnej. |
properties.schemaType |
Typ schematu. Niezmienne. |
|
properties.value |
Ciąg zakodowany w formacie Json dla schematu opartego na formacie json. |
|
type |
string |
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts" |
SchemaType
Typ schematu. Niezmienne.
Nazwa | Typ | Opis |
---|---|---|
json |
string |
Typ schematu Json. |
xml |
string |
Typ schematu XML. |