Fulcrum Learning Portal
  • Overview
  • Resources
  • Developers
  • Help
  • Status
  • Sign In

›REST API

Developer Tools

  • Introduction
  • Webhooks
  • Data Shares
  • URL Actions

REST API

  • Introduction
  • Changelog
  • Endpoints

    • Users
    • Authorizations
    • Roles
    • Memberships
    • Forms
    • Records
    • Choice Lists
    • Classification Sets
    • Projects
    • Layers
    • Photos
    • Signatures
    • Videos
    • Audio
    • Changesets
    • Webhooks
    • Audit Logs

Query API

  • Introduction
  • Functions

Calculations

  • Introduction
  • Reference
  • Examples

Data Events

  • Introduction
  • Reference
  • Examples

Desktop Sync

  • Introduction
  • Reference
  • Plugins

Layers

The Layers API gives you access to the map layers within your Fulcrum account.

Endpoints

MethodEndpointDescriptionExample
GET/api/v2/layers.jsonFetch all layers.Get All
GET/api/v2/layers/:id.jsonFetch a single layer.Get Single
POST/api/v2/layers.jsonCreate a new layer (GeoJSON & XYZ only).Create
PUT/api/v2/layers/:id.jsonUpdate a single layers.Update
DELETE/api/v2/layers/:id.jsonDelete a single layer.Delete

Query Parameters

ParameterTypeDescription
pageintegerThe page number requested.
per_pageintegerNumber of items per page. By default, all requests are paginated to the maximum value of 20,000 items per request.

Properties

PropertyTypeRequiredReadonlyDescription
namestringyesnoThe name of the layer.
typestringyesnoThe layer type (geojson, xyz).
sourcestringyesnoThe layer source.
descriptionstringnonoOptional layer description.
boundsarraynoyesThe layer bounds.
centernumbernoyesThe layer center.
maxzoomnumbernoyesThe layer maximum zoom.
minzoomnumbernoyesThe layer minimum zoom.
access_tokenstringyesnoThe layer access token.
idstringnoyesThe id of the layer.
created_atstringnoyesTimestamp when the layer was created.
updated_atstringnoyesTimestamp when the layer was last updated.
file_sizenumbernoyesThe file size (for mbtiles).

Validations

The following properties must be included in order to create/update a layer object in our system. Any validation errors will return a 422 and an object with a list of validation errors.

Required Properties

PropertyTypeDescriptionExample
namestringThe name of the layer."USGS Topo"
typestringThe layer type (geojson, xyz)."xyz"
sourcestringThe layer sourc (URL or inline GeoJSON)."http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"

Example validation response if type is not included:

{
  "layer": {
    "errors": {
      "type": ["must be one of xyz, geojson"]
    }
  }
}

Notes

  • The entire layer object is required when making an update. Omitting fields with existing data will result in data loss! The typical workflow for updating an existing layer is to fetch the layer object, modify it, and then submit the PUT request.

Response

{
  "layer": {
    "name": "USGS Topo",
    "description": "USGS Topo Base Map - Primary Tile Cache (http://viewer.nationalmap.gov/example/services/serviceList.html)",
    "source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}",
    "bounds": null,
    "center": null,
    "maxzoom": null,
    "minzoom": null,
    "access_token": null,
    "id": "18e95686-b125-4baa-a263-b9bef2f9fee7",
    "created_at": "2014-10-22T17:07:53Z",
    "updated_at": "2014-10-24T19:21:05Z",
    "type": "xyz",
    "file_size": 0
  }
}

Examples

Get all Layers

cURL
Python
JavaScript
Ruby
curl --request GET 'https://api.fulcrumapp.com/api/v2/layers.json' \
--header 'Accept: application/json' \
--header 'X-ApiToken: {token}'
from fulcrum import Fulcrum
fulcrum = Fulcrum('{token}')

layers = fulcrum.layers.search()

for layer in layers['layers']:
# print(layer)
print(layer['name'])
const { Client } = require('fulcrum-app');
const client = new Client('{token}');

