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-name
                        --resource-group
                        --schema
                        --service-name

Examples

Create metadata example 1

az apic metadata create --resource-group api-center-test --service-name contoso --metadata-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  --metadata-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-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-name -n

The name of Azure API Center service.

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-name]
                        [--resource-group]
                        [--service-name]
                        [--subscription]
                        [--yes]

Examples

Delete Metadata Schema

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

Delete schema

az apic metadata delete -g api-center-test -n contosoeuap --metadata-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-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-name -n

The name of Azure 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
                        [--custom-metadata-only {0, 1, f, false, n, no, t, true, y, yes}]
                        [--ids]
                        [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                        [--resource-group]
                        [--service-name]
                        [--subscription]

Examples

Export Metadata Schema assigned to api

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

Export Metadata Schema assigned to deployment

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

Export Metadata Schema assigned to environment

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

Export Custom Metadata Schema Only

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

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

--custom-metadata-only

Export only custom metadata.

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.

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

--service-name -n

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 list

List a collection of metadata schemas.

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

Examples

List schemas

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

Required Parameters

--resource-group -g

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

--service-name -n

The name of Azure 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-name]
                      [--resource-group]
                      [--service-name]
                      [--subscription]

Examples

Show schema details 1

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

Show schema details 2

az apic metadata show --resource-group api-center-test --service-name contoso --metadata-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-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-name -n

The name of Azure 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]
                        [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                        [--ids]
                        [--metadata-name]
                        [--remove]
                        [--resource-group]
                        [--schema]
                        [--service-name]
                        [--set]
                        [--subscription]

Examples

Update schema

az apic metadata update --resource-group api-center-test --service-name contoso --metadata-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.

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

The name of the metadata schema.

--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> 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-name -n

The name of Azure API Center service.

--set

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

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