NAV Navbar
cURL Ruby Python NodeJS

Introduction to JetStream API

The JetStream API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients.

We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application. JSON is returned by all API responses, including errors, although our API libraries convert responses to appropriate language-specific objects.

Be sure to subscribe to JetStream's API announce mailing list to receive information on new additions and changes to JetStream's API and language libraries.

Headers

Note: For simplicity developer should understand those like following:

  • PUBLIC end-points are allow to use before signin process, which need api_key with request headers.
  • PRIVATE end-points are allow to use after signin process, which need token along with request headers.

Headers can be categorize into two ways depending on each API end-point. In JetStream, some end-point are allow to use as PUBLIC and some as PRIVATE, according to the accessibility of API end-point.

Public

Public end-point are allow user to access using the following three headers:

KEY Value Description
api_key api_key api_key that you got from JetStream (Add API Key) request.

Private

Private end-point allow user to access using the following two headers:

KEY Value Description
Content-Type application/json Output format of API
Authorization token User can get your user token from sign in.

Authentication

Sign in

Sign in function use to perform login action to the JetStream system. Use this code for authorization:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/auth/login")

http = Net::HTTP.new(url.host, url.port)

request = Net::https::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = '{
  "email":"name@company.com",
  "password":"jetstream_password"
}'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/auth/login"

payload = '{
  "email":"name@company.com",
  "password":"jetstream_password"
}'

headers = {
    'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -X POST \
  https://api.jetstream.gmbh/auth/login \
  -H 'Content-Type: application/json' \
  -d '{
    "email":"name@company.com",
    "password":"jetstream_password"
}'
var request = require("request");

var options = {
    method: 'POST',
    url: 'https://api.jetstream.gmbh/auth/login',
    headers: {
        'Content-Type': 'application/json'
    },
    body: {
        email: 'name@company.com',
        password: 'jetstream_password'
    },
    json: true
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace email and password with your own one. The output will be look like the following:

{
    "status": 1,
    "token": "token_for_next_request"
}

Sign in to your JetStream account using this request and it will return token for your next subsequent request. Every private endpoint need token, without token you cannot access your data.

HTTP Request

Parameters

Name Value Parameter type
email name@company.com required
password jetstream_password required

Sign up

Sign up function use to perform registration process to the JetStream system. Use this code for registration:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/auth/register")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = '{
  "email":"name@company.com",
  "password":"jetstream_password",
  "first_name":"John",
  "last_name":"Doe"
}'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/auth/register"

payload = '{
  "email":"name@company.com",
  "password":"jetstream_password",
  "first_name":"John",
  "last_name":"Doe"
}'

headers = {
    'Content-Type': "application/json"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -X POST \
  https://api.jetstream.gmbh/auth/register \
  -H 'Content-Type: application/json' \
  -d '{
    "email":"name@company.com",
    "password":"jetstream_password",
    "first_name":"John",
    "last_name":"Doe"
}'
var request = require("request");

var options = {
    method: 'POST',
    url: 'https://api.jetstream.gmbh/auth/register',
    headers: {
        'Content-Type': 'application/json'
    },
    body: {
        email: 'name@company.com',
        password: 'jetstream_password',
        first_name: 'John',
        last_name: 'Doe'
    },
    json: true
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace email and password with your own one. The output will be look like the following:

{
    "status": 1,
    "email": "name@company.com"
}

Sign up function use to perform registration process to the JetStream system.

HTTP Request

Parameters

Name Value Parameter type
email name@company.com required
password jetstream_password required

Add VO

This method allow to add Virtual Organization to the JetStream system. Here is the code:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/auth/vo")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'token'
request.body = '{
  "email":"name@company.com",
  "vo":"johnvo"
}'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/auth/vo"

payload = '{
  "email":"name@company.com",
  "vo":"johnvo"
}'

headers = {
    'Content-Type': "application/json",
    'Authorization': "token"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -X POST \
  https://api.jetstream.gmbh/auth/vo \
  -H 'Authorization: token' \
  -H 'Content-Type: application/json' \
  -d '{
    "email":"name@company.com",
    "vo":"johnvo"
}'
var request = require("request");

var options = {
    method: 'POST',
    url: 'https://api.jetstream.gmbh/auth/vo',
    headers: {
        'Authorization': 'token',
        'Content-Type': 'application/json'
    },
    body: {
        email: 'name@company.com',
        vo: 'johnvo'
    },
    json: true
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace email with your own one. The output will be look like the following:

{
    "status": 1
}

This method allow to add Virtual Organization to the JetStream system. Virtual Organization is the place to indentify your workspace and jobs.

HTTP Request

Parameters

Name Value Parameter type
email name@company.com required
vo johnvo required

Add API Key

This method allow to add API key to the JetStream system. Here is the code:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/auth/apikey")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'token'
request.body = '{
  "app_name":"john.bloomsky"
}'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/auth/apikey"

