Skip to content

List account events and mark them seen

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

This page has 2 commands: List or search account events (POST /v2/account/events/search) and Mark account event(s) as seen (POST /v2/account/events/seen). List all events triggered for account. Each call needs a bearer token and counts towards your hourly API limit. Below are the parameters, sample code in 9 languages and a sample answer.

After reading this you will know

  • How to list account events and mark them seen
  • Which parameters each of the 2 commands takes
  • Sample code in 9 languages and a sample answer

Every command on this page needs a bearer token and counts towards your hourly limit.

POSThttps://api.sirv.com/v2/account/events/search

List all events triggered for account.

Request body (JSON)

FieldTypeRequiredExampleDescription
modulestringNofetchingOnly events from this part of Sirv, for example fetching.
typestringNoOnly events of this type.
filenamestringNo/REST API Examples/aurora.jpgOnly events about this file.
levelstringNoerrorOne of: error, warn, info.
seenbooleanNofalseFilter seen/unseen events

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/events/search', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify({
"module": "fetching"
}),
});
console.log(res.status, await res.text());

Example response

[
{
"module": "fetching",
"type": "http",
"level": "error",
"filename": "/REST API Examples/missing.jpg",
"fetching": {
"url": "https://demo.sirv.com/missing.jpg",
"statusCode": 404,
"maxFilesize": 2097152,
"contentLength": "4140",
"error": "Request not successful: expected status code 200 but got 404"
},
"initiator": {
"type": "api",
"remoteAddr": "176.105.166.4",
"date": "2020-07-18T11:31:32.229Z"
},
"notify": true,
"_seen": false,
"_submitted": "2020-07-18T11:31:32.612Z",
"_accountId": "sdulth0oi0t9zxpxqtxwkwvgipjgv6ud",
"_id": "8fbb11a7dd77f7f64337e581ccbce2d62fc7cda0"
}
]
POSThttps://api.sirv.com/v2/account/events/seen

Add seen flag for specified account event(s).

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/account/events/seen', {
method: 'POST',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}`, 'content-type': 'application/json' },
body: JSON.stringify([
"f1f5d68ef232e5d27d10f28bcef836efbb7cdeba",
"199cf48046964f8567fe49e22107c4c5d27271e7"
]),
});
console.log(res.status, await res.text());

Response

HTTP 200 with an empty body when the command succeeds.

Back to top