#!/bin/bash

if [ "$#" -eq 1 ]; then
    curl -s -XPOST \
            -H "Authorization: Bearer $1" \
            -F 'REQUEST=doQuery' \
            -F 'LANG=ADQL' \
            -F 'FORMAT=text/csv' \
            -F 'PHASE=RUN' \
            -F "QUERY=SELECT * from demo.private_rows;" \
            http://localhost:8080/tap/sync
else
    curl -s -XPOST \
            -F 'REQUEST=doQuery' \
            -F 'LANG=ADQL' \
            -F 'FORMAT=text/csv' \
            -F 'PHASE=RUN' \
            -F "QUERY=SELECT * from demo.private_rows;" \
            http://localhost:8080/tap/sync
fi