payload = '{
  "app_name":"john.bloomsky"
}'
headers = {
    'Content-Type': "application/json",
    'Authorization': "token"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl -X POST \
  https://api.jetstream.gmbh/auth/apikey \
  -H 'Authorization: token' \
  -H 'Content-Type: application/json' \
  -d '{
    "app_name":"john.bloomsky"
}'
var request = require("request");

var options = {
    method: 'POST',
    url: 'https://api.jetstream.gmbh/auth/apikey',
    headers: {
        'Authorization': 'token',
        'Content-Type': 'application/json'
    },
    body: {
        app_name: 'john.bloomsky'
    },
    json: true
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "status": 1,
    "api_key": "api_key_to_send_data"
}

This method allow to add API key to the JetStream system, which is require when you send data from sensor.

HTTP Request

Parameters

Name Value Parameter type
app_name john.bloomsky required

Jobs

Retrieve Jobs

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/jobs")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'token'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/jobs"

headers = {
    'Authorization': "token"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -X GET \
  https://api.jetstream.gmbh/jobs \
  -H 'Authorization: token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/jobs',
    headers: {
        'Authorization': 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "jobs": [
        "jet.bsk.main",
        "jet.froggie.json",
        "jet.public.openweathermap",
        "jet.froggie.6005.main",
        "jet.public.rainradar.cei",
        "jet.bsk.dl_img",
        "jet.bsk.json",
        "jet.public.bloomsky.ibitz"
    ]
}

This method is use to get job lists.

HTTP Request

Parameters

No parameter require for this request.

Job by ID

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/jobs/vallaris.test4")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'token'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/jobs/vallaris.test4"

headers = {
    'Authorization': "token"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -X GET \
  https://api.jetstream.gmbh/jobs/vallaris.test4 \
  -H 'Authorization: token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/jobs/vallaris.test4',
    headers: {
        'Authorization': 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "jobs": {
        "job_id": "jet.bsk.main",
        "active": "true",
        "trigger": {
            "type": "cron",
            "cmd": "*/5 * * * *"
        },
        "data_in": {
            "type": "http-request",
            "param": {
                "url": "http://api.bloomsky.com/api/skydata",
                "headers": {
                    "Authorization": "xtatsMvovNncddZmtavM9JXGyKbZsQ=="
                },
                "encoding": "json"
            }
        },
        "data_transform": {
            "type": "transform",
            "param": {
                "script": [
                    "data=src.data",
                    "meta.station='i-bitz_bloomsky'"
                ]
            }
        },
        "data_out": {
            "type": "call",
            "param": {
                "to": [
                    "jet.bsk.dl_img",
                    "jet.bsk.json"
                ]
            }
        },
        "_vo": "jet"
    }
}

This method is use to get job details by ID.

HTTP Request

Parameters

Name Value Parameter type
job.name vallaris.test4 required

Storage

Storage List

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/storage")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'token'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/storage"

headers = {
    'Authorization': "token"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -X GET \
  https://api.jetstream.gmbh/storage \
  -H 'Authorization: token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/storage',
    headers: {
        'Authorization': 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "storage": [
        "jet.public.TMD_Daily.pub",
        "jet.public.bloomsky.img.pub",
        "jet.public.bloomsky.pub",
        "jet.public.froggie.pub",
        "jet.public.openweathermap.pub",
        "jet.public.rainradar.cei.pub",
        "jet.storage.dev1",
        "jet.storage.dev2",
        "jet.temp",
        "jet.temp1",
        "jet.test2"
    ]
}

This method is use to get the list of storage.

HTTP Request

Parameters

No parameter require for this request.

Storage statistics

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/storage/stats/jet.storage.dev1")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'token'

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/storage/stats/jet.storage.dev1"

headers = {
    'Authorization': "token"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
curl -X GET \
  https://api.jetstream.gmbh/storage/stats/jet.storage.dev1 \
  -H 'Authorization: token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/storage/stats/jet.storage.dev1',
    headers: {
        'Authorization': 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "stats": {
        "storagename": "jet.storage.dev1",
        "count": 36,
        "filesize": 851843
    }
}

This method is use to get statistics of the specified storage.

HTTP Request

Parameters

Name Value Parameter type
storage.name jet.storage.dev1 required

Objects

Retrieve Objects

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/objects/jet.public.bloomsky.pub?last=1&token=token")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/objects/jet.public.bloomsky.pub"

querystring = {"last":"1","token":"token"}

headers = {}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
curl -X GET \
  'https://api.jetstream.gmbh/objects/jet.public.bloomsky.pub?last=1&token=token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/objects/jet.public.bloomsky.pub',
    qs: {
        last: '1',
        token: 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

[
    {
        "_id": "c8303802000006a15bc72b49",
        "meta": {
            "_jid": "jet.bsk.json",
            "_tid": "TR1539779401086eb8d43",
            "_ts": 1539779401,
            "station": "i-bitz_bloomsky"
        },
        "data": {
            "UTC": 7,
            "CityName": "Bangkok",
            "Storm": {
                "UVIndex": "2",
                "WindDirection": 9999,
                "RainDaily": 0,
                "WindGust": 22367.16,
                "SustainedWindSpeed": 22367.16,
                "RainRate": 393.66,
                "24hRain": 0
            },
            "Searchable": true,
            "DeviceName": "i-bitz SKY",
            "RegisterTime": 1525669049,
            "DST": 0,
            "BoundedPoint": "",
            "LON": 100.5463,
            "Point": {},
            "VideoList": [
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-13.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-14.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-15.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-16.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-17.mp4"
            ],
            "VideoList_C": [
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-13_C.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-14_C.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-15_C.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-16_C.mp4",
                "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-17_C.mp4"
            ],
            "DeviceID": "442C05FF5C71",
            "NumOfFollowers": 2,
            "LAT": 13.7884,
            "ALT": 8,
            "Data": {
                "Luminance": 9999,
                "Temperature": 88,
                "ImageURL": "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6unJasn5c=.jpg",
                "TS": 1539779163,
                "Rain": false,
                "Humidity": 51,
                "Pressure": 29.8,
                "DeviceType": "SKY2",
                "Voltage": 2636,
                "Night": true,
                "UVIndex": 9999,
                "ImageTS": 1539775872
            },
            "FullAddress": "Soi Phahon Yothin 13, Bangkok,Bangkok, TH",
            "StreetName": "Soi Phahon Yothin 13",
            "PreviewImageList": [
                "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6rl5OknZo=.jpg",
                "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6slZmomZs=.jpg",
                "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6snpWsn5g=.jpg",
                "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6tnZKlnZg=.jpg",
                "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6umZarn5g=.jpg"
            ]
        }
    }
]

This method is use to get the list of object you belong in JetStream.

HTTP Request

Parameters

Name Value Parameter type
storage.name jet.public.bloomsky.pub required

Object data

Here is the way to use this method:

require 'uri'
require 'net/http'

url = URI("https://api.jetstream.gmbh/objects/data/jet.public.bloomsky.pub?token=token")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
import requests

url = "https://api.jetstream.gmbh/objects/data/jet.public.bloomsky.pub"

querystring = {"token":"token"}

headers = {}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
curl -X GET \
  'https://api.jetstream.gmbh/objects/data/jet.public.bloomsky.pub?token=token'
var request = require("request");

var options = {
    method: 'GET',
    url: 'https://api.jetstream.gmbh/objects/data/jet.public.bloomsky.pub',
    qs: {
        token: 'token'
    }
};

request(options, function(error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

Make sure to replace token with your own one. The output will be look like the following:

{
    "UTC": 7,
    "CityName": "Bangkok",
    "Storm": {
        "UVIndex": "2",
        "WindDirection": 9999,
        "RainDaily": 0,
        "WindGust": 22367.16,
        "SustainedWindSpeed": 22367.16,
        "RainRate": 393.66,
        "24hRain": 0
    },
    "Searchable": true,
    "DeviceName": "i-bitz SKY",
    "RegisterTime": 1525669049,
    "DST": 0,
    "BoundedPoint": "",
    "LON": 100.5463,
    "Point": {},
    "VideoList": [
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-13.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-14.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-15.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-16.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-17.mp4"
    ],
    "VideoList_C": [
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-13_C.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-14_C.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-15_C.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-16_C.mp4",
        "http://s3.amazonaws.com/bskytimelapses/faBiuZWsq6epq5yj_7_2018-10-17_C.mp4"
    ],
    "DeviceID": "442C05FF5C71",
    "NumOfFollowers": 2,
    "LAT": 13.7884,
    "ALT": 8,
    "Data": {
        "Luminance": 9999,
        "Temperature": 88,
        "ImageURL": "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6unJasn5c=.jpg",
        "TS": 1539779163,
        "Rain": false,
        "Humidity": 51,
        "Pressure": 29.8,
        "DeviceType": "SKY2",
        "Voltage": 2636,
        "Night": true,
        "UVIndex": 9999,
        "ImageTS": 1539775872
    },
    "FullAddress": "Soi Phahon Yothin 13, Bangkok,Bangkok, TH",
    "StreetName": "Soi Phahon Yothin 13",
    "PreviewImageList": [
        "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6rl5OknZo=.jpg",
        "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6slZmomZs=.jpg",
        "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6snpWsn5g=.jpg",
        "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6tnZKlnZg=.jpg",
        "http://s3-us-west-1.amazonaws.com/bskyimgs/faBiuZWsq6epq5yjqJ1lqZ6umZarn5g=.jpg"
    ]
}

This method is use to get the object data from specified storage.

HTTP Request

Parameters

Name Value Parameter type
storage.name jet.public.bloomsky.pub required

Errors

The JetStream API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The method requested is hidden for administrators only.
404 Not Found -- The specified requests could not be found.
429 Too Many Requests -- You're requesting too many requests! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.