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
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.
The name of the metadata schema.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
JSON schema defining the type.
The name of Azure API Center service.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
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
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.
The name of the metadata schema.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of Azure API Center service.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
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
An entity the metadata schema is requested for.
Name of the file where to export the metadata schema to.
Optional Parameters
Export only custom metadata.
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.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of the API Center service.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
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
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of Azure API Center service.
Optional Parameters
OData filter parameter.
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.
Token to specify where to start paginating. This is the token value from a previously truncated response.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
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
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.
The name of the metadata schema.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
The name of Azure API Center service.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
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 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>
.
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.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
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.
The name of the metadata schema.
Remove a property or an element from a list. Example: --remove property.list <indexToRemove>
OR --remove propertyToRemove
.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
YAML schema defining the type.
The name of Azure API Center service.
Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Global Parameters
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Azure CLI