Skip to content

Commit 3f2ce0d

Browse files
Merge pull request #208899 from davidsmatlak/ds-ghi-97102
Updates ArmApiControl UI element
2 parents c3df95c + 09f5d30 commit 3f2ce0d

File tree

1 file changed

+56
-42
lines changed

1 file changed

+56
-42
lines changed
Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,103 @@
11
---
22
title: ArmApiControl UI element
3-
description: Describes the Microsoft.Solutions.ArmApiControl UI element for Azure portal. Used for calling API operations.
3+
description: Describes the Microsoft.Solutions.ArmApiControl UI element for Azure portal that's used to call API operations.
44
author: davidsmatlak
5-
6-
ms.topic: conceptual
7-
ms.date: 07/14/2020
85
ms.author: davidsmatlak
9-
6+
ms.topic: conceptual
7+
ms.date: 08/23/2022
108
---
119

1210
# Microsoft.Solutions.ArmApiControl UI element
1311

14-
ArmApiControl lets you get results from an Azure Resource Manager API operation. Use the results to populate dynamic content in other controls.
12+
The `ArmApiControl` gets results from an Azure Resource Manager API operation using GET or POST. You can use the results to populate dynamic content in other controls.
1513

1614
## UI sample
1715

18-
There's no UI for this control.
16+
There's no UI for `ArmApiControl`.
1917

2018
## Schema
2119

22-
The following example shows the schema for this control:
20+
The following example shows the control's schema.
2321

2422
```json
2523
{
26-
"name": "testApi",
27-
"type": "Microsoft.Solutions.ArmApiControl",
28-
"request": {
29-
"method": "{HTTP-method}",
30-
"path": "{path-for-the-URL}",
31-
    "body": {
32-
      "key1": "val1",
33-
      "key2": "val2"
34-
}
24+
"name": "testApi",
25+
"type": "Microsoft.Solutions.ArmApiControl",
26+
"request": {
27+
"method": "{HTTP-method}",
28+
"path": "{path-for-the-URL}",
29+
"body": {
30+
"key1": "value1",
31+
"key2": "value2"
3532
}
33+
}
3634
}
3735
```
3836

3937
## Sample output
4038

41-
The control's output is not displayed to the user. Instead, the result of the operation is used in other controls.
39+
The control's output isn't displayed to the user. Instead, the operation's results are used in other controls.
4240

4341
## Remarks
4442

45-
- The `request.method` property specifies the HTTP method. Only `GET` or `POST` are allowed.
46-
- The `request.path` property specifies a URL that must be a relative path to an ARM endpoint. It can be a static path or can be constructed dynamically by referring output values of the other controls.
43+
- The `request.method` property specifies the HTTP method. Only GET or POST are allowed.
44+
- The `request.path` property specifies a URL that must be a relative path to an Azure Resource Manager endpoint. It can be a static path or can be constructed dynamically by referring output values of the other controls.
4745

48-
For example, an ARM call into `Microsoft.Network/expressRouteCircuits` resource provider:
46+
For example, an Azure Resource Manager call into the `Microsoft.Network/expressRouteCircuits` resource provider.
4947

5048
```json
51-
"path": "subscriptions/<subid>/resourceGroup/<resourceGroupName>/providers/Microsoft.Network/expressRouteCircuits/<routecircuitName>/?api-version=2020-05-01"
49+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}?api-version=2022-01-01"
5250
```
5351

5452
- The `request.body` property is optional. Use it to specify a JSON body that is sent with the request. The body can be static content or constructed dynamically by referring to output values from other controls.
5553

5654
## Example
5755

58-
In the following example, the `providersApi` element calls an API to get an array of provider objects.
56+
In the following example, the `providersApi` element uses the `ArmApiControl` and calls an API to get an array of provider objects.
57+
58+
The `providersDropDown` element's `allowedValues` property is configured to use the array and get the provider names. The provider names are displayed in the dropdown list.
5959

60-
The `allowedValues` property of the `providersDropDown` element is configured to get the names of the providers. It displays them in the dropdown list.
60+
The `output` property `providerName` shows the provider name that was selected from the dropdown list. The output can be used to pass the value to a parameter in an Azure Resource Manager template.
6161

6262
```json
6363
{
64-
"name": "providersApi",
65-
"type": "Microsoft.Solutions.ArmApiControl",
66-
"request": {
67-
"method": "GET",
68-
"path": "[concat(subscription().id, '/providers/Microsoft.Network/expressRouteServiceProviders?api-version=2019-02-01')]"
64+
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
65+
"handler": "Microsoft.Azure.CreateUIDef",
66+
"version": "0.1.2-preview",
67+
"parameters": {
68+
"basics": [
69+
{
70+
"name": "providersApi",
71+
"type": "Microsoft.Solutions.ArmApiControl",
72+
"request": {
73+
"method": "GET",
74+
"path": "[concat(subscription().id, '/providers/Microsoft.Network/expressRouteServiceProviders?api-version=2022-01-01')]"
75+
}
76+
},
77+
{
78+
"name": "providerDropDown",
79+
"type": "Microsoft.Common.DropDown",
80+
"label": "Provider",
81+
"toolTip": "The provider that offers the express route connection.",
82+
"constraints": {
83+
"allowedValues": "[map(basics('providersApi').value, (item) => parse(concat('{\"label\":\"', item.name, '\",\"value\":\"', item.name, '\"}')))]",
84+
"required": true
85+
},
86+
"visible": true
87+
}
88+
],
89+
"steps": [],
90+
"outputs": {
91+
"providerName": "[basics('providerDropDown')]"
6992
}
70-
},
71-
{
72-
"name": "providerDropDown",
73-
"type": "Microsoft.Common.DropDown",
74-
"label": "Provider",
75-
"toolTip": "The provider that offers the express route connection.",
76-
"constraints": {
77-
"allowedValues": "[map(steps('settings').providersApi.value, (item) => parse(concat('{\"label\":\"', item.name, '\",\"value\":\"', item.name, '\"}')))]",
78-
"required": true
79-
},
80-
"visible": true
93+
}
8194
}
8295
```
8396

84-
For an example of using the ArmApiControl to check the availability of a resource name, see [Microsoft.Common.TextBox](microsoft-common-textbox.md).
97+
For an example of the `ArmApiControl` that uses the `request.body` property, see the [Microsoft.Common.TextBox](microsoft-common-textbox.md#single-line) single-line example. That example checks the availability of a storage account name and returns a message if the name is unavailable.
8598

8699
## Next steps
87100

88-
- For an introduction to creating UI definitions, see [Getting started with CreateUiDefinition](create-uidefinition-overview.md).
101+
- For an introduction to creating UI definitions, see [CreateUiDefinition.json for Azure managed application's create experience](create-uidefinition-overview.md).
89102
- For a description of common properties in UI elements, see [CreateUiDefinition elements](create-uidefinition-elements.md).
103+
- To learn more about functions like `map`, `basics`, and `parse`, see [CreateUiDefinition functions](create-uidefinition-functions.md).

0 commit comments

Comments
 (0)