Implementation of actions in DX API
DX API v1 supports several actions. Learn about the structure of the actions to successfully implement them in your application.
You can use the following actions through DX API:
Local action in DX API
The Local action action loads the local or local & connector flow action and presents it as a modal dialog, overlay, or in an action section. Learn about the JSON structure and elements of a sample Local action action, to understand how you can integrate it into your custom application.
The following JSON code is a sample API response for a Local action action with the Target set to Replace Current:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"localAction": "Step1",
"target": "replaceCurrent"
},
"action": "localAction"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
- The actionSets, actions, and events elements are arrays.
- DX API v1 does not support the when conditions in the action set.
- If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
The following JSON code is a sample API response for a Local action action with the Target set to Modal Dialog:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"localAction": "Step1",
"localActionFormat": "Standard",
"customTemplate": "pzModalActionAreaContainer",
"target": "modalDialog"
},
"action": "localAction"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
- The actionSets, actions, and events elements are arrays.
- DX API v1 does not support the when conditions in the action set.
- If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
The following JSON code is a sample API response for a Local action action with the Target set to Modal Dialog:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"localAction": "Step1",
"localActionFormat": "Standard",
"customTemplate": "pzModalTemplate",
"target": "overlay"
},
"action": "localAction"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
- The actionSets, actions, and events elements are arrays.
- DX API v1 does not support the when conditions in the action set.
- DX API v1 supports the out of the box Overlay formats. Configured user-defined overlay formats are also returned in the response.
- If the configured action is not included in the assignment's action list during run time, a HTTP 404 error occurs.
Refresh action in DX API
The Refresh action reloads a part of the UI when a specified event occurs (for example, when a user clicks a button). Learn about the JSON structure and elements of a sample Refresh action, to understand how you can integrate it into your custom application.
The following JSON code is a sample API response for the Refresh action with a data transform and an activity:
{
"actionSets": [
{
"actions": [
{
"action": "refresh",
"refreshFor": "cHlUZW1wbGF0ZUJ1dHRvbiNweEJ1dHRvbiMxNmNjNmYwMS01MjNhLTQ5NTMtYjFhYy04NmIzMzc5%0AMzQwZmI%3D"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
An action set that is configured to refresh a section will always return the
refreshFor
element, which refreshes the section, in the JSON
response. The refreshFor
element functions as the ID in the
following API endpoint that initiates the data transform or activity configured in
the action set:
/assignments/{assignmentID}/actions/{actionID}/refresh?refreshFor={refreshForID}
.
Run script action in DX API
The Run script action calls a custom JavaScript function when a specified event occurs (for example, when a user clicks a button). Learn about the JSON structure and elements of a sample Run script action, to understand how you can integrate it into your custom application.
The following JSON code is a sample API response for the Run script action with a hard-coded value:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"functionName": "alert",
"functionParameters": [
{
"name": "",
"value": "\"hello\""
}
]
},
"action": "runScript"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
The following JSON code is a sample API response for the Run script action with a property reference:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"functionName": "printVal",
"functionParameters": [
{
"valueReference": {
"reference": "InputRunScript",
"lastSavedValue": "hello world"
},
"name": "value"
}
]
},
"action": "runScript"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
Set value action in DX API
The Set value action assigns a source value to a target property in the UI. Learn about the JSON structure and elements of a sample Set value action, to understand how you can integrate it into your custom application.
The following JSON code is a sample API response for the Set value action with a hard-coded value:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"setValuePairs": [
{
"name": "ResponseSetValue",
"value": "\"abcd\""
}
]
},
"action": "setValue"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
The following JSON code is a sample API response for the Set value action with a property reference:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"setValuePairs": [
{
"valueReference": {
"reference": "InputSetValue",
"lastSavedValue": "a quick brown fox"
},
"name": "ResponseSetValue"
}
]
},
"action": "setValue"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
Perform action in DX API
The Perform action action submits flow actions and completes assignments under certain conditions. Learn about the JSON structure and elements of a sample Perform action action, to understand how you can integrate it into your custom application.
The following JSON code is a sample API response for the Perform action action with a hard-coded value:
{
"actionSets": [
{
"actions": [
{
"actionProcess": {
"actionName": "PortletAction"
},
"action": "takeAction"
}
],
"events": [
{
"event": "click"
}
]
}
]
}
- The actionSets, actions, and events elements are arrays.
- DX API v1 does not support the when conditions in the action set.
Previous topic Implementation of controls in DX API Next topic Security Settings for DX API