Check out the cURL API documentation.
$ curl "https://analytics.babelstreet.com/rest/v1/ping"
-H'X-BabelStreetAPI-Key: Your API key here'
Visit our GitHub page for the binding and documentation.
The Analytics binding supports version 3.8 and later of Python
$ pip install rosette_api
from rosette.api import API
api = API(user_key="Your API Key here")
result = api.ping()
print("/ping: ", result)
Visit our GitHub page for the binding and documentation.
The Analytics binding supports version 8.1 and later of PHP
Available through composer:
$ composer require "rosette/api"
<?php
require_once dirname(__FILE__) . '/../vendor/autoload.php';
use rosette\api\Api;
use rosette\api\RosetteException;
$options = getopt(null, array('key:', 'url::'));
if (!isset($options['key'])) {
echo 'Usage: php ' . __FILE__ . " --key --url=\n";
exit();
}
$api = isset($options['url']) ? new Api($options['key'], $options['url']) : new Api($options['key']);
try {
$result = $api->ping();
var_dump($result);
} catch (RosetteException $e) {
error_log($e);
}
Visit our GitHub page for the binding and documentation.
The Analytics binding supports version 11 and later of Java
For Maven, add the following dependency to your POM:
<dependency>
<groupId>com.basistech.rosette</groupId>
<artifactId>rosette-api</artifactId>
<version>${rosette.java.version}</version>
</dependency>
Visit our GitHub page for the binding and documentation.
The Analytics binding supports version 3.0 and later of Ruby
Available as a gem:
$ gem install rosette_api
require 'rosette_api'
api_key, url = ARGV
if !url
rosette_api = RosetteAPI.new(api_key)
else
rosette_api = RosetteAPI.new(api_key, url)
end
response = rosette_api.ping
puts JSON.pretty_generate(response)
Visit our GitHub page for the binding and documentation.
Available through nuget:
$ nuget install rosette_api
class ping
{
static void Main(string[] args)
{
string apikey = "Your API key";
string alturl = string.Empty;
if (args.Length != 0)
{
apikey = args[0];
alturl = args.Length > 1 ? args[1] : string.Empty;
}
try
{
CAPI NewCAPI = string.IsNullOrEmpty(alturl) ? new CAPI(apikey) : new CAPI(apikey, alturl);
Dictionary pingResult = NewCAPI.Ping();
Console.WriteLine(new JavaScriptSerializer().Serialize(pingResult));
}
catch (Exception e)
{
Console.WriteLine("Exception: " + e.Message);
}
}
}
Visit our GitHub page for the binding and documentation.
The Analytics binding supports version 8.0.0 and later of Node.js
Available through npm:
$ npm install rosette-api
$ npm install argparse
"use strict";
var Api = require("../lib/Api");
var ArgumentParser = require("argparse").ArgumentParser;
var parser = new ArgumentParser({
addHelp: true,
description: "Send ping to check for reachability of Analytics API"
});
parser.addArgument(["--key"], {help: "Analytics API key", required: true});
parser.addArgument(["--url"], {help: "Analytics API alt-url", required: false});
var args = parser.parseArgs();
var api = new Api(args.key, args.url);
var endpoint = "ping";
api.rosette(endpoint, function(err, res){
if(err){
console.log(err)
} else {
console.log(JSON.stringify(res, null, 2));
}
});