/services/websites/v1/components/convert-to-template
Auth
This is the inverse of the Unlink operation: 1. Creates a new Partial (reusable template) with custom='custom_template' 2. Copies the component's data (code, meta, custom_fields) into a PartialsComponents child 3. Updates the original component to become a templatePartial linked to the new template
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
component_id |
string | Yes | The component connection ID to convert into a template. | 6122 |
id |
string | Yes | The post_name (slug) of the page containing the component. | / |
type |
string | Yes | The target type: page, header, footer, or secured. | page |
template_type |
string
custom_template, reuseable_template |
Yes | The template type to create: custom_template (single use) or reuseable_template (shared). | custom_template |
template_name |
string|null
max: 255 |
No | Optional display name for the new template. | Template: Dynamic... |
| Field | Type | Description |
|---|---|---|
message |
string | Errors overview. |
errors |
object | A detailed description of each field that failed validation. |
| Header | Type | Description | Example |
|---|---|---|---|
X-RateLimit-Limit |
integer | Maximum number of requests allowed per minute | 60 |
X-RateLimit-Remaining |
integer | Number of requests remaining in the current window | 57 |
| Field | Type | Description |
|---|---|---|
error |
boolean | |
message |
string | |
data |
mixed[] |
| Header | Type | Description | Example |
|---|---|---|---|
X-RateLimit-Limit |
integer | Maximum number of requests allowed per minute | 60 |
X-RateLimit-Remaining |
integer | Number of requests remaining in the current window | 57 |
| Field | Type | Description |
|---|---|---|
error |
boolean | |
message |
string | |
partial |
object | |
partial.id |
integer | |
partial.title |
string|null | |
partial.type |
string|null | |
partial.type_layout |
string|null | |
partial.preview_image |
null |
| Header | Type | Description | Example |
|---|---|---|---|
X-RateLimit-Limit |
integer | Maximum number of requests allowed per minute | 60 |
X-RateLimit-Remaining |
integer | Number of requests remaining in the current window | 57 |
| Field | Type | Description |
|---|---|---|
error |
boolean | |
message |
string |
| Header | Type | Description | Example |
|---|---|---|---|
X-RateLimit-Limit |
integer | Maximum number of requests allowed per minute | 60 |
X-RateLimit-Remaining |
integer | Number of requests remaining in the current window | 57 |
| Field | Type | Description |
|---|---|---|
error |
boolean | |
message |
string |
| Header | Type | Description | Example |
|---|---|---|---|
X-RateLimit-Limit |
integer | Maximum number of requests allowed per minute | 60 |
X-RateLimit-Remaining |
integer | Number of requests remaining in the current window | 57 |
Retry-After |
integer | Seconds until the rate limit resets | 60 |
| Field | Type | Description |
|---|---|---|
error |
boolean | |
message |
string |
curl -X POST "https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"component_id": "6122",
"id": "/",
"type": "page",
"template_type": "custom_template",
"template_name": "Template: Dynamic..."
}'
fetch('https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"component_id": "6122",
"id": "/",
"type": "page",
"template_type": "custom_template",
"template_name": "Template: Dynamic..."
})})
.then(r => r.json())
.then(data => console.log(data));
$response = Http::withToken('YOUR_API_TOKEN')
->accept('application/json')
->post('https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template', {
"component_id": "6122",
"id": "/",
"type": "page",
"template_type": "custom_template",
"template_name": "Template: Dynamic..."
});
$data = $response->json();
import requests
headers = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Accept": "application/json"
}
data = {
"component_id": "6122",
"id": "/",
"type": "page",
"template_type": "custom_template",
"template_name": "Template: Dynamic..."
}
r = requests.post("https://api.wemasy.nl/api/services/websites/v1/components/convert-to-template", headers=headers, json=data)
print(r.json())
{
"error": false,
"message": "string",
"partial": {
"id": 0,
"title": "string",
"type": "string",
"type_layout": "string",
"preview_image": "string"
}
}