Sky Ledge Docs
  • Welcome
  • Getting Started
    • Creating Your Account
    • Sky Ledge API - Quick start
    • Developer Guide
      • Creating A Control Room
      • Creating Event Types
      • Creating Events (aka Alerts or Notifications)
      • Creating Asset Types
      • Linking Asset Types to a Control Room
      • Creating Assets
      • Creating and Tracking a Metric
      • Future Updates
  • Fundamentals
    • Launchpad
    • Control Rooms
    • Assets
    • Events
    • Places
    • Cycles
    • Widgets
  • API Docs
  • Client Libraries
    • NodeJs
  • Community
    • Where to find us
  • Knowledge Base
    • Articles
      • What is a LaunchPad
      • What is a Control Room
      • How to use the maps controls and layers options
      • Map marker explained
      • Navigating your profile
      • What is an Event
      • What is an Event Type
      • Exploring the event stream
      • Event Stream Filtering
      • What is an Asset
      • What are asset types
      • Understanding Focus Mode
      • Navigating Asset List Mode
      • Table column selection
      • Asset metrics
      • What is a place
      • Searching and Creating a Place
      • Getting Started with Place Notifications
      • Places and how to use the gatehouse report
      • How to use the Event Report (Top-down Investigations Module)
      • What is a Task
      • How to process a task
      • Task Notifications
      • How to invite a work colleague
      • How to submit an awesome ticket
      • Understanding Your Weekly Email Reports
      • Knowledge Base Template
    • What's New
    • Archived - What's News
Powered by GitBook
On this page
  • Getting your Sky Ledge API Key
  • Creating assets and displaying them on a map in four steps
  1. Getting Started

Sky Ledge API - Quick start

PreviousCreating Your AccountNextDeveloper Guide

Last updated 2 years ago

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:

  1. Click on the Manage Organization menu item

  2. Click on API Keys in the sidebar

  3. 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.

Get your Sky Ledge API Key
Create a Control Room via API
Create an Asset and display it on a map
How to retrieve your API Key