github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/clients/curl/example.sh (about) 1 #!/bin/bash 2 3 # Example client accesses to blob server using curl. 4 5 # Configuration variables here: 6 BSHOST=localhost:3179/bs 7 BSUSER=user 8 BSPASS=foo 9 10 # Shorter name for curl auth param: 11 AUTH=$BSUSER:$BSPASS 12 13 # Stat -- 200 response 14 curl -u $AUTH -d camliversion=1 http://$BSHOST/camli/stat 15 16 # Upload -- 200 response 17 curl -u $AUTH -v -L \ 18 -F sha1-126249fd8c18cbb5312a5705746a2af87fba9538=@./test_data.txt \ 19 #<the url returned by stat> 20 21 # Put with bad blob_ref parameter -- 400 response 22 curl -v -L \ 23 -F sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f=@./test_data.txt \ 24 #<the url returned by stat> 25 26 # Get present -- the blob 27 curl -u $AUTH -v http://$BSHOST/camli/sha1-126249fd8c18cbb5312a5705746a2af87fba9538 28 29 # Get missing -- 404 30 curl -u $AUTH -v http://$BSHOST/camli/sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f 31 32 # Check present -- 200 with only headers 33 curl -u $AUTH -I http://$BSHOST/camli/sha1-126249fd8c18cbb5312a5705746a2af87fba9538 34 35 # Check missing -- 404 with empty list response 36 curl -I http://$BSHOST/camli/sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f 37 38 # List -- 200 with list of blobs (just one) 39 curl -v -u $AUTH http://$BSHOST/camli/enumerate-blobs?limit=1 40 41 # List offset -- 200 with list of no blobs 42 curl -v -u $AUTH http://$BSHOST/camli/enumerate-blobs?after=sha1-126249fd8c18cbb5312a5705746a2af87fba9538