tests
Creates, updates, deletes, gets or lists a tests resource.
Overview
| Name | tests |
| Type | Resource |
| Id | cloudflare.speed.tests |
Fields
The following fields are returned by SELECT queries:
- get
- list
Page test result.
| Name | Datatype | Description |
|---|---|---|
id | string | UUID. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415) |
date | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
desktopReport | object | The Lighthouse report. |
mobileReport | object | The Lighthouse report. |
region | object | A test region with a label. |
scheduleFrequency | string | The frequency of the test. (DAILY, WEEKLY) (example: DAILY) |
url | string | A URL. (example: example.com) |
List of test history for a page.
| Name | Datatype | Description |
|---|---|---|
id | string | UUID. (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415) |
date | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
desktopReport | object | The Lighthouse report. |
mobileReport | object | The Lighthouse report. |
region | object | A test region with a label. |
scheduleFrequency | string | The frequency of the test. (DAILY, WEEKLY) (example: DAILY) |
url | string | A URL. (example: example.com) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | zone_id, url, test_id | Retrieves the result of a specific test. | |
list | select | zone_id, url | page, per_page, region | Test history (list of tests) for a specific webpage. |
create | insert | zone_id, url | Starts a test for a specific webpage, in a specific region. | |
delete | delete | zone_id, url | region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
test_id | string | |
url | string | |
zone_id | string | The Cloudflare zone ID. |
page | integer | |
per_page | integer | |
region | string |
SELECT examples
- get
- list
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
;
Test history (list of tests) for a specific webpage.
SELECT
id,
date,
desktopReport,
mobileReport,
region,
scheduleFrequency,
url
FROM cloudflare.speed.tests
WHERE zone_id = '{{ zone_id }}' -- required
AND url = '{{ url }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND region = '{{ region }}'
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: tests
props:
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the tests resource.
- name: url
value: "{{ url }}"
description: Required parameter for the tests resource.
- name: region
value: "{{ region }}"
description: |
A test region.
valid_values: ['asia-east1', 'asia-northeast1', 'asia-northeast2', 'asia-south1', 'asia-southeast1', 'australia-southeast1', 'europe-north1', 'europe-southwest1', 'europe-west1', 'europe-west2', 'europe-west3', 'europe-west4', 'europe-west8', 'europe-west9', 'me-west1', 'southamerica-east1', 'us-central1', 'us-east1', 'us-east4', 'us-south1', 'us-west1']
default: us-central1
DELETE examples
- delete
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 }}'
;