Skip to content

Instantly share code, notes, and snippets.

// Assumes that you have both request and request-promised installed.
// Tested on node.js v7.5.0
const rp = require('request-promise');
const opts = {
uri: 'https://api.cclantency.com/stream',
method: 'POST',
headers: {
'CC-LATENCY-API-KEY': '<Your private API Key>'
},
// All fields are mandatory.
// - The list of valid sources can be pulled from https://api.cclatency.com/sources
// - Target must either by a valid FQDN or IPv4 address
// - Interval must be a number >= 250 (it's interpreted in milliseconds)
// - The only valid packetType at the moment is ping
{
"source": <string>,
"target": <string>,
"interval": <number>,
"packetType": <string>
# Tested with curl 7.47.0 (x86_64-pc-linux-gnu)
curl -H "CC-LATENCY-API-KEY: 985668cf-cfa0-49e9-b087-83f1743fe5c7" \
https://api.cclatency.com/stream/fdb23edb4a2aeb7a6da840ac84a3cf5c
# Assumes that you have requests installed
# Tested on python 2.7.12
import requests
req = requests.request(
'GET',
'https://api.cclatency.com/stream/fdb23edb4a2aeb7a6da840ac84a3cf5c',
headers = {
'CC-LATENCY-API-KEY': '985668cf-cfa0-49e9-b087-83f1743fe5c7'
})
print(req.json())
// Assumes that you have both request and request-promised installed.
// Tested on node.js v7.5.0
const rp = require('request-promise');
const opts = {
uri: 'https://api.cclatency.com/stream/fdb23edb4a2aeb7a6da840ac84a3cf5c',
headers: {
'CC-LATENCY-API-KEY': '985668cf-cfa0-49e9-b087-83f1743fe5c7'
}
};
# Tested with curl 7.47.0 (x86_64-pc-linux-gnu)
curl -H "CC-LATENCY-API-KEY: 985668cf-cfa0-49e9-b087-83f1743fe5c7" \
https://api.cclatency.com/stream
# Assumes that you have requests installed
# Tested on python 2.7.12
import requests
req = requests.request(
'GET',
'https://api.cclatency.com/stream',
headers = {
'CC-LATENCY-API-KEY': '985668cf-cfa0-49e9-b087-83f1743fe5c7'
})
print(req.json())
// Assumes that you have both request and request-promised installed.
// Tested on node.js v7.5.0
const rp = require('request-promise');
const opts = {
uri: 'https://api.cclatency.com/stream',
headers: {
'CC-LATENCY-API-KEY': '985668cf-cfa0-49e9-b087-83f1743fe5c7'
}
};
{
"status": "success",
"description": "",
"data": {
"source": "GCP::asia-northeast1-a",
"target": "GCP::europe-west1-b",
"latency": 229.1,
"timestamp": "2017-07-03T00:00:41Z"
}
}
{
"status": "success",
"description": "Registered to stream with key f2afa502b8c08ac87748527f022303a5",
"data": []
}