-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_form_ids.py
More file actions
70 lines (56 loc) · 2.66 KB
/
Copy pathdebug_form_ids.py
File metadata and controls
70 lines (56 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
"""
Test script to check forms by ID range and see if there are forms beyond what the list API returns.
"""
import requests
import json
import os
from dotenv import load_dotenv
load_dotenv()
def test_form_ids():
"""Test accessing forms by ID to see if there are forms not returned by the list API."""
api_key = os.getenv("FORMSTACK_API_KEY")
headers = {"Authorization": f"Bearer {api_key}"}
base_url = "https://www.formstack.com/api/v2"
# We know the list API returns forms up to 6233112, let's test some IDs beyond that
test_ids = [
6233111, # We know this exists
6233112, # This is the highest ID from the list
6233113, 6233114, 6233115, 6233120, 6233130, 6233150, # Test some higher IDs
6240000, 6250000, 6300000, 6500000, # Test much higher IDs
7000000, 7500000, 8000000 # Test very high IDs to see if they exist
]
existing_forms = []
print("Testing individual form IDs to see if there are forms beyond the list API...")
for form_id in test_ids:
try:
url = f"{base_url}/form/{form_id}.json"
response = requests.get(url, headers=headers)
if response.status_code == 200:
form_data = response.json()
existing_forms.append({
'id': form_id,
'name': form_data.get('name', 'Unknown'),
'created': form_data.get('created', 'Unknown'),
'inactive': form_data.get('inactive', False)
})
print(f"✅ Form {form_id}: EXISTS - {form_data.get('name', 'Unknown')} (created: {form_data.get('created', 'Unknown')}, inactive: {form_data.get('inactive', False)})")
elif response.status_code == 404:
print(f"❌ Form {form_id}: NOT FOUND")
else:
print(f"⚠️ Form {form_id}: ERROR {response.status_code}")
except Exception as e:
print(f"⚠️ Form {form_id}: ERROR - {e}")
print(f"\n{'='*60}")
print(f"SUMMARY")
print(f"{'='*60}")
print(f"Found {len(existing_forms)} existing forms by direct ID access")
if existing_forms:
print(f"ID range: {min(f['id'] for f in existing_forms)} to {max(f['id'] for f in existing_forms)}")
inactive_count = sum(1 for f in existing_forms if f['inactive'])
print(f"Inactive forms found: {inactive_count}")
print(f"\nExisting forms:")
for form in existing_forms:
print(f" ID {form['id']}: {form['name']} (inactive: {form['inactive']})")
if __name__ == "__main__":
test_form_ids()