Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

Medley Curl Testbench

This is a suite of code snippets for exercising app URLs with curl.

Bucketpull

Download files from a storage bucket.

POST

curl -i -d "service=gcp" "$host/bucketpull"

Countries

GET

Download the latest dataset and store in registry.

curl -i "$host/countries"

Geodb

HEAD

curl -I "$host/geodb"

POST

curl -i -d "action=update" "$host/geodb"

Headers

GET

Display the headers of the request.

curl "$host/headers"
curl -H "Accept: $json" "$host/headers" | jq .
curl -H "Accept: $text" "$host/headers"

Homepage

GET

Display a list of applications

curl "$host/"
curl -H "Accept: $org" "$host"
curl -H "Accept: $org" "$host/all"

HEAD

Client-side caching is done via ETags.

curl -i -I "$host/"
curl -i -I -H "If-None-Match: e3e5f241ef61db2c61aa327dc1c0394c" "$host/"

Lintable

GET

Ask the server to compare the current hash of a file to the last stored value. Returns “yes” if the file should be linted or “no” if it should not. The file path is provided on the URL and should be relative to the application root.

curl -H "Accept: $json" "$host/lintable/apps/lintable/main.py"

PUT

Ask the server to store the current hash of a file. Same setup as for GET: the file path is provided on the URL.

curl -i -X PUT -d" " "$host/lintable/apps/lintable/main.py"

Logindex

POST bucket

Ask the server to ingest an hourly log file downloaded from a GCP storage bucket.

DATE=$(date +"%Y/%m/%d")
FILE="appengine.googleapis.com/request_log/$DATE/01:00:00_01:59:59_S0.json"
curl -i -d "path=$FILE" "$host/logindex/bucket/gcp/appengine"

POST date

Ask the server to ingest one or more log files by date.

YESTERDAY=$(date --date yesterday +"%Y-%m-%d")
TODAY=$(date +"%Y-%m-%d")
curl -i -d "start=$YESTERDAY" -d "end=$TODAY" "$host/logindex"

Maintenance

POST

Start maintenance tasks.

curl -i -d "group=db" "$host/maintenance"

Notification

POST

Recipes

DELETE

Mark a recipe for deletion.

curl -i -X DELETE "$host/recipes/1"

GET

Retrieve a single recipe, a list of a recipes with a given tag, or a list of tags.

curl -i "$host/recipes/1"
curl -i "$host/recipes/tag/one"

POST

Store a new recipe in the database or update an existing recipe.

curl -i -d "title=My recipe" -d "url=http://example.com" -d "body=hello world" -d "tags=one,two,three" "$host/recipes"
curl -i -X PUT -d "title=Edited title" -d "url=http://example.com" -d "body=Edited body" -d "tags=one,nine,eight"  "$host/recipes/1"

Redirect

GET

curl -i "$host/redirect"
curl -i "$host/redirect?u=http://example.com"
curl -i "$host/redirect?u=http%3A%2F%2Fexample.com"

Registry

DELETE

Delete a row from the registry

curl -i -X DELETE "$host/registry/1"

GET

Key groups

Retrieve a list of key groups.

curl -i "$host/registry"
curl -i -H "Accept: $json" "$host/registry"

Search

Search for records by key.

curl -i "$host/registry?q=config"
curl -H "Accept: $json" "$host/registry?q=config"

POST

Create

curl -i -d "key=test" -d "value=text" "$host/registry"

Update

curl -i -d "key=test UPDATED" -d "value=test UPDATED"  "$host/registry/1728"

Speak

GET

Display the current mute status.

curl -i "$host/speak"

POST

Submit text to be spoken by the server.

curl -i -d "statement=hello world" -d "name=en-IN-NeerjaNeural" -d "locale=en-IN" -d "gender=Female" "$host/speak"
curl -i -d "statement=hello world" -d "confirm=1N" "$host/speak"
curl -i -d "statement=hello world" -d "action=toggle" "$host/speak"
{
  "deliveryStyle": "normal",
  "body": "",
  "localId": "test",
  "title": "📦 test 📦",
  "group": "",
  "source": "",
  "url": "http://example.com",
  "publicId": "abcde123",
  "badge": ""
}
curl -i --data-binary @-  -H "Accept: $json" -H "Content-Type: $json" "$host/speak/notification"

Weather

POST

curl -i -d "parts=all" "$host/weather/speak"

Warehouse

PUT

curl -i -X PUT \
   -F "content=@apps/static/svg/medley.svg" \
   -F "content_type=image/svg+xml" \
   "$host/warehouse/test/path.svg"

GET

curl -i \
   "$host/warehouse/test/path.svg"