Wooxy API v.3.0

Create Account Variable

The Create Account Variable method allows you to create an account variable.

Request

POST
https://api.wooxy.com/v3/global-variables/create

IMPORTANT: Do not send more than 10 concurrent API requests.

Body Example

                                        {
    "name": "globalVarName",
    "value": "globalVarValue"
}
                                    

Parameters

Title Type Default Description

name

required
string

Variable name in lowerCamelCase format
WARNING: Please use only latin lowerCamelCase format. No numbers or other symbols allowed.

value

required
string

Variable value in 'ENUM_STRING' format.

Response

                                        {
 "result":true
}
                                    

Parameters

Title Type Description

result

boolean

The value indicates that the variable was successfully added to your account:

  • true: Variable was successfully added.

Method Errors

                                        {
   "result":false,
   "errors":[
      "Error description text"
   ]
}
                                    
Error

“name of variable must be a string”

“name of variable can not be empty”

“variable \”{name}\” is reserved and can not be added as custom variable”

“invalid name of variable {name}”

“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

PHP
                $accessToken = "YOUR_API_KEY";
$url = 'https://api.wooxy.com/v3/global-variables/create';
$body = json_encode([
    'name' => 'globalVarName',
    'value' => 'globalVarValue',
]);

/**
 * 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);