Add a website and read its scores
Check your balance, create a website, wait for its first test, then read its scores.
This guide adds a website to Governance and reads its scores once Silktide has tested it. It uses four operations, in this order.
1. Check what you can add#
Pages and documents you give a website come out of your account's balance. Ask how much is left:
curl https://api.eu.silktide.com/v1/balances \
-H "Authorization: silktide token=$SILKTIDE_API_KEY"newWebsites is how many more websites you can add, and maxPages and maxDocuments are the most pages and PDFs a new website could be given now. -1 means unlimited. See Get what the account can still add.
2. Create the website#
Send its name and home page, and always say how many pages and documents to test. Left out, Silktide picks an allocation for you.
curl https://api.eu.silktide.com/v1/websites \
-H "Authorization: silktide token=$SILKTIDE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"website": {
"name": "Fake University",
"homeUrl": "https://fake-university.example/",
"maxPages": 100,
"maxDocuments": 100
}
}'The response is the new website. Keep its websiteId. Silktide starts testing it straight away.
To change settings before the first test, create it with "runNow": false and "isReady": false, update it, then test it when you are ready. See Set up a website before its first test.
3. Wait for the first test#
A test takes from a few minutes to a few hours, depending on the size of the website. There is no callback yet, so check the website now and then:
curl https://api.eu.silktide.com/v1/websites/6 \
-H "Authorization: silktide token=$SILKTIDE_API_KEY"website.lastTested is 0 until the first test finishes, and then the time it finished. Checking every few minutes is plenty; checking every second only spends your rate limit.
4. Read the scores#
curl "https://api.eu.silktide.com/v1/results/scores?websiteId=6" \
-H "Authorization: silktide token=$SILKTIDE_API_KEY"{
"result": {
"scores": {
"overall": 80.8,
"content": 70.1,
"wcag-22-aa": 97.8,
"wcag-22-pdf": null
}
},
"selector": "/v1/results/scores",
"duration": 0.009
}Scores are out of 100. A score Silktide cannot work out for this website, such as PDF accessibility on a website with no PDFs, is null. Results queries report some errors with status 200 and an error body, so check for error before you read result; see Results.
Where to go next#
- Get how a score changed over time, for charts and alerts.
- List a website's checks, to see what to fix.
- Update a website, to change its schedule or allocation.