Edit Variable by Name

Description

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

Request URL

http://{controllerMachine}:{controllerPort}/api/v3/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/v3/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/v3/variables" -ContentType "application/json" -Headers $headers -Method PUT -Body $requestBody

Response Body

Modified value of 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 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)

404 (Not Found)

401 (Unauthorized)

400 (Bad Request)

405 (Method Not Allowed)

500 (Internal Server Error)