REST PageSpeed-Tool (EN)
API PageSpeed tool
Generation of the groups
The generation of the groups can be triggered directly. It must be specified in the body whether the JavaScript groups or CSS groups are to be generated.
The build process is triggered via the endpoint and then runs asynchronously. To query the status, the /status
endpoint must be called.
Only one build process can run at a time. Therefore, a new build process cannot be started until a status request in the status
field has the value "finished"
or "error
".
Request
POST https://www.websale.de/api/pagespeedtool/build
Content-Type
application/json
Authorization-Token
requires
Request-Body
Property | Type | Description |
---|---|---|
type | string | Type specification which groups should be generated (mandatory field) |
Example request body
Generate all javascript groups
{
"type": "js"
}
Example cURL
Generation of all CSS groups
curl \
-X POST \
-H "Content-Type: application/json" \
-H "X-Authorization: Bearer eyJhbGciOiJIUzI1Ni...jBhOWMyMmRmNzFkOT==" \
-d '{
"type": "css"
}' \
"https://www.websale.de/api/pagespeedtool/build"
Response
If successful, HTTP code 200 is returned. The content is empty.
Possible errors
Status code | Meaning | Description |
---|---|---|
400 | Bad Request | Invalid content type or request body has wrong format/content. |
401 | Unauthorized | User has no permissions for the specified ShopID or the token is no longer valid. |
409 | Conflict | A build process is already running. |
Query status
Query the status of the current build process. The endpoint will give a valid response until the build process has completed and the finished or error message has been retrieved once.
Request
Content-Type
application/json
Authorization-Token
requires
Request-Body
not required
Example cURL
Response
If successful, HTTP code 200 and a JSON object will be returned.
Field | Type | Description |
---|---|---|
status | String | Possible values:
|
progress | Integer | Progress (in %) |
packages | Integer | Number of packages processed in the build process |
finished | Integer | Number of packages already processed in the build process |
package | Array | More detailed information about all packages |
package[].id | String | ID of the package |
package[].status | String | Status of the package. Possible values:
|
package[].changed | Bool | Information whether the content of the package has changed since last generation |
package[].error | Array / Object | If package If package |
package[].error.resource | String | Name of the resource where the syntax error was found |
package[].error.line | String | Line where the syntax error was identified |
package[].error.pos | String | Position where the syntax error was identified |
package[].error.msg | String | Description of the syntax error |
Possible errors
Status code | Meaning | Description |
---|---|---|
401 | Unauthorized | User has no permissions for the specified ShopID or the token is no longer valid. |
404 | Not Found | No build process is currently running. |
Example: