Alerts
Alerts can be created by users on datasets. These alerts can then be used to inform users of information related to that dataset.
Requests
- Initialise an alert on a dataset
- Create an alert on a dataset
- View alerts on a dataset
- View an alert
Initialise an alert on a dataset
POST
datasets/{dataset-id}/alerts
Initialises a new alert on a dataset.
Prerequisites
- The authenticated user must own a Matatika account
Request
Example Snippets
cURL
curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts' -i -X POST \
-H 'Accept: application/json, application/javascript, text/javascript, text/json' \
-H 'Content-Type: application/json'
Python (requests
)
import requests
url = "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("POST", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"id" : "a2786a02-c9da-4f43-ac2a-2dbcd1034e14",
"created" : "2024-12-16T09:59:16.402258912",
"lastModified" : "2024-12-16T09:59:16.402260812",
"_links" : {
"create alert" : {
"href" : "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts/a2786a02-c9da-4f43-ac2a-2dbcd1034e14"
}
}
}
Create an alert on a dataset
PUT
datasets/{dataset-id}/alerts/{alert-id}
Create a new alert on a dataset.
Prerequisites
- The authenticated user must own a Matatika account
Request
Example Snippets
cURL
curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts/a2786a02-c9da-4f43-ac2a-2dbcd1034e14' -i -X PUT \
-H 'Accept: application/json, application/javascript, text/javascript, text/json' \
-H 'Content-Type: application/json' \
-d '{
"detail" : "New dataset alert"
}'
Python (requests
)
import requests
url = "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts/a2786a02-c9da-4f43-ac2a-2dbcd1034e14"
data = {
"detail" : "New dataset alert"
}
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("PUT", url, headers=headers, data=data)
print(response.text.encode('utf8'))
Response
201 Created
{
"id" : "a2786a02-c9da-4f43-ac2a-2dbcd1034e14",
"created" : "2024-12-16T09:59:16.595708805",
"lastModified" : "2024-12-16T09:59:16.595709105",
"raised" : "2024-12-16T09:59:16.595708805",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09"
}
}
}
View alerts on a dataset
GET
datasets/{dataset-id}/alerts
View alerts on a dataset.
Prerequisites
- The authenticated user must own a Matatika account
Request
Example Snippets
cURL
curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts' -i -X GET \
-H 'Accept: application/json, application/javascript, text/javascript, text/json' \
-H 'Content-Type: application/json'
Python (requests
)
import requests
url = "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("GET", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"_embedded" : {
"alerts" : [ {
"id" : "a2786a02-c9da-4f43-ac2a-2dbcd1034e14",
"created" : "2024-12-16T09:59:16.595709",
"lastModified" : "2024-12-16T09:59:16.595709",
"raised" : "2024-12-16T09:59:16.595709",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09/alerts?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}
View an alert
GET
alerts/{alert-id}
View an alert.
Prerequisites
- The authenticated user must own a Matatika account
Request
Example Snippets
cURL
curl -H "Authorization: Bearer $ACCESS_TOKEN" 'https://app.matatika.com/api/alerts/a2786a02-c9da-4f43-ac2a-2dbcd1034e14' -i -X GET \
-H 'Accept: application/json, application/javascript, text/javascript, text/json' \
-H 'Content-Type: application/json'
Python (requests
)
import requests
url = "https://app.matatika.com/api/alerts/a2786a02-c9da-4f43-ac2a-2dbcd1034e14"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("GET", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"id" : "a2786a02-c9da-4f43-ac2a-2dbcd1034e14",
"created" : "2024-12-16T09:59:16.595709",
"lastModified" : "2024-12-16T09:59:16.595709",
"raised" : "2024-12-16T09:59:16.595709",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/0fdf2129-1629-407d-9944-afaa0b013d09"
}
}
}