IQSS / dataverse

Open source research data repository software

Home Page:http://dataverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bulk clear notifications

mankoff opened this issue · comments

Is there an API call to clear all notifications? I do not have the time or thumb muscles to click my mouse 418 times.

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? 😄

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