Create a template
Creates a new template file inside the theme. The file_name determines
the template type (e.g. layout.html, product.html, custom.css).
POST
/themes/{theme_id}/templatesAuthorization
AuthorizationBearer token (JWT) · headerrequiredPath parameters
theme_idstringrequiredTheme ID
Request body
requiredapplication/jsonfile_namestringrequiredTemplate filename (determines type)
bodystringTemplate source code
Responses
201Template created
_linksHalLinksidstringfile_namestringpathstringbodystringFull template source code
is_sectionbooleanschemaobjectPresent only when `is_section` is true — the section's configurable schema.
parent_commitstring | nullupdated_onstring<date-time>401Unauthorized
403Access denied
422Validation error
Request
curl -X POST "https://api.onbolder.com/v2/themes/abc123/templates" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"file_name": "collection.html",
"body": "<h1>{{ collection.name }}</h1>"
}'const response = await fetch("https://api.onbolder.com/v2/themes/abc123/templates", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"file_name": "collection.html",
"body": "<h1>{{ collection.name }}</h1>"
})
});import requests
response = requests.post(
"https://api.onbolder.com/v2/themes/abc123/templates",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"file_name": "collection.html",
"body": "<h1>{{ collection.name }}</h1>"
},
)Response
{
"_links": {
"property1": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
},
"property2": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
}
},
"id": "string",
"file_name": "layout.html",
"path": "string",
"body": "string",
"is_section": true,
"schema": {},
"parent_commit": "string",
"updated_on": "2019-08-24T14:15:22Z"
}Unauthorized
Access denied
Validation error