Skip to content

Instantly share code, notes, and snippets.

@julianeon
Created May 28, 2014 00:34
Show Gist options
  • Save julianeon/cd5b112dd569ff7efd07 to your computer and use it in GitHub Desktop.
Save julianeon/cd5b112dd569ff7efd07 to your computer and use it in GitHub Desktop.
PUT example using HTTParty.
require 'httparty'
subdomain='FAKE'
api_token='FAKE'
id='FAKE'
endpoint="https://#{subdomain}.pagerduty.com/api/v1/escalation_policies/#{id}"
token_string="Token token=#{api_token}"
data= {
name: "New name"
}
response = HTTParty.put(endpoint,
:body => data.to_json,
:headers => { "Content-Type" => 'application/json', "Authorization" => token_string})
puts response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment