Skip to content

Instantly share code, notes, and snippets.

@jem
Created August 15, 2016 22:17
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 jem/10f5bf92c90c1bec961f7c7dfd2e2c84 to your computer and use it in GitHub Desktop.
Save jem/10f5bf92c90c1bec961f7c7dfd2e2c84 to your computer and use it in GitHub Desktop.
require 'rest-client'
require 'json'
site = "https://api.mmx.io"
path = "/query/summary"
token = $TOKEN # be sure to set this in your command line environment.
url = "https://api.mmx.io/query/summary"
body = {
datasource: "demoexchange",
metric: "imp_cnt",
interval: "P1W"
}
headers = {
Authorization: "Bearer " + token
}
site = RestClient::Resource.new site
response = site[path].post(body.to_json, headers)
if response.code == 200
puts response
else
puts "API query failed"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment