Last active
November 9, 2015 16:30
-
-
Save bmcbride/9536259 to your computer and use it in GitHub Desktop.
Delete all records in a particular app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from fulcrum import Fulcrum | |
api_key = 'your-api-key' | |
form_id = 'your-form-id' | |
if api_key == '' or api_key == 'your-api-key' or form_id == '' or form_id == 'your-form-id': | |
sys.exit('api_key and form_id are required!') | |
fulcrum = Fulcrum(key=api_key) | |
form = fulcrum.forms.find(form_id) | |
form_name = form['form']['name'] | |
records = fulcrum.records.search(url_params={'form_id': form_id}) | |
total_count = str(records['total_count']) | |
confirm = raw_input('Are you absolutely sure you want to permenantly delete all ' + total_count + ' records from the ' + form_name + ' app? (y)es or (n)o: ') | |
if confirm == 'yes' or confirm == 'y': | |
for record in records['records']: | |
#print record['id'] | |
fulcrum.records.delete(record['id']) | |
print 'Permenantly deleted ' + total_count + ' records!' | |
elif confirm == 'no' or confirm == 'n': | |
print 'No records have been deleted!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment