dragonxi
- Get the list of notices with the notice/all API method.
- Cycle through that list and call the notice/delete API method on each item.
import requests
# create an API token at https://my.opalstack.com/tokens
# then use that token value in the next line
OPAL_TOKEN = 'XXXXXXXX'
OPAL_HEADERS = {
'Authorization': f'Token {OPAL_TOKEN}',
'Content-Type':'application/json'
}
notices = requests.get('https://my.opalstack.com/api/v0/notice/all/',
headers=OPAL_HEADERS).json()
for notice in notices['notices']:
requests.get(f'https://my.opalstack.com/api/v0/notice/delete/{notice["id"]}',
headers=OPAL_HEADERS)
API methods are documented here: https://my.opalstack.com/api/v0/doc/