Skip to content

Instantly share code, notes, and snippets.

@cosenal
Last active August 29, 2015 14:15
Show Gist options
  • Save cosenal/88e78f455df2231e1103 to your computer and use it in GitHub Desktop.
Save cosenal/88e78f455df2231e1103 to your computer and use it in GitHub Desktop.
unstar all items at once
#!/usr/bin/env python
import requests
url = 'https://example.com/index.php/apps/news/api/v1-2/items'
username = 'user';
password = 'pass';
paramsAllStarred = {
'batchSize': -1,
'type': 2,
'id': 0,
'getRead': 'true'
}
r = requests.get(url, auth=(username, password), params=paramsAllStarred)
if r.status_code == 200:
allStarredItems = r.text
r = requests.put(url + '/unstar/multiple', auth=(username, password),
data=allStarredItems, headers={'Content-Type': 'application/json'})
if r.status_code == 200:
print('Done!')
else:
print('Error')
else:
print('Error')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment