flagship resource (Experimental)

Load your resource

flagship resource load

NAME

flagship resource load - Load your resource file

SYNOPSIS

flagship resource load [--file Resource_File]

DESCRIPTION

    Load resources from your file

EXAMPLES

flagship 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

Here is an example of the resource file JSON

{
    "resources": [
        {
            "name": "project",
            "resourceVariable": "p1",
            "method": "create",
            "data": {
                "name": "Resource loader Project"
            }
        },
        {
            "name": "campaign",
            "resourceVariable": "c1",
            "method": "create",
            "data": {
                "project_id": "$p1.id",
                "name": "Resource loader Campaign",
                "description": "Loaded from resource loader",
                "type": "ab",
                "variation_groups": [
                    {
                        "variations": [
                            {
                                "name": "Original",
                                "reference": true,
                                "allocation": 50,
                                "modifications": {
                                    "type": "FLAG",
                                    "value": {
                                        "color": "red"
                                    }
                                }
                            },
                            {
                                "name": "Variation 1",
                                "reference": false,
                                "allocation": 50,
                                "modifications": {
                                    "type": "FLAG",
                                    "value": {
                                        "color": "blue"
                                    }
                                }
                            }
                        ],
                        "targeting": {
                            "targeting_groups": [
                                {
                                    "targetings": [
                                        {
                                            "operator": "EQUALS",
                                            "key": "device",
                                            "value": "firefox"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "name": "flag",
            "resourceVariable": "f1",
            "data": {
                "name": "flag_created_with_resource_loader",
                "type": "string",
                "description": "Loaded from resource loaderr",
                "source": "manual"
            }
        },
        {
            "name": "goal",
            "resourceVariable": "g1",
            "data": {
                "type": "screenview",
                "label": "goal_created_with_resource_loader",
                "operator": "contains",
                "value": "Performance"
            }
        },
        {
            "name": "targeting_key",
            "resourceVariable": "t1",
            "data": {
                "type": "string",
                "name": "targeting_key_created_with_resource_loader",
                "description": "Loaded from resource loader"
            }
        }
    ]
}

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, and 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 project created using $p1.