Get Account Variables
The Get Account Variables method allows you to get one or all account variables.
Importan!
To retrieve all account variables in a single request, simply pass an empty array to the "name" parameter.
Request
IMPORTANT: Do not send more than 10 concurrent API requests.
Body Example
{
"name": "globalVarName" //Send empty array to get all account variables.
}
Parameters
Title | Type | Default | Description |
---|---|---|---|
name required
|
string|array |
Variable name in lowerCamelCase format |
Response
{
"name":"globalVarName",
"value":"globalVarValue",
"createdAt":"YYYY-MM-DD h:i:s"
}
Parameters
Title | Type | Description |
---|---|---|
Response body |
object |
The value indicates that the variable information was successfully fetched from your account. |
name |
string |
Variable name. |
value |
string |
Variable Value. |
createdAt |
string |
Indicates time when variable was added. |
Method Errors
{
"result":false,
"errors":[
"Error description text"
]
}
Error |
---|
“Argument name must be a non-empty string” |
“no global variables found” |
“no matches found for global variable {globalVariable}” |
“Invalid authorization token!” |
“Internal server error” |
“Bad Request” |
“no matches found for access token {accessToken}” |
“user {id} not enabled” |
“no data found for key {userId}” |
“access token check failed for key\/secret $key\/$accessToken” |
“Argument {argument} required” |
Code Examples
$accessToken = "YOUR_API_KEY";
$url = 'https://api.wooxy.com/v3/global-variables/find';
$body = json_encode([
'name' => 'globalVariable', //Send empty array
]); //to get account global variables.
/**
* Request Example
*/
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_INFILESIZE, null);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Access-Token: $accessToken",
'Content-Type: application/json',
'Content-Length: ' . strlen($body),
]);
$result = curl_exec($ch);
if ($result === false) {
echo 'cURL error:' . curl_error($ch) . PHP_EOL;
} else {
echo strval($result) . PHP_EOL;
}
curl_close($ch);