Skip to content

Instantly share code, notes, and snippets.

@norcalli
Created May 21, 2016 00:20
Show Gist options
  • Save norcalli/2271d35ccf9db962ba05ac3291c6acc1 to your computer and use it in GitHub Desktop.
Save norcalli/2271d35ccf9db962ba05ac3291c6acc1 to your computer and use it in GitHub Desktop.
Get query object for leapfin
#!/bin/bash
test -z "$1" -o -z "$2" && {
echo "Usage: $0 <client_no> <auth_key>" >&2
exit 1
}
CLIENT_NO="$1"
AUTH_KEY="$2"
echo "Thank you for flying with Leap Financial today. Hopefully there's no turbulence today."
mkdir leapfin
cd leapfin
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_account_details
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="acct_no IS NOT NULL ORDER BY acct_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_account_details" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "acct_no IS NOT NULL ORDER BY acct_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > account_details.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_account_plan_history
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="acct_no IS NOT NULL ORDER BY acct_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_account_plan_history" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "acct_no IS NOT NULL ORDER BY acct_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > account_plan_history.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_all_invoice_information
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="invoice_no IS NOT NULL ORDER BY invoice_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_all_invoice_information" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "invoice_no IS NOT NULL ORDER BY invoice_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > all_invoice_information.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_coupon_history
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="acct_no IS NOT NULL ORDER BY coupon_cd DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_coupon_history" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "acct_no IS NOT NULL ORDER BY coupon_cd DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > coupon_history.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_order_details
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="order_no IS NOT NULL ORDER BY order_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_order_details" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "order_no IS NOT NULL ORDER BY order_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > order_details.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_payment_details
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="payment_id IS NOT NULL ORDER BY payment_id DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_payment_details" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "payment_id IS NOT NULL ORDER BY payment_id DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > payment_details.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_refund_information
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="aria_event_no IS NOT NULL ORDER BY aria_event_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_refund_information" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "aria_event_no IS NOT NULL ORDER BY aria_event_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > refund_information.json
echo
cat <<EOF
POST https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_transaction_information
client_no="$CLIENT_NO"
auth_key="$AUTH_KEY"
query_string="aria_event_no IS NOT NULL ORDER BY aria_event_no DESC"
limit=7000
offset=0
EOF
for ((i=0; i < 70; i++)); do
curl -H "Content-Type: application/json" -X POST "https://secure.ariasystems.net/api/AriaQuery/objects.php?output_format=json&rest_call=get_transaction_information" -d '{ "client_no": "'"$CLIENT_NO"'", "auth_key": "'"$AUTH_KEY"'", "query_string": "aria_event_no IS NOT NULL ORDER BY aria_event_no DESC", "limit": 100, "offset": '$((i*100))' }'
echo
done > transaction_information.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment