curl --user *protected email*:6bf4697f9d67ff008bf7f3ef0c1113e1\
-H 'Accept:application/json' https://api.siteimprove.com/v2
(ns clojure-example.core
(:require [org.httpkit.client :as http]
[clojure 1=":as" 2="json" language=".data.json"][/clojure]))
(def api-user "apiuser@siteimprove.com")
(def api-key "6bf4697f9d67ff008bf7f3ef0c1113e1")
(def url "https://api.siteimprove.com/v2")
(def options {:basic-auth [api-user api-key]})
@(http/get url options
(fn [{:keys [status headers body error]}]
(println status)
(println (:account_name (json/read-str body :key-fn keyword)))))
import requests, json
api_user = "apiuser@siteimprove.com";
api_key = "6bf4697f9d67ff008bf7f3ef0c1113e1";
resource = "https://api.siteimprove.com/v2"
response = requests.get(resource, auth=(api_user, api_key))
account = response.json()
print response.status_code
print account.get("account_name")
var request = require('request');
var api_user = "apiuser@siteimprove.com";
var api_key = "6bf4697f9d67ff008bf7f3ef0c1113e1";
var url = "https://api.siteimprove.com/v2"
var response = request.get({
url: url,
auth: {
user: api_user,
pass: api_key
},
json: true
},function (err, resp, body) {
console.log(resp.statusCode);
console.log(body.account_name);
});
require 'rest-client'
require 'base64'
api_user = "apiuser@siteimprove.com"
api_key = "6bf4697f9d67ff008bf7f3ef0c1113e1"
url = "https://api.siteimprove.com/v2"
resource = RestClient::Resource.new(url,
:user => api_user,
:password => api_key,
:headers => {:accept => "application/json"})
response = resource.get
account = JSON.parse(response)
puts response.code
puts account["account_name"]
$api_user = "apiuser@siteimprove.com";
$api_key = "6bf4697f9d67ff008bf7f3ef0c1113e1";
$url = "https://api.siteimprove.com/v2";
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($process, CURLOPT_USERPWD, $api_user . ":" . $api_key);
curl_setopt($process, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($process);
$status = curl_getinfo($process);
curl_close($process);
$json = json_decode($response, true);
print_r($status["http_code"] . "\n");
print_r($json["account_name"] . "\n");