Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SERVER=https://kinto.dev.mozaws.net/v1
BUCKET=main
COLLECTION=public-suffix-list
RECORD=b719eacd-96ed-4979-bfd8-538fd39d9c05 # uuidgen
echo
echo "Create user"
curl -X PUT ${SERVER}/accounts/psl \
-H 'Content-Type:application/json' \
-d '{"data": {"password": "psl-secret"}}' \
-u psl:psl-secret
echo
echo "Create collection"
curl -X PUT ${SERVER}/buckets/${BUCKET}/collections/${COLLECTION} \
-H 'Content-Type:application/json' \
-u psl:psl-secret
echo
echo "Create record with attachment"
curl -X POST ${SERVER}/buckets/${BUCKET}/collections/${COLLECTION}/records/${RECORD}/attachment \
-H 'Content-Type:multipart/form-data' \
-F 'data={"property": 42}' \
-F 'attachment=@/home/mathieu/DAFSA.bin' \
-u psl:psl-secret
base_url=`curl -s {$SERVER}/ | jq .capabilities.attachments.base_url`
echo
echo "Base URL for attachments is ${base_url}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.