Created
July 2, 2018 10:34
-
-
Save leplatrem/b67c3465321d61aa05e3f07f8f3ca05a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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