Sky Ledge Docs
Search
⌃K

Creating Assets

Now that we’ve created an Asset Type (The ‘Hero’ Asset Type), it’s time to create our first actual Asset (‘A Hero’).

Asset Creation

Notice that Assets are incredibly flexible, they can refer to physical objects or people, as in this example (we’ll unpack this right after):

Creating Asset - A Hero

POST api.skyledge.com/asset-types/{assetTypeId}/assets
{
"assetIdentifier":"hero_001",
"name":"High Flyer",
"description":"A high-flying superhero.",
"attributes":{
"icon":"superhero",
"powers":[
"Flight"
]
},
"metrics":{
"remainingPower":100
},
"location":{
"type":"Point",
"coordinates":[
-73.9848,
40.7586
]
}
}
cURL
NodeJs
Python
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":"hero_001",
"name":"High Flyer",
"description":"A high-flying superhero.",
"attributes":{
"icon":"superhero",
"powers":[
"Flight"
]
},
"metrics":{
"remainingPower":100
},
"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: 'hero_001',
name: 'High Flyer',
description: 'A high-flying superhero.',
attributes: {
icon: 'superhero',
powers: ['Flight'],
},
metrics: {
remainingPower: 100,
},
location: {
type: 'Point',
coordinates: [[-73.9848, 40.7586]],
},
} as any;
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": "hero_001",
"name": "High Flyer",
"description": "A high-flying superhero.",
"attributes": {
"icon": "superhero",
"powers": [
"Flight"
]
},
"metrics": {
"remainingPower": 100
},
"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)var axios = require('axios');
var data = JSON.stringify({
"assetIdentifier": "hero_001",
"name": "High Flyer",
"description": "A high-flying superhero.",
"attributes": {
"icon": "superhero",
"powers": [
"Flight"
]
},
"metrics": {
"remainingPower": 100
},
"location": {
"type": "Point",
"coordinates": [
-73.9848,
40.7586
]
}
});
var config = {
method: 'post',
url: 'https://api.skyledge.com/asset-types/ASSET_TYPE_ID/assets',
headers: {
'X-Authorization': 'API_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
You can see the asset in the control room now:
We can specify a few things as part of creating a new asset:
assetIdentifier
Unique identifier of your own choosing
name
Meaningful name for your asset
description
Describe your asset
attributes
Descriptive properties of your asset
icon
Leaving this unspecified will create a default asset icon for you. If you have a custom icon, email [email protected] with the icon you’d like and it’ll be generated within a few hours.
You’ll be able to see some/all of these attributes in a modal when you click on the asset. Pops up like this in the control room:
Asset modal