|
1 | 1 | ---
|
2 | 2 | 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. |
4 | 4 | author: davidsmatlak
|
5 |
| - |
6 |
| -ms.topic: conceptual |
7 |
| -ms.date: 07/14/2020 |
8 | 5 | ms.author: davidsmatlak
|
9 |
| - |
| 6 | +ms.topic: conceptual |
| 7 | +ms.date: 08/23/2022 |
10 | 8 | ---
|
11 | 9 |
|
12 | 10 | # Microsoft.Solutions.ArmApiControl UI element
|
13 | 11 |
|
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. |
15 | 13 |
|
16 | 14 | ## UI sample
|
17 | 15 |
|
18 |
| -There's no UI for this control. |
| 16 | +There's no UI for `ArmApiControl`. |
19 | 17 |
|
20 | 18 | ## Schema
|
21 | 19 |
|
22 |
| -The following example shows the schema for this control: |
| 20 | +The following example shows the control's schema. |
23 | 21 |
|
24 | 22 | ```json
|
25 | 23 | {
|
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" |
35 | 32 | }
|
| 33 | + } |
36 | 34 | }
|
37 | 35 | ```
|
38 | 36 |
|
39 | 37 | ## Sample output
|
40 | 38 |
|
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. |
42 | 40 |
|
43 | 41 | ## Remarks
|
44 | 42 |
|
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. |
47 | 45 |
|
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. |
49 | 47 |
|
50 | 48 | ```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" |
52 | 50 | ```
|
53 | 51 |
|
54 | 52 | - 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.
|
55 | 53 |
|
56 | 54 | ## Example
|
57 | 55 |
|
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. |
59 | 59 |
|
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. |
61 | 61 |
|
62 | 62 | ```json
|
63 | 63 | {
|
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')]" |
69 | 92 | }
|
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 | + } |
81 | 94 | }
|
82 | 95 | ```
|
83 | 96 |
|
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. |
85 | 98 |
|
86 | 99 | ## Next steps
|
87 | 100 |
|
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). |
89 | 102 | - 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