Wooxy API v.3.0

Get Template

The Get Template method allows you to get detailed information about the template using his identificator.

Request

POST
https://api.wooxy.com/v3/template/email/get

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

Body Example

                                        {
   "templateId": "YOUR_TEMPLATE_ID"
}
                                    

Parameters

Title Type Default Description

templateId

required
string

YOUR_TEMPLATE_ID from the Wooxy system.

Response

                                        {
   "result": true,
   "data": {
      "templateId":"YOUR_TEMPLATE_ID",
      "name":"Template name",
      "html":"Hello, World!",
      "subject":"Hello subject",
      "templateSource":"text",
      "createdAt":"YYYY-MM-DD HH:mm:ss",
      "updatedAt":"YYYY-MM-DD HH:mm:ss"
   }
}
                                    

Parameters

Title Type Description

result

boolean

The request is accepted and queued:

  • true: The value indicates that the template was successfully fetched.

data

array

An array of fetched information.

data.templateId

string

YOUR_TEMPLATE_ID from the Wooxy system.

data.name

string

Template name in the Wooxy system

data.html

string

The full HTML or text content of the template.

data.subject

string

The Email subject.

data.templateSource

string

Template creation type in the Wooxy system. Some types of templates are not possible to update via API to avoid breaking metadata necessary for correct work:

  • file: HTML template created via upload of the HTML file. INFO Can be updated via API;
  • text: HTML template created via copying the code to the Wooxy admin panel. INFO Can be updated via API;
  • rte: HTML template created via Rich Text Editor in Wooxy admin panel. Warning Can not be updated via API;
  • dnd: HTML template created via Drag & Drop Editor in Wooxy admin panel. Warning Can not be updated via API;
  • stripo: HTML template imported via Stripo integration. Warning Can not be updated via API.

data.createdAt

string

Time of template creation YYYY-MM-DD h:i:s format

data.updatedAt

string

Time of template last updated in YYYY-MM-DD h:i:s format

Method Errors

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

“Argument templateId must be a non-empty string”

“Template {templateId} not found in account”

“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/template/email/get';

$body = json_encode([
   'templateId' => 'YOUR_TEMPLATE_ID'
]);
/**
* 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);