Created
June 27, 2016 16:36
-
-
Save lsloan/b60ae73b61a15f4a1cf474f20f59cb7a to your computer and use it in GitHub Desktop.
Post a rudimentary Caliper event to an endpoint. Assumes USER and HOSTNAME environment variables are available.
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
#!/bin/sh -- | |
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ISO 8601 format, UTC | |
CURL_STDIN='@-' # cURL's notation for stdin | |
curl "https://endpoint.example.org/caliper" \ | |
--request POST \ | |
--header "Content-Type: application/json" \ | |
--capath /etc/pki/tls/certs/ \ | |
--data ${CURL_STDIN} << EOT | |
{ | |
"sensor":"${USER}_curl", | |
"sendTime":"${NOW}", | |
"data":[ | |
{ | |
"@context":"http://purl.imsglobal.org/ctx/caliper/v1/Context", | |
"@type":"http://purl.imsglobal.org/caliper/v1/SessionEvent", | |
"actor":{ | |
"@id":"https://${HOSTNAME}/person/${USER}", | |
"@context":"http://purl.imsglobal.org/ctx/caliper/v1/Context", | |
"@type":"http://purl.imsglobal.org/caliper/v1/lis/Person" | |
}, | |
"eventTime":"${NOW}", | |
"action":"http://purl.imsglobal.org/vocab/caliper/v1/action#LoggedIn" | |
} | |
] | |
} | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@arwhyte, @pushyamig: This is great for testing connectivity to an endpoint. OAuth support will be added later.