Edit Variable by Name

Description

Updates the value of a permanent variable identified by the variable name. 

Request URL

http://{controllerMachine}:{controllerPort}/api/v4/variables

Examples

Curl

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'AccessKey: Mo87Nc4qDAtzJNDb' -d '{ \
"$id": "1", \
"Name": "MyVariable", \
"Value": { \
"$id": "2", \
"$type": "Leapwork.Models.Models.LDataTypes.LText, Leapwork.Models", \
"Value": "New Value" \
} \
}' 'http://{controllerMachine}:{controllerPort}/api/v4/variables'

PowerShell 

$headers = @{}
$headers.Add("AccessKey","Mo87Nc4qDAtzJNDb")
$requestBody = @'
{
    "$id": "1",
    "Name": "MyVariable",
    "Value":
    {
        "$id": "2",
        "$type": "Leapwork.Models.Models.LDataTypes.LText, Leapwork.Models",
        "Value": "New Value"
    }
}
'@ 

Invoke-WebRequest -Uri "http://localhost:9001/api/v4/variables" -ContentType "application/json" -Headers $headers -Method PUT -Body $requestBody

Response Body

Modified value of a variable.

{
{
"$id": "1",
"Name": "MyVariable",
"Value":
{
"$id": "2",
"$type": "Leapwork.Models.Models.LDataTypes.LText, Leapwork.Models",
"Value": "New Value"
}
}
}

 

Response Parameters

Property Type Description Values
$id string ID of internal object  
Name string Name of the variable  
Value LSignal Object holds values for a Variable "$id", "$type", "Value"
LSignal Object    
$id string ID of internal object  
Type Leapwork.Models.Models.LDataTypes.Ltext Static data type  
Value string Value of in variable  


Response Code

200 (OK)

401 (Unauthorized,incorrect access key)

404 (Variable not found)

500 (Internal Server Error)