blob: 60b72dfde4d5fe4f59349537f509afc4248a8090 [file] [log] [blame]
#!/bin/bash
# Create a single named SVG scrap @smiley that is a smiley face.
#
# The scrapexchange server should be running locally, such as:
#
# $ make start-local-server
#
# Or the production protected endpoint can be forwarded to localhost:
#
# $ kubectl port-forward service/scrapexchange 9000
#
# Create a scrap.
HASH=`curl --silent --data @./smile-svg-scrap.json -H 'Content-Type: application/json' http://localhost:9000/_/scraps/ | jq -r '.Hash'`
printf "Hash: ${HASH}\n"
# Create a name for the scrap.
curl --silent -X PUT -d "{\"Hash\": \"${HASH}\", \"Description\": \"Smiley Face\"}" -H 'Content-Type: application/json' http://localhost:9000/_/names/svg/@smiley
# List all named scraps.
curl --silent http://localhost:9000/_/names/svg/