Create Tag
The Create Tag method allows you to create the tag which can be useful for collecting personalized analytics. You can filter analytics by the necessary tags and export it in the corresponding section.
Request
IMPORTANT: Do not send more than 10 concurrent API requests.
Body Example
{
"name": "tag-api-test",
"description": "test",
}
Parameters
Title | Type | Default | Description |
---|---|---|---|
name required
|
string |
The tag name that needs to be created. There are strict syntax rules for the name:
|
|
description optional
|
string |
The tag description is not a required field, but it can be useful for explaining what the tag is used for. |
Response
{
"result": true,
"id": "requestId"
}
Parameters
Title | Type | Description |
---|---|---|
result |
boolean |
The value indicates that the tag was successfully added to your account:
|
id |
string |
The response returns the identifier of the tag that was just created. |
Method Errors
{
"result":false,
"errors":[
"Error description text"
]
}
Error |
---|
"Tag name must be a non-empty string" |
"Tag characters length should be between 2 and 30" |
"Any tags starting with an underscore are reserved for internal use and will cause errors" |
"Tags limit {limit} is reached" |
"Tag {tag} is not registered in account tags" |
"Tag name {tag} must be unique" |
"Tag name must contain only numbers, latin/cyrillic characters or \".\", \"-\", \"_\" symbols" |
"Argument description must be a string" |
"Argument description must be a string with max length within 1000 characters" |
"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/tags/create';
$body = json_encode([
'name' => 'tag-api-test',
'description' => 'test',
]);
$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_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 $result . PHP_EOL;
}
curl_close($ch);