Update DropDowns
The EasyLife 365 Collaboration API facilitates the direct updating of dropdown field options. This feature enables the dynamic modification of dropdown field options based on external data sources. For instance, when new departments are added to the Human Resources system, the list of departments on EasyLife 365 Collaboration can be automatically updated.
Permissions
Permission Type | Permissions (Scope) |
---|---|
Delegated (work or school account) | https://api.easylife365.cloud/admin/Config.ReadWrite.All |
Application | Not supported. |
HTTP Request
POST https://api.easylife365.cloud/admin/v1/fields/select/{field-name}/
Content-Type: application/json
HTTP Request Headers
Header | Value |
---|---|
Authorization | Bearer token. (Required) |
Content-Type | application/json |
Request Body
Property | Type | Description |
---|---|---|
defaultValue | String | Default value of the dropdown. (Optional) |
options | Object | List of key/value pairs representing dropdown options. The key is the option key, and the value is the displayed option value. (Required) |
translations | Object | List of translated values in different languages. Supported languages are "de", "it", "fr", "es", "pl", "tr", "nl". (Optional) |
Response
This endpoint does not provide a response.
Example 1: Update Dropdown Field
This example updates the dropdown field "el-check-428" with the default value "key1" and includes the translation in German.
POST https://api.easylife365.cloud/admin/v1/fields/select/{field-name}/
Content-Type: application/json
{
"defaultValue": "key1",
"options": {
"key1": "value1",
"key2": "value2"
},
"translations": {
"de": [
"value1de",
"value2de"
]
}
}
Example 2: Update Dropdown Field using PowerShell
The following example demonstrates updating a field using PowerShell. Before executing the script, ensure you've registered an application and obtained the TenantId and ClientId. Also, retrieve the correct scope from this document.
Import-Module MSAL.PS
$msalParam = @{
tenantId = "[TENANT_ID]"
clientId = "[CLIENT_ID]"
scopes = "[SCOPE]"
}
$uri = "[URI]"
# Get JWT authentication token.
if($token){
$token = Get-MsalToken @msalParam -Silent
} else {
$token = Get-MsalToken @msalParam -DeviceCode
}
# Create object with values to pass to the API.
$body = @{
defaultValue = "key1"
options = @{
key1 = "value1"
key2 = "value2"
}
translations = @{
de = @(
"value1de",
"value2de"
)
}
}
# Invoke the API and capture responses.
$jsonBody = $body | ConvertTo-Json -Depth 5 -Compress
$encodedBody = [System.Text.Encoding]::UTF8.GetBytes($jsonBody)
$headers = @{
"Authorization"= "Bearer $($token.AccessToken)"
"Content-Type" = "application/json"
}
Write-Information "Updating field with: $jsonBody" -InformationAction Continue
Invoke-RestMethod -Method PATCH -Uri $uri -Headers $headers -Body $encodedBody