Cells

Note An API key is required to access the location APIs. If you need one, check our authentication page

Using the cell metadata API to add & access data stored on UNL cells.

This data can be private, or searchable by other users in the network.

const unl = require('unl-core')
const axios = require('axios')
let resUrl = "https://d3e1m60ptf1oym.cloudfront.net/671fdf5c-e88b-4fb2-828f-c7ca8fa04c46/Amsterdam-21_xgaplus.jpg"
// Define our cell data
let photo = {
geohash: "u173zw0kd",
description: "Nieuwmarkt, Amsterdam aerial shot",
isPublic: "true",
isSearchable: "true",
attachments: [
{
name: "nieuwmarkt_aerial",
mimeType: "img/jpg",
resourceUrl: resUrl
}
]
}
// add your API key via 'apikey' header
const res = await axios.post(`https://api.unl.global/v1/cell-metadata`, {
data: photo,
headers: {
'apikey': 'myunlapikey'
}
});
console.log(JSON.stringify(res))
// {
// "id": "65068",
// "geohash": "u173zw0kd"
// ...
// "attachments": [
// {
// "id": 147,
// "name": "nieuwmarkt_aerial",
// ...
// }
// ],
// ...
// }

Axios: https://www.npmjs.com/package/axios

This image is now attached to the location u173zw0kd, aka NL9.caving.airfare, and can be seen in a search of this location

await axios.get("https://api.unl.global/v1/cell-metadata/65068", {
headers: {
'apikey': 'myunlapikey'
}
})

and also these IDs can be used to access that data directly

await axios.get("https://api.unl.global/v1/cell-metadata/geohash/u173zw0kd", {
headers: {
'apikey': 'myunlapikey'
}
})