client.layers.all()
.then((page) => {
page.objects.forEach(layer => {
// console.log(layer);
console.log(layer.name);
});
})
.catch((error) => {
console.log(error.message);
});
# Not currently supported

Get a single Layer by ID

cURL
Python
JavaScript
Ruby
curl --request GET 'https://api.fulcrumapp.com/api/v2/layers/:id.json' \
--header 'Accept: application/json' \
--header 'X-ApiToken: {token}'
from fulcrum import Fulcrum
fulcrum = Fulcrum('{token}')

layer = fulcrum.layers.find('{id}')

print(layer['layer'])
const { Client } = require('fulcrum-app');
const client = new Client('{token}');

client.layers.find('{id}')
.then((layer) => {
console.log(layer);
})
.catch((error) => {
console.log(error.message);
});
# Not currently supported

Create a new Layer

cURL
Python
JavaScript
Ruby
curl --request POST 'https://api.fulcrumapp.com/api/v2/layers.json' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-ApiToken: {token}' \
--data '{
"layer": {
"name": "USGS Topo",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
}
}'

from fulcrum import Fulcrum
fulcrum = Fulcrum('{token}')

obj = {
"layer": {
"name": "USGS Topo",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
}
}

layer = fulcrum.layers.create(obj)
print(layer['layer']['id'] + ' has been created!')
const { Client } = require('fulcrum-app');
const client = new Client('{token}');

const obj = {
"name": "USGS Topo",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
};

client.layers.create(obj)
.then((layer) => {
console.log(layer.id + ' has been created!');
})
.catch((error) => {
console.log(error.message);
});
# Not currently supported

Update a Layer

cURL
Python
JavaScript
Ruby
curl --request PUT 'https://api.fulcrumapp.com/api/v2/layers/:id.json' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'X-ApiToken: {token}' \
--data '{
"layer": {
"name": "USGS Topo",
"description": "USGS Topo Base Map - Primary Tile Cache",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
}
}'

from fulcrum import Fulcrum
fulcrum = Fulcrum('{token}')

obj = {
"layer": {
"name": "USGS Topo",
"description": "USGS Topo Base Map - Primary Tile Cache",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
}
}

layer = fulcrum.layers.update('{id}', obj)
print(layer['layer']['id'] + ' has been updated!')
const { Client } = require('fulcrum-app');
const client = new Client('{token}');

const obj = {
"name": "USGS Topo",
"description": "USGS Topo Base Map - Primary Tile Cache",
"type": "xyz",
"source": "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/tile/{z}/{y}/{x}"
};

client.layers.update('{id}', obj)
.then((layer) => {
console.log(layer.id + ' has been updated!');
})
.catch((error) => {
console.log(error.message);
});
# Not currently supported

Delete a Layer

cURL
Python
JavaScript
Ruby
curl --request DELETE 'https://api.fulcrumapp.com/api/v2/layers/:id.json' \
--header 'Accept: application/json' \
--header 'X-ApiToken: {token}'
from fulcrum import Fulcrum
fulcrum = Fulcrum('{token}')

fulcrum.layers.delete('{id}')
print('{id} has been deleted!')
const { Client } = require('fulcrum-app');
const client = new Client('{token}');

client.layers.delete('{id}')
.then((layer) => {
console.log('{id} has been deleted!');
})
.catch((error) => {
console.log(error.message);
});
# Not currently supported
← ProjectsPhotos →
  • Endpoints
  • Query Parameters
  • Properties
  • Validations
    • Required Properties
  • Notes
  • Response
  • Examples
    • Get all Layers
    • Get a single Layer by ID
    • Create a new Layer
    • Update a Layer
    • Delete a Layer
Fulcrum Learning Portal
Download
Fulcrum for AndroidFulcrum for iPhone/iPad
Legal
Terms of ServicePrivacy Policy
Social
TwitterFacebook
Spatial Networks, Inc.
Copyright © 2019 Spatial Networks, Inc.