Scenario endpoints
Use these endpoints to list Speed Analysis Lab scenarios and retrieve their reports, individual step reports, and HAR files.
Get the list of scenarios
Section titled Get the list of scenariosPOST /v1/speed-analysis/scenario/list
Returns the list of scenarios.
Parameters
namestringString pattern to filter your scenarios and return only those that contain the pattern in their name
Request example
curl --location --request POST 'https://api.contentsquare.com/v1/speed-analysis/scenario/list' \--header 'Authorization: Bearer <your_access_token>'--data '{ "name": ""}'Response example
{ "payload": { "scenarios": [ { "id": 1, "name": "" } ] }, "success": true}Get a scenario report
Section titled Get a scenario reportPOST /v1/speed-analysis/scenario/report
Returns a scenario report.
Parameters
scenarioIdnumber RequiredUnique identifier of a scenario.
datenumber RequiredTimestamp (in ms) indicating when the report was generated.
Request example
curl --location --request POST 'https://api.contentsquare.com/v1/speed-analysis/scenario/report' \--header 'Authorization: Bearer <your_access_token>'--data '{ "scenarioId": 0, "date": 1542117158294}'Response example
{ "payload": { "scenarioReport": { "scenarioId": 0, "name": "", "resultId": 0, "date": 0, "viewOnTheWeb": "https://www.dareboost.com/scenario/[scenarioId]/report/[date]", "summary": { "fail": 0, "unavailableResource": 0, "browserError": 0, "sum": { "firstPaint": 0, "request": 0, "startRender": 0, "lastByte": 0, "weight": 0, "domInteractive": 0, "domContentLoadedEventStart": 0, "domComplete": 0, "loadEvent": 0, "firstContentfulPaint": 0, "loadTime": 0, "loadEventStart": 0, "firstConsistentlyInteractive": 0, "visuallyComplete": 0, "speedIndex": 0, "firstByte": 0, "domContentLoadedEventEnd": 0, "domLoading": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 }, "average": { "firstPaint": 0, "request": 0, "startRender": 0, "lastByte": 0, "weight": 0, "domInteractive": 0, "domContentLoadedEventStart": 0, "domComplete": 0, "loadEvent": 0, "firstContentfulPaint": 0, "loadTime": 0, "loadEventStart": 0, "firstConsistentlyInteractive": 0, "visuallyComplete": 0, "speedIndex": 0, "firstByte": 0, "domContentLoadedEventEnd": 0, "domLoading": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 } }, "steps": [ { "stepId": 0, "stepResultId": "", "name": "", "description": "", "fail": 0, "unavailableResource": 0, "browserError": 0, "timings": { "navigationStart": 0, "firstByte": 0, "firstPaint": 0, "domInteractive": 0, "loadEvent": 0, "startRender": 0, "speedIndex": 0, "visuallyComplete": 0, "oldVisuallyComplete": 0, "loadEventStart": 0, "lastByte": 0, "domLoading": 0, "domContentLoadedEventStart": 0, "domContentLoadedEventEnd": 0, "domComplete": 0, "firstContentfulPaint": 0, "firstConsistentlyInteractive": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 }, "weight": 0, "requestsCount": 0, "loadTime": 0, "customTimings": [ { "type": "", "name": "", "startTime": 0, "duration": 0 } ] } ] } }, "success": true}Get the scenario reports
Section titled Get the scenario reportsPOST /v1/speed-analysis/scenario/reports
Returns the scenario reports.
Parameters
scenarioIdnumber RequiredUnique identifier of a scenario.
limitnumberLimits the number of reports to return (default:
30). Set to0to get all scenario reports.lastDaysnumberRetrieve reports from the last X days, where X is the value of this parameter.
dateFromISO 8601 date stringRetrieve audit executed after this date. Must be a date before
dateTo.ISO format in UTC (for example "2021-08-13T12:32:40.000Z") or with a time zone offset ("2021-08-13T12:32:40+02:00" or "2021-08-13T12:32:40%2B+02:00" when encoded in the URL).
dateToISO 8601 date stringRetrieve audit executed before this date. Must be a date after
dateFrom.ISO format in UTC (for example "2021-08-13T12:32:40.000Z") or with a time zone offset ("2021-08-13T12:32:40+02:00" or "2021-08-13T12:32:40%2B+02:00" when encoded in the URL).
errorbooleanBy default, all results are returned. Set to
falseto retrieve only executions without error. Set totrueto retrieve only executions with error.
Request example
curl --location --request POST 'https://api.contentsquare.com/v1/speed-analysis/scenario/reports' \--header 'Authorization: Bearer <your_access_token>'--data '{ "scenarioId": 0, "limit": 30, "lastDays": 0, "dateFrom": "2016-03-11T00:00:00.000+0100", "dateTo": "2016-03-11T23:59:59.000+0100", "error": false}'Response example
{ "payload": { "scenario": { "id": 0, "name": "", "reports": [ { "resultId": 0, "date": 0, "viewOnTheWeb": "https://www.dareboost.com/scenario/[scenarioId]/report/[date]", "summary": { "fail": 0, "unavailableResource": 0, "browserError": 0, "sum": { "firstPaint": 0, "request": 0, "startRender": 0, "lastByte": 0, "weight": 0, "domInteractive": 0, "domContentLoadedEventStart": 0, "domComplete": 0, "loadEvent": 0, "firstContentfulPaint": 0, "loadTime": 0, "loadEventStart": 0, "firstConsistentlyInteractive": 0, "visuallyComplete": 0, "speedIndex": 0, "firstByte": 0, "domContentLoadedEventEnd": 0, "domLoading": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 }, "average": { "firstPaint": 0, "request": 0, "startRender": 0, "lastByte": 0, "weight": 0, "domInteractive": 0, "domContentLoadedEventStart": 0, "domComplete": 0, "loadEvent": 0, "firstContentfulPaint": 0, "loadTime": 0, "loadEventStart": 0, "firstConsistentlyInteractive": 0, "visuallyComplete": 0, "speedIndex": 0, "firstByte": 0, "domContentLoadedEventEnd": 0, "domLoading": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 } }, "steps": [ { "stepId": 0, "stepResultId": "", "name": "", "description": "", "fail": 0, "unavailableResource": 0, "browserError": 0, "timings": { "navigationStart": 0, "firstByte": 0, "firstPaint": 0, "domInteractive": 0, "loadEvent": 0, "startRender": 0, "speedIndex": 0, "visuallyComplete": 0, "oldVisuallyComplete": 0, "loadEventStart": 0, "lastByte": 0, "domLoading": 0, "domContentLoadedEventStart": 0, "domContentLoadedEventEnd": 0, "domComplete": 0, "firstContentfulPaint": 0, "firstConsistentlyInteractive": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 }, "weight": 0, "requestsCount": 0, "loadTime": 0, "customTimings": [ { "type": "", "name": "", "startTime": 0, "duration": 0 } ] } ] } ] } }, "success": true}Get the scenario step report
Section titled Get the scenario step reportPOST /v1/speed-analysis/scenario/step/report
Returns the report of the scenario step.
Parameters
stepIdstring RequiredUnique identifier of the step result of a scenario. Refers to the
stepResultIdof/scenario/reportsand/scenario/report.
Request example
curl --location --request POST 'https://api.contentsquare.com/v1/speed-analysis/scenario/step/report' \--header 'Authorization: Bearer <your_access_token>'--data '{ "stepId": ""}'Response example
{ "payload": { "step": { "id": "", "previousStepId": "", "nextStepId": "", "stepResultId": 0, "date": 0, "timings": { "firstByte": 0, "firstPaint": 0, "domInteractive": 0, "loadEvent": 0, "startRender": 0, "speedIndex": 0, "visuallyComplete": 0, "oldVisuallyComplete": 0, "loadEventStart": 0, "lastByte": 0, "domLoading": 0, "domContentLoadedEventStart": 0, "domContentLoadedEventEnd": 0, "domComplete": 0, "firstContentfulPaint": 0, "firstConsistentlyInteractive": 0, "largestContentfulPaint": 0, "totalBlockingTime": 0, "maxPotentialFirstInputDelay": 0, "totalLongTasks": 0, "lastLongTask": 0, "nbLongTasks": 0, "cumulativeLayoutShift": 0 }, "browserError": "[]", "unavailableResource": "{}", "actionsResult": [ { "id": 0, "time": 0, "status": "", "message": "" } ], "customTimings": [ { "type": "", "name": "", "startTime": 0, "duration": 0 } ] } }, "success": true}Get HAR from an analysis
Section titled Get HAR from an analysisPOST /v1/speed-analysis/scenario/report/har
Returns the HAR from the analysis.
Parameters
scenarioStepResultIdstring RequiredUnique identifier of the scenario step result, obtained when launching a scenario execution.
Request example
curl --location --request POST 'https://api.contentsquare.com/v1/speed-analysis/scenario/report/har' \--header 'Authorization: Bearer <your_access_token>'--data '{ "scenarioStepResultId": ""}'Response example
{ "payload": { "har": "" }, "success": true}