Skip to content

Commit 9e89f86

Browse files
committed
add export-definition
1 parent 34035e6 commit 9e89f86

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

articles/api-center/manage-apis-azure-cli.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Use the Azure CLI to create and update APIs, API versions, and API
44
author: dlepow
55
ms.service: api-center
66
ms.topic: how-to
7-
ms.date: 01/11/2024
7+
ms.date: 01/12/2024
88
ms.author: danlep
99
ms.custom:
1010
# Customer intent: As an API program manager, I want to automate processes to register and update APIs in my Azure API center.
@@ -48,22 +48,6 @@ By default, the command sets the API's **Lifecycle stage** to *design*.
4848
> After creating an API, you can update the API's properties by using the [az apic api update](/cli/azure/apic/api#az_apic_api_update) command.
4949
5050

51-
<!-- `kind' parameter appears to be required but isn't documented that way in command help -->
52-
53-
<!-- Need to find out how metadata works and whether custom metadata covers just the custom properties or also built-in
54-
55-
You can set more API properties using other command parameters. For example, set [metadata properties](key-concepts.md#metadata-properties) you've defined for APIs by passing values using the `--custom-properties` parameter:
56-
57-
58-
59-
```azurecli-interactive
60-
az apic api create \
61-
--resource-group myResourceGroup --service myAPICenter \
62-
--name petstore-api --title "Petstore API" --kind "rest" \
63-
--custom-properties '{"lifecycleStage":"Design","apiType":"OpenAPI"}'
64-
```
65-
-->
66-
6751
### 2. Create an API version
6852

6953
Use the [az apic api version create](/cli/azure/apic/api/version#az_apic_api_version_create) command to create a version for your API.
@@ -75,7 +59,6 @@ az apic api version create --resource-group myResourceGroup \
7559
--service myAPICenter --api-name petstore-api \
7660
--version v1-0-0 --title "v1-0-0"
7761
```
78-
<!-- title param is supposed to be optional but command fails without it -->
7962

8063
### 3. Create API definition and add specification file
8164

@@ -110,6 +93,19 @@ az apic api definition import-specification \
11093
> [!TIP]
11194
> You can import the specification file inline by setting the `--format` parameter to `inline` and passing the file contents using the `--value` parameter.
11295
96+
### Export a specification file
97+
98+
To export an API specification from your API center to a local file, use the [az apic api definition export-specification](/cli/azure/apic/api/definition#az_apic_api_definition_export_specification) command.
99+
100+
The following example exports the specification file from the *openapi* definition that you created in the previous section to a local file named *specificationFile.json*.
101+
102+
```azurecli-interactive
103+
az apic api definition export-specification \
104+
--resource-group myResourceGroup --service myAPICenter \
105+
--api-name petstore-api --version-name v1-0-0 \
106+
--definition-name openapi --file-name "/Path/to/specificationFile.json"
107+
```
108+
113109
## Register API from a specification file - single step
114110

115111
You can register an API from a local specification file in a single step by using the [az apic api register](/cli/azure/apic/api#az-apic-api-register) command. With this option, a default API version and definition are created automatically for the API.
@@ -128,7 +124,6 @@ az apic api register --resource-group myResourceGroup \
128124

129125
After registering an API, you can update the API's properties by using the [az apic api update](/cli/azure/apic/api#az_apic_api_update), [az apic api version update](/cli/azure/apic/api/version#az_apic_api_version_update), and [az apic api definition update](/cli/azure/apic/api/definition#az_apic_api_definition_update) commands.
130126

131-
132127
## Delete API resources
133128

134129
Use the [az apic api delete](/cli/azure/apic/api#az_apic_api_delete) command to delete an API and all of its version and definition resources. For example:
@@ -143,4 +138,4 @@ To delete individual API versions and definitions, use [az apic api version dele
143138

144139
## Related content
145140

146-
* See the [Azure CLI reference for API Center](/cli/azure/apic) for a complete command list and examples.
141+
See the [Azure CLI reference for API Center](/cli/azure/apic) for a complete command list, including commands to manage [environments](/cli/azure/apic/environment), [deployments](/cli/azure/apic/api/deployment), [metadata schemas](/cli/azure/apic/metadata-schema), and [API Center services](/cli/azure/apic/service).

0 commit comments

Comments
 (0)