Data / Create suggestions
Task in alpha phase
This Data Factory task is in phase: it is available on every account, and we keep improving it. Share your feedback with the Product-Live team at contact@product-live.com.
This task allows to create suggestions.
Task name:
Examples
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestion",
"description": "Create a suggestion for a given item",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"element": {
"object": "suggestion_create",
"itemId": "12345",
"screenId": "67890",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"key": "TITLE_EN",
"type": "SINGLE-LINE-TEXT",
"value": {
"data": "Some title better than the original"
}
}
]
}
}
]
}
}
}
}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
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
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestion_with_fields",
"description": "Create a suggestion with multiple field types",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"failOnError": true,
"request": {
"method": "INLINE",
"contentType": "application/json",
"model": "default",
"json": {
"operations": [
{
"key": "a",
"element": {
"object": "suggestion_create",
"itemId": "12345",
"screenId": "67890",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"key": "TITLE_EN",
"type": "SINGLE-LINE-TEXT",
"value": {
"data": "Updated product title"
}
},
{
"key": "WIDTH_MM",
"type": "NUMBER",
"value": {
"data": 42
}
}
]
}
}
]
}
}
}
}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
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
TIP
See below for more examples using JSON and XML inputs.
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. | |||
| Resolves business keys into ids before the operation is sent, so the element can be written without hardcoding ids. See the Lookups reference. | |||
| The same mechanism, declared once for the whole request instead of per operation. See the Lookups reference. | |||
| 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. | |||
Default: false. One request is sent per operation, and every operation is attempted. If true, the task then ends FAILED when at least one request was refused (status 400 or more), after the other suggestions were created. If false, the task completes and the output holds the response of each operation, error included. |
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
Suggestion element properties
| Property | Type | Required | Description |
|---|---|---|---|
Must be suggestion_create | |||
| The ID of the item to create the suggestion for | |||
| The ID of the screen defining which fields are included | |||
| Whether the suggestion includes a newly created item | |||
| The name of the entity creating the suggestion (e.g., "Product-Live AI agent") | |||
| Array of field values to suggest |
Field object properties
| Property | Type | Required | Description |
|---|---|---|---|
| The key of the field | |||
The field type (e.g., SINGLE-LINE-TEXT, LONG-TEXT, NUMBER, DATE) | |||
| Object containing the field value | |||
| The actual value. Its shape depends on the field type: see below |
What value holds, per field type
Send the field's own type. A type that disagrees with the catalogue is replaced by the catalogue's own before anything is validated, so the value is then read with the shape of the real type: {"data": "https://..."} sent as SINGLE-LINE-TEXT on a field the catalogue declares IMAGE is refused for its shape, not for its type.
A field key the table does not hold, or holds as archived, is dropped in silence: no error, and the suggestion is created without it. A suggestion that comes back with fewer fields than you sent is the sign to check those keys.
| Field type | value |
|---|---|
| , , , , , , | {"data": "a string"} |
{"data": "OPTION_KEY"} - the option's key, not its label | |
{"data": ["OPTION_KEY", "OTHER_KEY"]} | |
{"data": 42}, optionally {"data": 42, "suffix": "cm"} | |
| , | {"data": {"url": "https://..."}} - see below |
| , , | {"data": [{"key": "OPTION_KEY", "quantity": 2, "comment": "a note"}]} - quantity and comment are optional |
A text value must be a string and a number must be a number: {"data": 42} on a text field and {"data": "42"} on a NUMBER field are both refused.
Images and attachments
An image is a value like any other: the suggestion carries the address, and the platform downloads the file into the account while it creates the suggestion. Any http or https address works, including one outside Product-Live - a manufacturer's media library, for instance. An address pointing at a file Product-Live already holds is copied rather than downloaded again, across accounts if needed.
json
{
"key": "FRONT_VIEW",
"type": "IMAGE",
"value": {
"data": {
"url": "https://www.example.com/media/ref-1234-front.jpg"
}
}
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
The download happens while the suggestion is created, so an unreachable address, or one serving something the field cannot hold, fails that operation:
- an
IMAGEmust be a JPEG, a PNG, a WebP or a GIF, under 20 MB and under 50 megapixels; - an
ATTACHMENTmust be under 2 GB, and its format is not checked - an address answering with an error page is attached as that page; - the address must be
httporhttps, and the host must serve the file to us: hotlink protection answering 403 is a refusal like any other.
TIP
Keep the fields whose value is an address in an operation of their own. The operations of one request are performed one by one and a failing one does not stop the others, so a dead address then costs its own fields instead of every field suggested for that item.
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 suggestions API.jsonis the default output key but may be changed by setting theoutputKeyproperty.
Example output:
json
[
{
"key": "a",
"element": {
"object": "suggestion_create",
"itemId": "12345",
"screenId": "67890",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"key": "TITLE_EN",
"type": "SINGLE-LINE-TEXT",
"value": {
"data": "Some title better than the original"
}
}
]
},
"response": {
"object": "suggestion",
"id": "98765",
"createdAt": "2024-05-17T10:30:00.000Z",
"updatedAt": "2024-05-17T10:30:00.000Z",
"fromItemId": "12344",
"toItemId": "12345",
"screenId": "67890",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"isAcknowledged": false,
"fromAccountId": "1001",
"deletedFields": [],
"deletedCompositeRows": []
}
}
]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
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
XML output - outputs[].outputMode=ATTACHMENT and outputs[].mediaType=application/xml
Example output:
xml
<?xml version="1.0" encoding="UTF-8"?>
<array xmlns="http://www.w3.org/2005/xpath-functions">
<map>
<string key="key">a</string>
<map key="element">
<string key="object">suggestion_create</string>
<string key="itemId">12345</string>
<string key="screenId">67890</string>
<boolean key="hasCreatedItem">false</boolean>
<string key="emitterName">Product-Live AI agent</string>
<array key="fields">
<map>
<string key="key">TITLE_EN</string>
<string key="type">SINGLE-LINE-TEXT</string>
<map key="value">
<string key="data">Some title better than the original</string>
</map>
</map>
</array>
</map>
<map key="response">
<string key="object">suggestion</string>
<string key="id">98765</string>
<string key="createdAt">2024-05-17T10:30:00.000Z</string>
<string key="updatedAt">2024-05-17T10:30:00.000Z</string>
<string key="fromItemId">12344</string>
<string key="toItemId">12345</string>
<string key="screenId">67890</string>
<boolean key="hasCreatedItem">false</boolean>
<string key="emitterName">Product-Live AI agent</string>
<boolean key="isAcknowledged">false</boolean>
<string key="fromAccountId">1001</string>
<array key="deletedFields"/>
<array key="deletedCompositeRows"/>
</map>
</map>
</array>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
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
Limits and additional notes
- The creation and update of suggestions is limited to 100 suggestions per minute.
- An empty
operationslist fails the task. When the operations are computed by an earlier task, skip this task when there is none, for example with a Switch.
Additional examples
Create a single suggestion - XML input & output
job.json
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestion",
"description": "Create a single suggestion",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "ATTACHMENT",
"contentType": "application/xml",
"model": "default",
"file": "@my-request.xml"
},
"outputs": [
{
"mediaType": "application/xml",
"outputMode": "ATTACHMENT",
"outputKey": "xml"
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"></map>
<map key="element">
<string key="object">suggestion_create</string>
<string key="itemId">1</string>
<string key="screenId">1</string>
<boolean key="hasCreatedItem">false</boolean>
<string key="emitterName">Product-Live AI agent</string>
<array key="fields">
<map>
<map key="value">
<string key="data">Some title better than the original</string>
</map>
<string key="type">SINGLE-LINE-TEXT</string>
<string key="key">TITLE_EN</string>
</map>
</array>
</map>
</map>
</array>
</map>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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Create many suggestions - XML input & output
job.json
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestions",
"description": "Create many suggestions",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "ATTACHMENT",
"contentType": "application/xml",
"model": "default",
"file": "@my-request.xml"
},
"outputs": [
{
"mediaType": "application/xml",
"outputMode": "ATTACHMENT",
"outputKey": "xml"
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"></map>
<map key="element">
<string key="object">suggestion_create</string>
<string key="itemId">1</string>
<string key="screenId">1</string>
<boolean key="hasCreatedItem">false</boolean>
<string key="emitterName">Product-Live AI agent</string>
<array key="fields">
<map>
<map key="value">
<string key="data">Some title better than the original</string>
</map>
<string key="type">SINGLE-LINE-TEXT</string>
<string key="key">TITLE_EN</string>
</map>
</array>
</map>
</map>
<map>
<string key="key">b</string>
<map key="context"></map>
<map key="element">
<string key="object">suggestion_create</string>
<string key="itemId">2</string>
<string key="screenId">2</string>
<boolean key="hasCreatedItem">false</boolean>
<string key="emitterName">Product-Live AI agent</string>
<array key="fields">
<map>
<map key="value">
<string key="data">Some title better than the original</string>
</map>
<string key="type">SINGLE-LINE-TEXT</string>
<string key="key">TITLE_EN</string>
</map>
</array>
</map>
</map>
</array>
</map>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
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
Create a single suggestion - JSON input & output
job.json
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestion",
"description": "Create a single suggestion",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "ATTACHMENT",
"contentType": "application/json",
"model": "default",
"file": "@my-request.json"
},
"outputs": [
{
"mediaType": "application/json",
"outputMode": "ATTACHMENT",
"outputKey": "json"
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
my-request.json
json
{
"operations": [
{
"key": "a",
"context": {},
"element": {
"object": "suggestion_create",
"itemId": "1",
"screenId": "1",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"value": {
"data": "Some title better than the original"
},
"type": "SINGLE-LINE-TEXT",
"key": "TITLE_EN"
}
]
}
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Create many suggestions - JSON input & output
job.json
json
{
"name": "data-suggestion-create",
"taskReferenceName": "create_suggestions",
"description": "Create many suggestions",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": {
"method": "ATTACHMENT",
"contentType": "application/json",
"model": "default",
"file": "@my-request.json"
},
"outputs": [
{
"mediaType": "application/json",
"outputMode": "ATTACHMENT",
"outputKey": "json"
}
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
my-request.json
json
{
"operations": [
{
"key": "a",
"context": {},
"element": {
"object": "suggestion_create",
"itemId": "1",
"screenId": "1",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"value": {
"data": "Some title better than the original"
},
"type": "SINGLE-LINE-TEXT",
"key": "TITLE_EN"
}
]
}
},
{
"key": "b",
"context": {},
"element": {
"object": "suggestion_create",
"itemId": "2",
"screenId": "2",
"hasCreatedItem": false,
"emitterName": "Product-Live AI agent",
"fields": [
{
"value": {
"data": "Some title better than the original"
},
"type": "SINGLE-LINE-TEXT",
"key": "TITLE_EN"
}
]
}
}
]
}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
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