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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/alerts"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("POST", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"id" : "077390ca-8d86-4e14-adfd-1da1a5cfba73",
"created" : "2024-12-09T14:09:49.857707565",
"lastModified" : "2024-12-09T14:09:49.857709865",
"_links" : {
"create alert" : {
"href" : "https://app.matatika.com/api/datasets/60158f21-30bc-4e05-b72d-8713a1a6d0e4/alerts/077390ca-8d86-4e14-adfd-1da1a5cfba73"
}
}
}
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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/alerts/077390ca-8d86-4e14-adfd-1da1a5cfba73' -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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/alerts/077390ca-8d86-4e14-adfd-1da1a5cfba73"
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" : "077390ca-8d86-4e14-adfd-1da1a5cfba73",
"created" : "2024-12-09T14:09:50.030866199",
"lastModified" : "2024-12-09T14:09:50.030866599",
"raised" : "2024-12-09T14:09:50.030866199",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/60158f21-30bc-4e05-b72d-8713a1a6d0e4"
}
}
}
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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/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/60158f21-30bc-4e05-b72d-8713a1a6d0e4/alerts"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("GET", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"_embedded" : {
"alerts" : [ {
"id" : "077390ca-8d86-4e14-adfd-1da1a5cfba73",
"created" : "2024-12-09T14:09:50.030866",
"lastModified" : "2024-12-09T14:09:50.030867",
"raised" : "2024-12-09T14:09:50.030866",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/60158f21-30bc-4e05-b72d-8713a1a6d0e4"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "https://app.matatika.com/api/datasets/60158f21-30bc-4e05-b72d-8713a1a6d0e4/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/077390ca-8d86-4e14-adfd-1da1a5cfba73' -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/077390ca-8d86-4e14-adfd-1da1a5cfba73"
headers = {
'Authorization': ACCESS_TOKEN
}
response = requests.request("GET", url, headers=headers)
print(response.text.encode('utf8'))
Response
200 OK
{
"id" : "077390ca-8d86-4e14-adfd-1da1a5cfba73",
"created" : "2024-12-09T14:09:50.030866",
"lastModified" : "2024-12-09T14:09:50.030867",
"raised" : "2024-12-09T14:09:50.030866",
"detail" : "New dataset alert",
"_links" : {
"dataset" : {
"href" : "https://app.matatika.com/api/datasets/60158f21-30bc-4e05-b72d-8713a1a6d0e4"
}
}
}