Sky Ledge API - Quick start
We’re going to show you how easy it is to:
This guide will just focus on the API calls, the next section will unpack this in more detail using our Hero Potions Inc example
Getting your Sky Ledge API Key
To get your API Key:
Click on the Manage Organization menu item
Click on API Keys in the sidebar
Add your API Key as part of a X-Authorization header in your API requests
Creating assets and displaying them on a map in four steps
Creating a Control Room
POST api.skyledge.com/controlrooms
// raw JSON body for api request
{
"name":"Hero Logistics",
"description":"Real-time monitoring of Hero Logistics"
}
curl --location --request POST 'https://api.skyledge.com/controlrooms' \
--header 'X-Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name":"Hero Logistics",
"description":"Real-time monitoring of Hero Logistics"
}'
import {
Configuration,
ControlRoomsApi,
CreateControlRoomRequest,
} from '@skyledge/sdk';
const configuration = new Configuration({
apiKey: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
basePath: 'https://api.skyledge.com',
});
const data: Partial<CreateControlRoomRequest> = {
name: 'Hero Logistics',
description: 'Real-time monitoring of Hero Logistics',
};
const controlRoomApi = new ControlRoomsApi(configuration);
const newControlRoom = await controlRoomApi.createControlRoom(data);
console.log(newControlRoom.status);
import requests
import json
url = "https://api.skyledge.com/controlrooms"
payload = json.dumps({
"name": "Hero Logistics",
"description": "Real-time monitoring of Hero Logistics"
})
headers = {
'X-Authorization': 'API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Creating an Asset Type - Truck
POST api.skyledge.com/asset-types
{
"identifier":"truck",
"name":"Delivery Truck",
"description":"Trucks belonging to our delivery fleet"
}
curl --location --request POST 'https://api.skyledge.com/asset-types' \
--header 'X-Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"identifier":"truck",
"name":"Delivery Truck",
"description":"Trucks belonging to our delivery fleet"
}'
import { Configuration, AssetTypeRequest, AssetTypesApi } from '@skyledge/sdk';
const configuration = new Configuration({
apiKey: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
basePath: 'https://api.skyledge.com',
});
const data: Partial<AssetTypeRequest> = {
identifier: 'truck',
name: 'Delivery Truck',
description: 'Trucks belonging to our delivery fleet',
};
const assetTypeApi = new AssetTypesApi(configuration);
const newAssetType = await assetTypeApi.createAssetType(data);
console.log(newAssetType.status);
import requests
import json
url = "https://api.skyledge.com/asset-types"
payload = json.dumps({
"identifier": "truck",
"name": "Delivery Truck",
"description": "Trucks belonging to our delivery fleet"
})
headers = {
'X-Authorization': 'API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Assigning our Truck Asset Type to our Control Room
PUT api.skyledge.com/controlrooms/{controlRoomId}/asset-types/{assetTypeId}
{}
curl --location --request PUT 'https://api.skyledge.com/controlrooms/CONTROL_ROOM_ID/asset_types/ASSET_TYPE_ID' \
--header 'X-Authorization: API_KEY'
import { Configuration, AssetTypesApi } from '@skyledge/sdk';
const configuration = new Configuration({
apiKey: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
basePath: 'https://api.skyledge.com',
});
const assetTypeApi = new AssetTypesApi(configuration);
const controlRoomId = CONTROL_ROOM_ID;
const assetTypeId = ASSET_TYPE_ID;
const addAssetType2ControlRoom =
await assetTypeApi.assignsAssetTypeToControlRoom(controlRoomId, assetTypeId);
console.log(addAssetType2ControlRoom.status);
import requests
url = "https://api.skyledge.com/controlrooms/CONTROL_ROOM_ID/asset_types/ASSET_TYPE_ID"
payload={}
headers = {
'X-Authorization': 'API_KEY'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Creating Asset - Our First Truck
POST api.skyledge.com/asset-types/{assetTypeId}/assets
{
"assetIdentifier":"truck_001",
"name":"Mercedes Truck",
"description":"Refrigerated truck.",
"attributes":{
"icon":"truck",
"model":"Actos Rigid Truck",
"year":"2019",
"asset-manager":"David Lawton",
“colour” : “pink”
},
"metrics":{
"maximumCarryingWeightTonnes":3,
"currentSpeed":80,
“temperatureOfCargo” : 2
},
"location":{
"type":"Point",
"coordinates":[
-73.9848,
40.7586
]
}
}
curl --location --request POST 'https://api.skyledge.com/asset-types/ASSET_TYPE_ID/assets' \
--header 'X-Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"assetIdentifier":"truck_001",
"name":"Mercedes Truck",
"description":"Refrigerated truck.",
"attributes":{
"icon":"truck",
"model":"Actos Rigid Truck",
"year":"2019",
"asset-manager":"David Lawton",
"colour" : "pink"
},
"metrics":{
"maximumCarryingWeightTonnes":3,
"currentSpeed":80,
"temperatureOfCargo" : 2
},
"location":{
"type":"Point",
"coordinates":[
-73.9848,
40.7586
]
}
}'
import { Configuration, AssetRequest, AssetsApi } from '@skyledge/sdk';
const configuration = new Configuration({
apiKey: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX',
basePath: 'https://api.skyledge.com',
});
const data: AssetRequest = {
assetIdentifier: 'truck_001',
name: 'Mercedes Truck',
description: 'Refrigerated truck.',
attributes: {
icon: 'truck',
model: 'Actos Rigid Truck',
year: '2019',
assetManager: 'David Lawton',
colour: 'pink',
} as any,
metrics: {
maximumCarryingWeightTonnes: 3,
currentSpeed: 80,
temperatureOfCargo: 2,
},
location: {
type: 'Point',
coordinates: [-73.9848, 40.7586],
},
};
const assetTypeId = ASSET_TYPE_ID;
const assetApi = new AssetsApi(configuration);
const createAsset = await assetApi.createAsset(assetTypeId, data);
console.log(createAsset.status);
import requests
import json
url = "https://api.skyledge.com/asset-types/ASSET_TYPE_ID/assets"
payload = json.dumps({
"assetIdentifier": "truck_001",
"name": "Mercedes Truck",
"description": "Refrigerated truck.",
"attributes": {
"icon": "truck",
"model": "Actos Rigid Truck",
"year": "2019",
"asset-manager": "David Lawton",
"colour": "pink"
},
"metrics": {
"maximumCarryingWeightTonnes": 3,
"currentSpeed": 80,
"temperatureOfCargo": 2
},
"location": {
"type": "Point",
"coordinates": [
-73.9848,
40.7586
]
}
})
headers = {
'X-Authorization': 'API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Voila. In four steps we’ve created a Control Room, an asset type, pushed our first asset type to the Control Room and created our first asset.
Last updated