Your Request

Submitting the "Test Now" form above, you made the following request to the API:

CURL

curl -X POST -H Content-Type:application/x-www-form-urlencoded -H Cache-Control:no-cache -d 'url=URL-TO-TEST&key=PUT-YOUR-KEY-HERE' http://tenon.io/api/

PHP

$opts['key'] = 'YOUR API KEY GOES HERE';
$opts['url'] = 'YOUR URL TO TEST GOES HERE';

// open connection
$ch = curl_init();

// set our curl options
curl_setopt($ch, CURLOPT_URL, 'http://tenon.io/api/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $opts);

//execute post and get results
$result = curl_exec($ch);

//close connection
curl_close($ch);

//this converts the JSON API response to a PHP array
$result = json_decode($result, true);

Python

Python2 & urllib

import urllib
params = urllib.urlencode({'url': 'PUT-YOUR-URl-HERE', 'key': 'PUT-YOUR-KEY-HERE'})
f = urllib.urlopen("http://tenon.io/api/", params)
print f.read()

Python3 & urllib

import urllib.request
import urllib.parse
data = urllib.parse.urlencode({'url': 'PUT-YOUR-URL-HERE', 'key': 'PUT-YOUR-KEY-HERE'})
data = data.encode('utf-8')
request = urllib.request.Request("http://tenon.io/api/")

# adding charset parameter to the Content-Type header.
request.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
f = urllib.request.urlopen(request, data)
print(f.read().decode('utf-8'))

Node

var querystring = require('querystring');

var data = querystring.stringify({
    url: PUT-YOUR-URL-HERE,
    key: PUT-YOUR-KEY-HERE
});

var options = {
    host: 'www.tenon.io',
    port: 80,
    path: '/api/',
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': Buffer.byteLength(data)
    }
};

var req = http.request(options, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log("body: " + chunk);
    });
});

req.write(data);
req.end();

Ruby

uri = URI('http://tenon.io/api/')
res = Net::HTTP.post_form(uri, 'key' => 'PUT-YOUR-KEY-HERE', 'url' => 'PUT-YOUR-URL-HERE')
puts res.body