Created
August 15, 2016 22:17
-
-
Save jem/10f5bf92c90c1bec961f7c7dfd2e2c84 to your computer and use it in GitHub Desktop.
This file contains 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
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