Global Schema - Create Or Update

Létrehozza a API Management szolgáltatáspéldány meglévő megadott sémáját, vagy frissíti azokat.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/schemas/{schemaId}?api-version=2022-08-01

URI-paraméterek

Name In Kötelező Típus Description
resourceGroupName
path True

string

Az erőforráscsoport neve. A név megkülönbözteti a kis- és nagybetűket.

schemaId
path True

string

Sémaazonosító azonosítója. Az aktuális API Management szolgáltatáspéldányban egyedinek kell lennie.

serviceName
path True

string

A API Management szolgáltatás neve.

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

A cél-előfizetés azonosítója.

api-version
query True

string

A művelethez használandó API-verzió.

Kérelem fejléce

Name Kötelező Típus Description
If-Match

string

Az entitás ETagje. Entitás létrehozásakor nem kötelező, de az entitások frissítésekor szükséges.

Kérelem törzse

Name Kötelező Típus Description
properties.schemaType True

SchemaType

Sématípus. Megváltoztathatatlan.

properties.description

string

A szabad formátumú séma entitásának leírása.

properties.value

Json-kódolású sztring nem json-alapú sémához.

Válaszok

Name Típus Description
200 OK

GlobalSchemaContract

A séma részletei sikeresen frissültek.

Headers

ETag: string

201 Created

GlobalSchemaContract

Az új séma hozzáadása sikerült.

Headers

ETag: string

202 Accepted

Elfogadta a módosítást a szolgáltatás frissítésekor.

Other Status Codes

ErrorResponse

Hibaválasz, amely leírja, hogy a művelet miért hiúsult meg.

Biztonság

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation felhasználói fiók megszemélyesítése

Példák

ApiManagementCreateSchema1
ApiManagementCreateSchema2

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
        }
      }
    }
  }
}

Definíciók

Name Description
ErrorFieldContract

Hibamező-szerződés.

ErrorResponse

Hibaválasz.

GlobalSchemaContract

Globális sémaszerződés részletei.

SchemaType

Sématípus. Megváltoztathatatlan.

ErrorFieldContract

Hibamező-szerződés.

Name Típus Description
code

string

Tulajdonságszintű hibakód.

message

string

A tulajdonságszintű hiba emberi olvasásra alkalmas ábrázolása.

target

string

Tulajdonság neve.

ErrorResponse

Hibaválasz.

Name Típus Description
error.code

string

Szolgáltatás által definiált hibakód. Ez a kód a válaszban megadott HTTP-hibakód alállapotaként szolgál.

error.details

ErrorFieldContract[]

Érvényesítési hiba esetén az érvénytelen mezők listája küldi el a kérést.

error.message

string

A hiba emberi olvasásra alkalmas ábrázolása.

GlobalSchemaContract

Globális sémaszerződés részletei.

Name Típus Description
id

string

Az erőforrás teljes erőforrás-azonosítója. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Az erőforrás neve

properties.description

string

A szabad formátumú séma entitásának leírása.

properties.schemaType

SchemaType

Sématípus. Megváltoztathatatlan.

properties.value

Json-kódolású sztring nem json-alapú sémához.

type

string

Az erőforrás típusa. Például "Microsoft.Compute/virtualMachines" vagy "Microsoft.Storage/storageAccounts"

SchemaType

Sématípus. Megváltoztathatatlan.

Name Típus Description
json

string

Json-séma típusa.

xml

string

XML-séma típusa.