Variable_add
To add a custom variable to MistServer you'll need to pass an object with the information. A static variable only needs a value, while a dynamic variable would need at least a target.
To learn the difference between static and dynamic variables please look up the variables explanation.
There's multiple ways to add a variable:
Object needs at least a name
and either a target
or a value
:
{
"variable_add":{
"name":"test", //mandatory variable name
"target":"echo -n test", //optional command or url to execute
"interval":9, //optional how often the command/url should be re-evaluated in seconds
"waitTime":1, //optional maximum time to wait for evaluation of the command/url to complete in seconds
"value":"value" //optional starting value of the custom variable
}
}
Array form simple
{
"variable_add":["name","value"]
}
Array form full
{
"variable_add":[
"name", //name of the variable
"target", //command or url to execute
interval, //how often the command/url should be re-evaluated in seconds
"value", //optional starting value of the custom variable
"waitTime" //optional maximum time to wait for evaluation of the command/url to complete in seconds
]
}
The response will contain the updated variable_list