Bulk clear notifications
mankoff opened this issue · comments
Ken Mankoff commented
Is there an API call to clear all notifications? I do not have the time or thumb muscles to click my mouse 418 times.
Philip Durbin commented
I think you'll have to get them all with https://guides.dataverse.org/en/6.2/api/native-api.html#get-all-notifications-by-user
And then delete them one by one with https://guides.dataverse.org/en/6.2/api/native-api.html#delete-notification-by-user
I take it you'd like a single API for this? 😄
Philip Durbin commented
Ken Mankoff commented
Thanks. A for loop is close enough to bulk
for me:
curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/notifications/all" > ~/tmp/dv.json
for id in $(cat ~/tmp/dv.json | jq | grep "id\":" | tr -cd '[[:digit:]]\n'); do
curl -H "X-Dataverse-key:$API_TOKEN" -X DELETE "$SERVER_URL/api/notifications/${id}"
done