Returns the templates sorted by name.
Admin SDKAdmin.api('site.templates.find', null, function(response) { … });
HTTP POST/api/v10/site.templates.find
{
"status" : "ok",
"templates" : [ "Respy-Classic", "Respy-Wide", … ] // string(1…60)
}
Returns the files and directories that meet the given conditions.
Admin SDKAdmin.api('site.templates.find-files', request, function(response) { … });
HTTP POST/api/v10/site.templates.find-files
{
"template" : "Respy-Classic", // template name (required) - string(1…60)
"conditions" : { // returns only files and directories …
"parent" : "/css", // … that have this directory as parent - string(1…255)
"isDir" : false // … that are or not are directories - bool
},
"fields" : [ "name", "size", "modTime", … ] // returns only these fields - string
}
{
"status" : "ok",
"files" : [ {
"name" : "base.css", // name - string(3…255)
"size" : 382, // size in bytes, null for directories - int(0…)
"modTime" : "2020/01/12 19:16:22", // last modification time (UTC), null for directories - datetime
"isDir" : false, // indicates if it is a directory - bool
"files" : null // directory's files, null for files
}, {
"name" : "colors", // name - string(1…255)
"size" : null, // size in bytes, null for directories - int(0…)
"modTime" : null, // last modification time (UTC), null for directories - datetime
"isDir" : true, // indicates if it is a directory - bool
"files" : [ … ] // directory's files, null for files
}, … ]
}
Field | Type | Description |
---|---|---|
parent | Malformed | '<parent>' is not a valid directory path |
parent | NotFound | Directory '<parent>' does not exist |
template | Malformed | '<template>' is not a valid template name |
template | NotFound | Template '<template>' does not exist |
Reads a text file and returns its content. If the file does not exist return null and if it is greater than 1 Mbytes return an error.
Admin SDKAdmin.api('site.templates.read-text-file', request, function(response) { … });
HTTP POST/api/v10/site.templates.read-text-file
{
"template" : "Respy-Wide", // name of the template (required) - string(1…60)
"path" : "/css/style.css" // path of the file (required) - string(4…255)
}
{
"status" : "ok",
"text" : ".products .price { color: red; }" // text content of the file,
// null if the file does not exist (can be null) - string
}
Field | Type | Description |
---|---|---|
path | Invalid | Content of file at path '<path>' is not UTF8 encoded |
path | Invalid | File at path '<path>' is greater that 1 Mbyte |
path | Malformed | '<path>' is not a valid file path |
template | Malformed | '<template>' is not a valid template name |
template | NotFound | Template '<template>' does not exist |
Write a text file. Creates the file if it does not exist. If the text content is greater than 1 Mbytes return an error.
Admin SDKAdmin.api('site.templates.write-text-file', request, function(response) { … });
HTTP POST/api/v10/site.templates.write-text-file
{
"template" : "Respy-Wide", // name of the template (required) - string(1…60)
"path" : "/css/style.css", // path of the file (required) - string(4…255)
"text" : ".products .product { color: red; }" // text content (required) - string
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
path | Malformed | '<path>' is not a valid file path |
template | Malformed | '<template>' is not a valid template name |
template | Malformed | Template '<template>' does not exist |
text | Malformed | Text is greater that 1 Mbyte |
Deletes one or more files. If it can not delete a file it continues and does not return errors.
Admin SDKAdmin.api('site.templates.delete-files', request, function(response) { … });
HTTP POST/api/v10/site.templates.delete-files
{
"template" : "Respy-Wide", // name of the template (required) - string(1…60)
"paths" : [ "/page.html", "/css/style.css", … ] // paths of the files to delete (required) - string(4…255)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
paths | Malformed | '<path>' is not a valid file path |
paths | Malformed | paths can not contain more than 100 paths |
template | Malformed | '<template>' is not a valid template name |
template | Malformed | Template '<template>' does not exist |