Get several results in one request
/v1/resultsRuns several results queries in one request, such as a website's scores, the trend of one score, its checks and one check in detail. The answer is the same as calling each one on its own.
Where each argument goes#
The website goes at the top level, once: websiteId and sectionId (or
view, for Analytics) apply to every query. Everything else a query takes,
including period, goes in that query's options. A period at the top
level is ignored, and so is a websiteId inside options.
Use the argument names on each query's own page. Older documentation sent
score to the score trend; the name is scoreId, and without it that entry
fails.
One failure does not stop the rest#
The request answers 200 even when some of its queries fail. A query that
fails, because an option is missing or wrong, the query name is unknown, or no
website was sent, has an error in place of result, and the others still
answer. Check each entry for error before you read its result. Its
status is what the query would have answered on its own; some mistakes in
your request, such as a missing option, come back as 500 there.
selector is the name you sent, such as score-trend, not the path that a
single query returns.
A query for one edition of Silktide, such as the
Silktide 4 scores, fails with
EditionNotAvailable when the account does not have that edition. The others
still answer. See Scores.
Two mistakes fail the whole request: a website the API key cannot see
(404), and a results that is missing, empty or not an object (400). An
entry in results that is not an object, such as a bare query name, fails on
its own with InvalidRequest.
curl -X POST "https://api.eu.silktide.com/v1/results" \
-H "Authorization: silktide token=$SILKTIDE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"websiteId": 2,
"sectionId": 0,
"results": {
"overall-trend": {
"result": "score-trend",
"options": {
"scoreId": "overall",
"period": "last-90-days"
}
},
"accessibility-trend": {
"result": "score-trend",
"options": {
"scoreId": "wcag-22-aa",
"period": "last-90-days"
}
},
"no-score": {
"result": "score-trend"
}
}
}'{
"results": {
"overall-trend": {
"result": {
"scores": [
{
"time": 1790216531,
"score": 71.2
},
{
"time": 1790821331,
"score": 74.5
}
]
},
"selector": "score-trend",
"duration": 0.004
},
"accessibility-trend": {
"result": {
"scores": [
{
"time": 1790216531,
"score": 58.9
},
{
"time": 1790821331,
"score": 63
}
]
},
"selector": "score-trend",
"duration": 0.003
},
"no-score": {
"error": {
"type": "InvalidArgument",
"message": "An unspecified error occurred",
"properties": [],
"status": 500
}
}
}
}Request
Body
JSON, sent with Content-Type: application/json.
websiteIdintegerat least 1The website every query is about. Governance queries need it.
sectionIdintegerA section of the website, for every query. Defaults to
0, the whole website.viewstringmatches^(all|[1-9]\d*)$For Analytics queries, the analytics view to read, or
all. Send this orwebsiteId.resultsmap of objectsrequiredThe queries to run, each under a key of your choosing. The answer uses the same keys.
Show 2 fieldsHide fields
resultstringrequiredThe query: the part of its path after
/v1/results/, such asscoresorscore-trend.optionsmap of any JSONEvery other argument the query takes, such as
scoreIdorperiod, by the names on its own page. Left out, none.
Response
200JSON.
resultsmap of objectsrequiredEach query's answer or failure, under the key you gave it.
Show 4 fieldsHide fields
resultmap of any JSON or list of any JSONThe query's answer, the same as the
resultits own page describes. Absent when it failed.selectorstringThe query's id, as you sent it in
result, such asscore-trend. Absent when it failed.durationnumberSeconds Silktide took to answer it. Absent when it failed.
errorobjectWhy the query failed, in place of
result. Present only when it failed.Show 4 fieldsHide fields
typestringrequiredWhat went wrong, such as
InvalidArgument(a missing or bad option),NotFound(no query by that name),InvalidRequest(an entry that is not an object),EditionNotAvailable(a query for the edition of Silktide the account does not have),InvalidContext(no website) orSelectorNotSpecified(noresult).messagestringrequiredA readable explanation. It can change; never match on it.
propertiesmap of any JSON or empty listDetails of the error, when it has any. An empty array when it has none. Absent for
SelectorNotSpecified.statusintegerThe HTTP status this failure would have had on its own. Absent for
SelectorNotSpecified.
Errors
| Status | Type | When |
|---|---|---|
| 404 | ModelNotFound | No website or section with that id exists in the account, or the API key's user cannot see it. |
| 400 | InvalidRequest | results is missing, empty or not an object. |
| 401 | NotLoggedIn | No API key was sent, or it is not a key for this region.(any operation) |
| 429 | TooManyRequests | Too many requests to this path in five seconds. Retry after the number of seconds in the Retry-After header, which properties.retryAfter repeats.(any operation) |
| 503 | - | Silktide is busy. Retry after the number of seconds in the Retry-After header.(any operation) |
Every error has the same body. See Errors.
Access
- Permission
- Any user of the account
- Plan feature
- None
- Edition
- Silktide 4 and Silktide 5
- Cost
- Free
- Available since
- v1.0.0
Try it
Sends a real request to your account from this browser. Your key stays in this tab and goes only to the Silktide API.