resource (Experimental)
NAME
abtasty-cli web-experimentation resource load
- Load your resource file
SYNOPSIS
abtasty-cli web-experimentation resource load [--file Resource_File]
DESCRIPTION
Load resources from your file
EXAMPLES
abtasty-cli web-experimentation resource load --file loadResource.json
❗️ No confirmation step
There is no confirmation step to create Flagship resources
REQUIRED FLAGS
--file = _RESOURCE_FILE_
The raw data contains all the info about flagship resources, check the Remote Control documentation for more details
--input-params = _INPUT_PARAMS_
Params to replace resource loader file
--input-params-file = _INPUT_PARAMS_FILE_
File that contains params to replace resource loader file
--output-file = _OUTPUT_FILE_
Result of the command that contains all resource information
Here is an example of the resource file JSON
{
"version": 1,
"resources": [
{
"type": "folder",
"$_ref": "f1",
"action": "create",
"payload": {
"name": "Summer 2025"
}
},
{
"type": "audience",
"$_ref": "a1",
"action": "create",
"payload": {
"name": "Segment",
"description": "description_1",
"hidden": false,
"allow_duplicated_config": true,
"groups": [
[
{
"operator": "or",
"mutation_observer": false,
"type": "ACTION_TRACKING",
"conditions": [
{
"include": true,
"value": "hello2025"
}
]
},
{
"operator": "auto",
"mutation_observer": false,
"type": "SESSION_NUMBER",
"conditions": [
{
"condition": 1,
"include": true,
"value": 60
}
]
}
]
]
}
},
{
"type": "campaign",
"$_ref": "c1",
"action": "create",
"payload": {
"name": "Holiday Promo",
"description": "Winter discounts",
"url": "http://example.com",
"type": "ab",
"status": "pause",
"labels": [
"chadi.laoulaou",
"SP"
],
"code": "console.log('global code!')",
"source_code": "",
"folder_id": "$f1.id",
"campaign_targeting": {
"segment_ids": [
"$a1.id"
],
"url_scopes": [
{
"condition": "IS",
"value": "https://abtasty.com"
}
],
"selector_scopes": [
{
"condition": "IS_SELECTOR_CLASS",
"value": ".h1"
},
{
"condition": "IS_NOT_SELECTOR_ID",
"value": "#1234"
},
{
"condition": "IS_NOT_SELECTOR_CLASS",
"value": ".#blue"
}
],
"code_scope": {
"value": "console.log(\"hello world\");"
},
"element_appears_after_page_load": false,
"targeting_frequency": {
"type": "regular",
"unit": "day",
"value": 20
}
}
},
"resources": [
{
"type": "variation",
"$_ref": "v1",
"action": "create",
"payload": {
"name": "Variation A",
"description": "Define variation description",
"traffic": 14,
"code": {
"js": "alert('Variation A')",
"css": "p {color: red; text-align: center;}"
}
},
"resources": [
{
"type": "modification",
"$_ref": "m1",
"action": "create",
"payload": {
"name": "modification 1",
"selector": "#main .text-center a",
"type": "js",
"code": "<h1>Click Here !</h1>"
}
}
]
},
{
"type": "variation",
"$_ref": "v2",
"action": "create",
"payload": {
"name": "Variation B",
"traffic": 14,
"code": {
"js": "document.querySelector('.btn').textContent = 'CLICK HERE';"
}
}
}
]
},
{
"type": "variation",
"$_ref": "v3",
"$_parent_id": "$c1.id",
"action": "create",
"payload": {
"name": "Variation C",
"code": {
"js": "console.log('Variation C')",
"css": "p {color: purple; text-align: center;}"
}
}
},
{
"type": "modification",
"$_ref": "m2",
"action": "create",
"$_parent_id": "$v1.id",
"payload": {
"name": "modification 2",
"campaign_id": "$c1.id",
"selector": "#main",
"type": "js",
"code": "console.log('hello people!')"
}
}
]
}
Scripting in the resource file
This resource command uses scripting language to assign the result of an HTTP Request to a variable. When the resource command is executed, the resources are created in sequential order and each resource's HTTP result is assigned to its resourceVariable property, to access the HTTP result in the JSON file use $ followed by resourceVariable value, for example in the example JSON above you can access the result of the object folder created using $f1.
Last updated
Was this helpful?