Share via


az apic metadata

Note

This reference is part of the apic-extension extension for the Azure CLI (version 2.57.0 or higher). The extension will automatically install the first time you run an az apic metadata command. Learn more about extensions.

Commands to manage metadata schemas in API Center.

Commands

Name Description Type Status
az apic metadata create

Create a new metadata schema or update an existing metadata schema.

Extension GA
az apic metadata delete

Delete specified metadata schema.

Extension GA
az apic metadata export

Exports the metadata schema.

Extension GA
az apic metadata list

List a collection of metadata schemas.

Extension GA
az apic metadata show

Get details of the metadata schema.

Extension GA
az apic metadata update

Update existing metadata schema.

Extension GA

az apic metadata create

Create a new metadata schema or update an existing metadata schema.

az apic metadata create --assignments
                        --metadata-schema
                        --resource-group
                        --schema
                        --service
                        [--file-name]

Examples

Create metadata example 1

az apic metadata create --resource-group api-center-test --service-name contoso --name "test1" --schema '{"type":"string", "title":"First name", "pattern": "^[a-zA-Z0-9]+$"}' --assignments '[{entity:api,required:true,deprecated:false}]'

Create metadata example 2

az apic metadata create --resource-group api-center-test --service-name contoso  --name testregion --schema '{"type":"string","title":"testregion","oneOf":[{"const":"Region1","description":""},{"const":"Region2","description":""},{"const":"Region3","description":""}]}' --assignments '[{entity:api,required:true,deprecated:false},{entity:environment,required:true,deprecated:false}]'

Required Parameters

--assignments

Defines the assignment scope for the custom metadata, e.g. "[{entity:api,required:true,deprecated:false}]". The available entity values are: api, deployment, environment. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--metadata-schema --metadata-schema-name --name

The name of the metadata schema.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--schema

JSON schema defining the type.

--service --service-name -s

The name of the API Center service.

Optional Parameters

--file-name

Name of the file from that contains the metadata schema.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az apic metadata delete

Delete specified metadata schema.

az apic metadata delete [--ids]
                        [--metadata-schema]
                        [--resource-group]
                        [--service]
                        [--subscription]
                        [--yes]

Examples

Delete Metadata Schema

az apic metadata delete --resource-group api-center-test --service-name contoso --name "test1"

Delete schema

az apic metadata delete -g api-center-test -s contosoeuap --name "approver"

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--metadata-schema --metadata-schema-name --name

The name of the metadata schema.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--service --service-name -s

The name of the API Center service.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az apic metadata export

Exports the metadata schema.

az apic metadata export --assignments {api, deployment, environment}
                        --file-name
                        [--ids]
                        [--name]
                        [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                        [--resource-group]
                        [--subscription]

Examples

Export Metadata Schema assigned to api

az apic metadata export -g api-center-test -s contosoeuap --assignments api --file-name filename.json

Export Metadata Schema assigned to deployment

az apic metadata export -g api-center-test -s contosoeuap --assignments deployment --file-name filename.json

Export Metadata Schema assigned to environment

az apic metadata export -g api-center-test -s contosoeuap --assignments environment --file-name filename.json

Required Parameters

--assignments

An entity the metadata schema is requested for.

accepted values: api, deployment, environment
--file-name

Name of the file where to export the metadata schema to.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name --service --service-name -s

The name of the API Center service.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az apic metadata list

List a collection of metadata schemas.

az apic metadata list --resource-group
                      --service
                      [--filter]
                      [--max-items]
                      [--next-token]

Examples

List schemas

az apic metadata list -g api-center-test -s contosoeuap

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--service --service-name -s

The name of the API Center service.

Optional Parameters

--filter

OData filter parameter.

--max-items

Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token argument of a subsequent command.

--next-token

Token to specify where to start paginating. This is the token value from a previously truncated response.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az apic metadata show

Get details of the metadata schema.

az apic metadata show [--ids]
                      [--metadata-schema]
                      [--resource-group]
                      [--service]
                      [--subscription]

Examples

Show schema details 1

az apic metadata show -g api-center-test -s contosoeuap --name approver

Show schema details 2

az apic metadata show --resource-group api-center-test --service-name contoso --name "testchoices"

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--metadata-schema --metadata-schema-name --name

The name of the metadata schema.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--service --service-name -s

The name of the API Center service.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az apic metadata update

Update existing metadata schema.

az apic metadata update [--add]
                        [--assignments]
                        [--file-name]
                        [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                        [--ids]
                        [--metadata-schema]
                        [--remove]
                        [--resource-group]
                        [--schema]
                        [--service]
                        [--set]
                        [--subscription]

Examples

Update schema

az apic metadata update --resource-group api-center-test --service-name contoso --name "test1" --schema '{"type":"string", "title":"Last name", "pattern": "^[a-zA-Z0-9]+$"}'

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--assignments

Defines the assignment scope for the custom metadata, e.g. "[{entity:api,required:true,deprecated:false}]". The available entity values are: api, deployment, environment. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--file-name

Name of the file from that contains the metadata schema.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--metadata-schema --metadata-schema-name --name

The name of the metadata schema.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--schema

YAML schema defining the type.

--service --service-name -s

The name of the API Center service.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.