curl Recipes
Collection of curl commands for common API operations. Set your variables first:
BASE_URL="https://staging.api.ecourtdate.com"
CLIENT_ID="your_client_id"
CLIENT_SECRET="your_client_secret"
Get Access Token
TOKEN=$(curl -s -X POST "$BASE_URL/oauth/token" \
-H "Content-Type: application/json" \
-d "{\"client_id\":\"$CLIENT_ID\",\"client_secret\":\"$CLIENT_SECRET\",\"grant_type\":\"client_credentials\"}" \
| jq -r '.access_token')
Send a Message
curl -X POST "$BASE_URL/v1/messages/oneoffs" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+15551234567",
"subject": "Court Reminder",
"content": "Your hearing is scheduled for tomorrow at 9:00 AM."
}'
Create a Client
curl -X POST "$BASE_URL/v1/clients" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Jane",
"last_name": "Doe",
"phone": "+15551234567",
"email": "jane.doe@example.com",
"client_reference": "CLIENT-12345"
}'
Create an Event
curl -X POST "$BASE_URL/v1/events" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"client": "{client_uuid}",
"event_reference": "EVENT-12345",
"date": "2024-03-15",
"time": "09:00",
"type": "hearing",
"description": "Initial hearing"
}'
Search Clients
curl "$BASE_URL/v1/clients?client_reference=CLIENT-12345" \
-H "Authorization: Bearer $TOKEN"
Search Events
curl "$BASE_URL/v1/events?event_reference=EVENT-12345" \
-H "Authorization: Bearer $TOKEN"
Bulk Send (up to 100)
curl -X POST "$BASE_URL/v1/messages/bulks" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"to": "+15551111111", "content": "Reminder 1"},
{"to": "+15552222222", "content": "Reminder 2"}
]
}'