Skip to main content

tests

Creates, updates, deletes, gets or lists a tests resource.

Overview

Nametests
TypeResource
Idcloudflare.speed.tests

Fields

The following fields are returned by SELECT queries:

Page test result.

NameDatatypeDescription
idstringUUID. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
datestring (date-time) (example: 2014-01-01T05:20:00.12345Z)
desktopReportobjectThe Lighthouse report.
mobileReportobjectThe Lighthouse report.
regionobjectA test region with a label.
scheduleFrequencystringThe frequency of the test. (DAILY, WEEKLY) (example: DAILY)
urlstringA URL. (example: example.com)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectzone_id, url, test_idRetrieves the result of a specific test.
listselectzone_id, urlpage, per_page, regionTest history (list of tests) for a specific webpage.
createinsertzone_id, urlStarts a test for a specific webpage, in a specific region.
deletedeletezone_id, urlregionDeletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
test_idstring
urlstring
zone_idstringThe Cloudflare zone ID.
pageinteger
per_pageinteger
regionstring

SELECT examples

Retrieves the result of a specific test.

SELECT
id,
date,
desktopReport,
mobileReport,
region,
scheduleFrequency,
url
FROM cloudflare.speed.tests
WHERE zone_id = '{{ zone_id }}' -- required
AND url = '{{ url }}' -- required
AND test_id = '{{ test_id }}' -- required
;

INSERT examples

Starts a test for a specific webpage, in a specific region.

INSERT INTO cloudflare.speed.tests (
region,
zone_id,
url
)
SELECT
'{{ region }}',
'{{ zone_id }}',
'{{ url }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Deletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.

DELETE FROM cloudflare.speed.tests
WHERE zone_id = '{{ zone_id }}' --required
AND url = '{{ url }}' --required
AND region = '{{ region }}'
;