Skip to content

Instantly share code, notes, and snippets.

@bmcbride
Last active November 9, 2015 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmcbride/9536259 to your computer and use it in GitHub Desktop.
Save bmcbride/9536259 to your computer and use it in GitHub Desktop.
Delete all records in a particular app.
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