Skip to content

Instantly share code, notes, and snippets.

@julianeon
Created April 30, 2014 17:24
Show Gist options
  • Save julianeon/e17f74b8952c7c288038 to your computer and use it in GitHub Desktop.
Save julianeon/e17f74b8952c7c288038 to your computer and use it in GitHub Desktop.
Returns the information from a single incident.
require 'json'
incident_id="CHANGE_THIS"
subdomain="CHANGE_THIS"
api_key="CHANGE_THIS"
endpoint="https://#{subdomain}.pagerduty.com/api/v1/incidents/#{incident_id}"
def curl_get_id(tokennum,endpoint)
curl_command='curl -H "Content-type: application/json" -H "Authorization: Token token='+tokennum+'" -X GET -G "'+endpoint+'"'
end
def print_results(curl_get_all)
IO.popen(curl_get_all).each do |line|
parsed=JSON.parse(line)
puts parsed
end
end
curl_cmd=curl_get_id(api_key,endpoint)
puts curl_cmd
print_results(curl_cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment