/templates endpoint provides an interface for managing template compilation in the shop system. Through this interface you can start the compilation process, query the current progress and status, and view a list of past compilation results.
In addition, you can determine how many steps are required for the full compilation process.
Supported methods
List of all supported methods.| Command/Info | Endpoints | GET | POST | PUT | DELETE |
|---|---|---|---|---|---|
| Template compilation | templates/ |
Data fields for template compilation
| Name | Type | Meaning |
|---|---|---|
| createdAt | String | Time of the compilation (ISO 8601 format, UTC). |
| diagnostics | Object | Detailed messages and hints about errors or warnings (e.g. missing text snippets). |
| durationMillis | Integer | Duration of the compilation in milliseconds. |
| errorCount | Integer | Number of errors that occurred. |
| status | String | Result status of the operation (e.g. success, error). |
| subshopId | String | ID of the subshop whose templates were compiled. |
| userId | Integer | ID of the user who started the compilation. |
| userName | String | Display name of the user who started the compilation. Either first + last name or “WEBSALE” if it is an account owned by WEBSALE. |
| warningCount | Integer | Number of warnings that occurred. |
Example
Methods for template compilation
The following methods let you start the template compilation process, monitor its progress, and view past compilation results.GET templates/results
This method gives you access to a list of previous template compilation runs. Each entry contains information about status, duration, the number of errors and warnings as well as the subshops and users involved. The results can be filtered and sorted to analyze specific compilation runs. To use this endpoint, the corresponding permissions to read template data must be available.Example
Response
Filter fields
createdAt, duration, errorCount, warningCount, user, subshopId
Sort fields
createdAt, duration, durationMillis, errorCount, warningCount, subshopId, status
Error codes
| Error | Type | Reason | ||
|---|---|---|---|---|
| 401 Unauthorized | Not authorized: you are not logged in or you do not have the required permissions to read template data. | |||
| 400 Bad Request | ”invalidValue” | size ∉ [1;300] | pageToken is not a number or is less than 0. | |
| 400 Bad Request | ”unknownDataField” | A filter or sort field is invalid. | ||
| 400 Bad Request | ”unknownOperation” | A filter type is invalid. | ||
| 400 Bad Request | ”invalidCharacters” | size is not an integer. A filter value is invalid. | ||
| 400 Bad Request | ”syntaxError” | sort contains more than one or no ”:”. |
GET templates/compilationSteps
This method returns the total number of compilation steps performed when building the templates. Each template file is assigned a fixed three-step sequence: translating, parsing and linking. Therefore the response returns the number of files × 3. To use this endpoint, the corresponding permissions to read template data must be available.Example
Response
In this example 4 templates were processed, and each compilation run consists of 3 steps (translating, parsing, linking), which results in 12 steps in total.Error codes
| Error | Type | Reason |
|---|---|---|
| 401 Unauthorized | Not authorized: you are not logged in or you do not have the required permissions to read template data. | |
| 503 Service Unavailable | ”internalError” | Template files could not be read. |
GET templates/compile
This method returns the current status of the running compilation process. As long as the compilation is not yet finished, the response contains information about progress. After completion, the endpoint additionally returns details about any warnings or errors. To use this method, the corresponding permissions to read template data must be available.Example
Response (compilation not yet finished)
Response (compilation finished)
Error codes
| Error | Type | Reason |
|---|---|---|
| 401 Unauthorized | Not authorized: you are not logged in or you do not have the required permissions to read template data. | |
| 503 Service Unavailable | ”internalError” | The server found invalid data. |
POST templates/compile
This method starts the compilation and publication of all templates. The current text snippets are taken into account and embedded into the templates. To trigger this operation, the corresponding permissions to publish template data must be available.Example
Response
Error codes
| Error | Type | Reason |
|---|---|---|
| 401 Unauthorized | Not authorized: you are not logged in or you do not have the required permissions to publish template data. | |
| 503 Service Unavailable | ”serviceUnavailable” | TemplateCompilerUrl could not be found, or compilation failed. |
