Skip to main content

Getting Started

This tutorial shows you how to connect to RigiCloud API, obtain access tokens, and invoke the API methods using HTTP requests or subscribing to socket streams.

To use the RigiCloud API, it is important that you understand the basics of RESTful web services, websocket and JSON representations.

Step 1: Get a RigiCloud API User Account

To use the RigiCloud API, you need a RigiCloud API User Account. If you already have an account, then you're all set. If not you will need to contact us, and we will provide you an account.

Step 2: Request a secure token

Before to proceed to any Rest call or connect to our live stream you need to login to our system. If the login is correct the system will provide you a secure token needed for the subscriptions or convenient calls. You can invoke the login with this endpoint:

POST `https://cloud.rigi.tech/auth/login`;

body: {
username:<username>,
password:<password>
}

Example:

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/auth/login`, {
mode: "cors",
method: "POST",
referrer: "no-referrer",
body: JSON.stringify({ username: username, password: pw }),
})
if(!serverResponse.ok){
try {
switch (serverResponse.status){
case 400:
j = await serverResponse.json();
break;
case 403:
response = { message: "Forbidden access to data" };
case 404:
response = { message: "Address not found" };
default:
j = await serverResponse.json()
}
} catch (e) {
response = { message: "Error fetching data" };
}
}else{
j = await serverResponse.json()
}

response = { data:j };
const {data, message} = response
if(message) console.debug(message)
if(data) console.debug(data)
}
fetchData()

Answer:

{
"success": true,
"user": {
"createdAt": <timestamp>,
"updatedAt": <timestamp>,
"id": <user_d>,
"email": <user_email>
"username": <username>,
"password": "",
"initialRoute": <initial_path>,
"role": <role>
},
"initialRoute": <initial_path>,
"capabilities": [...],
"settings": [... ],
"token": <the_token>
}

We only need the token from this answer, this token wil be used in all the stream subscriptions calls.

Live WebSocket API

The method above will provide the topic needed to connect to the websocket stream. Once you have the token you can use it to connect with your socket client as described in the corresponding section.

AirTraffic API

The Air traffic Api need a special token. This token needs to be provided by Rigitech. Please contact us to get one.