Wooxy API v.3.0

Update Template

The Update Template method allows you to update the template for emails.

Request

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

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

Body Example

                                        {
    "name": "Template name",
    "subject": "Hello subject",
    "html": "Hello, World!", 
    "templateId": "YOUR_TEMPLATE_ID"
}
                                    

Parameters

Title Type Default Description

name

optional
string

Name of your template.

subject

optional
string

The Email subject.

html

optional
string

The full HTML or text content of the template.

templateId

required
string

YOUR_TEMPLATE_ID from the Wooxy system.

Response

                                        {
         "result": true,
         "templateId": "YOUR_NEW_TEMPLATE_ID"
}
                                    

Parameters

Title Type Description

result

boolean

The request is accepted and queued:

  • true: The value indicates that the template was successfully updated in your account.

templateId

string

A unique Template ID assigned in the Wooxy system is used to match the specific Email Template.

Method Errors

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

“Argument name must be a non-empty string with max length within 255 characters”

“Argument subject must be a non-empty string”

“Twig syntax error”

“Argument html must be a non-empty string”

“Twig syntax error”

“Not allowed to edit html in template {templateId}”

“Argument templateId must be a string”

“Argument templateId must be a non-empty string”

“Template {templateId} not found in account”

“At least one field must be changed”

“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/update';

$body = json_encode([
      'name'          => 'Template name',
      'subject'       => 'Hello subject',
      'html'          => 'Hello, World!', 
      '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);