Skip to content

Web Service Endpoints

Rowan Manning edited this page Nov 7, 2016 · 7 revisions

This page contains documentation on all available web-service endpoints in pa11y-ws.

POST /tasks

Create a new task.

Request body must be a JSON object representing the new task. It should have the following properties:

name
(string) The name of the new task.

url
(string) The URL of the new task.

standard
(string) The accessibility standard to test the URL against. One of Section508, WCAG2A, WCAG2AA, WCAG2AAA.

ignore
(array) optional A list of rules which can be safely ignored by the reporter.

timeout
(number) optional The time (in milliseconds) to allow for the tests to run for before failing.

wait
(number) optional A time (in milliseconds) to wait before running the tests after the page has loaded.

username
(string) optional A username to use if the page is behind basic auth.

password
(string) optional A password to use if the page is behind basic auth.

hideElements
(string) optional A list of CSS selectors. Matching elements will be ignored in the test run.

headers
(object) optional A key/value map of HTTP headers to send to the page being tested.

The response status will be 201 if the task was created successfully. The response body will contain a JSON representation of the newly created task. The Location header will point to the task's endpoint.

GET /tasks

Get all of the tasks in the application.

The following (optional) query string parameters can be used to manipulate results:

lastres
(boolean) Whether to include the last_result property in the output. Defaults to false.

The response status will be 200 if tasks could be retrieved, and the response body will contain a JSON array of task objects.

GET /tasks/results

Get results for all of the tasks in the application.

The following (optional) query string parameters can be used to filter and manipulate results:

from
(date-string) The earliest recorded results to retrieve. Defaults to 30 days ago.

to
(date-string) The latest recorded results to retrieve. Defaults to now.

full
(boolean) Whether to include full results in the response. If this is not present, then only error/warning/notice counts will be included. Defaults to false.

The response status will be 200 if results could be retrieved, and the response body will contain a JSON array of result objects.

GET /tasks/{id}

Get a single task by ID.

The following (optional) query string parameters can be used to manipulate results:

lastres
(boolean) Whether to include the last_result property in the output. Defaults to false.

The response status will be 200 if the task was found, and the response body will contain a JSON representation of the task.

PATCH /tasks/{id}

Edit a task by ID.

Request body must be a JSON object representing edits to the task. It should have the following properties:

name
(string) The name of the task. This will replace the existing name.

ignore
(array) optional A list of rules which can be safely ignored by the reporter. This will replace the existing ignore rules entirely.

timeout
(number) optional The time (in milliseconds) to allow for the tests to run for before failing.

wait
(number) optional A time (in milliseconds) to wait before running the tests after the page has loaded.

username
(string) optional A username to use if the page is behind basic auth.

password
(string) optional A password to use if the page is behind basic auth.

hideElements
(string) optional A list of CSS selectors. Matching elements will be ignored in the test run.

headers
(object) optional A key/value map of HTTP headers to send to the page being tested.

comment
(string) optional A comment indicating what was changed in this edit. This appears in the task's annotations.

The response status will be 200 if the task was updated successfully. The response body will contain a JSON representation of the task with updates in place.

DELETE /tasks/{id}

Delete a task by ID.

The response status will be 204 if the task was deleted.

POST /tasks/{id}/run

Run a task by ID, generating new results.

The response status will be 202, as the task gets run in the background.

GET /tasks/{id}/results

Get results for a single task by ID.

The following (optional) query string parameters can be used to filter and manipulate results:

from
(date-string) The earliest recorded results to retrieve. Defaults to 30 days ago.

to
(date-string) The latest recorded results to retrieve. Defaults to now.

full
(boolean) Whether to include full results in the response. If this is not present, then only error/warning/notice counts will be included. Defaults to false.

The response status will be 200 if results could be retrieved, and the response body will contain a JSON array of result objects.

GET /tasks/{id}/results/{id}

Get a single result by ID.

The following (optional) query string parameters can be used to manipulate the output:

full
(boolean) Whether to include full results in the response. If this is not present, then only error/warning/notice counts will be included. Defaults to false.

The response status will be 200 if the result was found, and the response body will contain a JSON representation of the result.