Data / Update variables
Task in alpha phase
This Data Factory task is in phase. You can contact the Product-Live team at contact@product-live.com if you want more details and get an early access.
This task allows to fully update variables. It performs a full replacement of the variable with the provided data, so the entire set of variable properties (id, key, name, value, status, isSecret) must be supplied in each operation. Any field not provided will be reset to its default value.
Task name:
Examples
json
{
"name": "data-variable-update",
"taskReferenceName": "update_variable",
"description": "Update a variable's value",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"context": {
"variableId": "12345"
},
"element": {
"id": "12345",
"key": "MY_VARIABLE",
"name": "My Variable",
"value": "new_value",
"status": "ACTIVE",
"isSecret": false
}
}
]
}
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
json
{
"name": "data-variable-update",
"taskReferenceName": "update_variable",
"description": "Deactivate a variable",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"context": {
"variableId": "12345"
},
"element": {
"id": "12345",
"key": "MY_VARIABLE",
"name": "My Variable",
"value": "current_value",
"status": "INACTIVE",
"isSecret": false
}
}
]
}
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Definition
| Property | Type | Required | Description |
|---|---|---|---|
| The name (or type) of the task | |||
| The unique name of the task in your job. It is used to reference this task in the workflow. | |||
| The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW. | |||
| : | true: the job continues if there is an error on this task. false: the job fails. | ||
| Input parameters of the task. See below |
Inputs Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| The Product-Live API key. If not provided, an automatically generated API key will be used to perform the request on behalf of the current user. If provided, the given API key will be used to perform the request. | |||
| See below | |||
Today, application/json and application/xml are supported. | |||
INLINE: The request body is provided inline in the request object. ATTACHMENT: The request body is provided as an attachment in the request object. | |||
| The request body as a JSON object. | |||
| See below | |||
| A unique key to identify the operation. This key will be associated to the element in the output. | |||
| The element to create or update. See examples below | |||
| Some element may require additional context to be created or updated. | |||
| The request body as a file. | |||
| The outputs of the request. Default: [{"mediaType": "application/json", "outputMode": "INLINE", "outputKey": "json"}]. | |||
The media type of the output. Today, application/json and application/xml are supported. | |||
INLINE: The output is provided inline in the output object. ATTACHMENT: The output is provided as an attachment in the output object. INLINE is only supported for mediaType=application/json | |||
| The key of the output. Either json or xml | |||
Default: default. The model/format used in the output. Today, only default is supported. |
contentType=application/json
- The expected elements are the entities described in the Product-Live API or the Data Factory API depending on the task.
- See examples below for more details.
json
{
"operations": [
{
"key": "a",
"element": {
"...": "..."
}
}
]
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
json
{
"operations": [
{
"key": "a",
"element": {
"...": "..."
}
}, {
"key": "b",
"element": {
"...": "..."
}
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Context requirements
| Property | Type | Required | Description |
|---|---|---|---|
| The ID of the variable to update |
Variable update element properties
This task performs a full replacement of the variable. All properties listed below must be provided in each operation; any field omitted will be reset to its default value.
| Property | Type | Required | Description |
|---|---|---|---|
The ID of the variable. Must match context.variableId | |||
| The key of the variable | |||
| The display name of the variable | |||
| The value of the variable | |||
The status. Possible values: ACTIVE, INACTIVE | |||
| Whether the variable should be treated as a secret |
contentType=application/xml
- This XML representation follows the one used by the JSON query language of the Product-Live API.
- The expected elements are the entities described in the Product-Live API or the Data Factory API depending on the task. This task performs a full replacement of the target entity. All properties must be provided in each operation; any field omitted will be reset to its default value.
- See examples below for more details.
xml
<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<array key="operations">
<map>
<string key="key">a</string>
<map key="context"></map>
<map key="element">
<string key="...">...</string>
</map>
</map>
</array>
</map>1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Outputs
| Property | Type | Description |
|---|---|---|
An object containing the result of the task. Each output key is the key of the output defined in the outputs[].outputKey input parameter. |
Example
If your input parameters is as follows:
json
{
"...": "...",
"outputs": [
{
"mediaType": "application/json",
"outputMode": "INLINE",
"outputKey": "json_inline"
},
{
"mediaType": "application/xml",
"outputMode": "ATTACHMENT",
"outputKey": "xml_attachment"
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The output will be as follows:
json
{
"result": {
"json_inline": {
"...": "...",
"...": "..."
},
"xml_attachment": {
"url": "..."
}
}
}1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Json output - outputs[].outputMode=INLINE and outputs[].mediaType=application/json
result.jsonis an array of objects as defined in the variables API.jsonis the default output key but may be changed by setting theoutputKeyproperty.
Example output:
json
[
{
"key": "a",
"response": {
"object": "variable",
"id": "12345",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-05-17T10:30:00.000Z",
"key": "MY_VARIABLE",
"name": "My Variable",
"status": "ACTIVE",
"value": "new_value",
"isSecret": false
}
}
]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Limits and additional notes
- When the
outputMode=INLINEis selected, the maximum number of elements returned by this task is limited to1000. If more elements are to be returned, the task ends with an error. To export up to the maximum of elements, use thelimitinput parameter to limit the number of elements return.
WARNING
This task performs a full replacement of the variable. Any field not provided will be reset to its default value. To update only a subset of properties, first read the current variable (e.g. via data-variable-find) and merge your changes before calling this task.
Additional examples
Update variable with XML input
job.json
json
{
"name": "data-variable-update",
"taskReferenceName": "update_variable",
"description": "Update variable with XML",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "ATTACHMENT",
"contentType": "application/xml",
"model": "default",
"file": "@my-request.xml"
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my-request.xml
xml
<?xml version="1.1" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<array key="operations">
<map>
<string key="key">a</string>
<map key="context">
<string key="variableId">12345</string>
</map>
<map key="element">
<string key="id">12345</string>
<string key="key">MY_VARIABLE</string>
<string key="name">My Variable</string>
<string key="value">new_value</string>
<string key="status">ACTIVE</string>
<boolean key="isSecret">false</boolean>
</map>
</map>
</array>
</map>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Update variable with dynamic values
job.json
json
{
"name": "data-variable-update",
"taskReferenceName": "update_variable",
"description": "Update variable with dynamic values",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"failOnError": true,
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"context": {
"variableId": "${find_variable.output.result.json[0].id}"
},
"element": {
"id": "${find_variable.output.result.json[0].id}",
"key": "${find_variable.output.result.json[0].key}",
"name": "${find_variable.output.result.json[0].name}",
"value": "${workflow.input.newValue}",
"status": "${find_variable.output.result.json[0].status}",
"isSecret": "${find_variable.output.result.json[0].isSecret}"
}
}
]
}
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Update many variables
job.json
json
{
"name": "data-variable-update",
"taskReferenceName": "update_variables",
"description": "Update many variables",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"context": {
"variableId": "12345"
},
"element": {
"id": "12345",
"key": "VARIABLE_A",
"name": "Variable A",
"value": "value_1",
"status": "ACTIVE",
"isSecret": false
}
},
{
"key": "b",
"context": {
"variableId": "12346"
},
"element": {
"id": "12346",
"key": "VARIABLE_B",
"name": "Variable B",
"value": "value_2",
"status": "ACTIVE",
"isSecret": false
}
}
]
}
}
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46