Skip to content

Instantly share code, notes, and snippets.

@ivansnag
Last active May 5, 2022 17:42
Show Gist options
  • Save ivansnag/5b740c2a57b6178d0f7c8468e62370db to your computer and use it in GitHub Desktop.
Save ivansnag/5b740c2a57b6178d0f7c8468e62370db to your computer and use it in GitHub Desktop.
# Example of pulling audit entries
# Required: the auth token must be associated with an Organization Administrator on the account
require 'httparty'
require 'json'
@auth_token = "[YOUR AUTH TOKEN]"
@get_organizations_url= "https://api.bugsnag.com/user/organizations?admin=&per_page=10"
org_response = HTTParty.get(@get_organizations_url,
:headers => { 'Authorization' => "token #{@auth_token}",'Content-Type' => 'application/json', }
)
organization_id = org_response[0]['id']
@list_audit_entries_url = "https://api.bugsnag.com/organizations/#{organization_id}/audit_entries?per_page=20"
audit_entries_request = HTTParty.get(@list_audit_entries_url,
:headers => { 'Authorization' => "token #{@auth_token}",'Content-Type' => 'application/json', }
)
puts audit_entries_request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment