Skip to content

Instantly share code, notes, and snippets.

@relaxnow
Created February 4, 2016 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save relaxnow/ce462a4d2e11f0a9d7c0 to your computer and use it in GitHub Desktop.
Save relaxnow/ce462a4d2e11f0a9d7c0 to your computer and use it in GitHub Desktop.
#!/bin/sh
getConnection ()
{
curl -v -k -u engine:engineblock -H "Content-Type: application/json" -X GET https://serviceregistry.demo.openconext.org/janus/app_dev.php/api/connections/15.json
}
jqModify ()
{
# jq 'def key_contains: .key | contains(":sn") | not ; def filter_key(f): f | to_entries | map(select(key_contains)) | from_entries ; .arpAttributes = filter_key(.arpAttributes)'
jq .
}
putConnection ()
{
curl -v -k -u engine:engineblock -H "Content-Type: application/json" -X PUT -d @- https://serviceregistry.demo.openconext.org/janus/app_dev.php/api/connections/15.json
}
jqShow()
{
jq '.'
}
#getConnection | jqShow > /tmp/jq.first
getConnection | putConnection
#getConnection | jqModify | tee /dev/stderr | putConnection
#getConnection | jqShow > /tmp/jq.second
#diff /tmp/jq.first /tmp/jq.second
@relaxnow
Copy link
Author

relaxnow commented Feb 4, 2016

Test querying the janus REST API with jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment