← back to Dw Signup Fulfillment
create-kelly-customer.sh
15 lines
#!/usr/bin/env bash
# Step 1 for TK-10830 — create Kelly's Shopify customer (fulfillment token has write_customers).
# Run as Steve: ! bash ~/Projects/dw-signup-fulfillment/create-kelly-customer.sh
set -euo pipefail
DIR="$HOME/Projects/dw-signup-fulfillment"
FT="$(grep -E '^SHOPIFY_FULFILLMENT_TOKEN=' "$HOME/Projects/secrets-manager/.env" | cut -d= -f2-)"
SHOP="designer-laboratory-sandbox.myshopify.com"
resp="$(curl -s -X POST "https://$SHOP/admin/api/2024-10/customers.json" \
-H "X-Shopify-Access-Token: $FT" \
-H "Content-Type: application/json" \
--data @"$DIR/kelly-customer.json")"
echo "$resp" | python3 -c "import sys,json
d=json.load(sys.stdin); c=d.get('customer')
print('CREATED customer id =', c['id'], '| tags:', c.get('tags')) if c else print('FAIL:', json.dumps(d.get('errors', d))[:400])"