Site Admin APIs

  1. Home
  2. Site Admin APIs
  3. Cartography API

Cartography API

For creating and publishing cartographic styles for Layers and Sets.

Custom styles

Spatial layers and sets can have custom styles. And the current time, only style metadata and publishing is handled via the API. Stylesheet editing happens within the web UI, although this is expected to be supported via the API in future.

A style can have one of a number of statuses:

  • NEW - The style has been created but never published.
  • GENERATING - The style is being published for the first time.
  • GENERATING - ERROR - The style failed to publish the first time.
  • ACTIVE - The style is published and active.
  • MODIFIED - The style is active, but a pending change is unpublished.
  • UPDATING - The style is active, but a change is being published.
  • UPDATING - ERROR - A change to the style failed to publish.

Layer style list

GET /layers/{id}/styles/
Get layer or set style list

Returns a list of styles for this layer or set.

Response 200

Headers

Content-Type: application/json

Body

[
    {
        "id": 10,
        "name": "Coloured Boundary Points", 
        "url": "https://{domain}/services/api/v1/layers/123/styles/10/", 
        "state": "NEW", 
        "description": "A fake style for these fake boundary points.", 
        "created_at": "2014-06-27T00:36:52.723Z", 
        "published_at": null, 
        "is_default": false
    }
]
POST /layers/{id}/styles/
Create a new style

name is required.

Request

Body

{
    "name": "Coloured Boundary Points"
}

Response 201

Headers

Location: https://{domain}/services/api/v1/layers/123/styles/10/

Style detail

PUT /layers/{id}/styles/{style}/
Edit a style

Styles in with an exiting state of ACTIVE will become MODIFIED on success.

Request

Body

{
    "name": "Coloured Points"
}

Response 200

Headers

Content-Type: application/json

Body

[
    {
        "id": 10,
        "name": "Coloured Points", 
        "url": "https://{domain}/services/api/v1/layers/123/styles/10/", 
        "state": "NEW", 
        "description": "A fake style for these fake boundary points.", 
        "created_at": "2014-06-27T00:36:52.723Z", 
        "published_at": null, 
        "is_default": false
    }
]
DELETE /layers/{id}/styles/{style}/
Delete a style

Response 204

Style publishing

POST /layers/{id}/styles/{style}/publish/
Publish a style

This starts tile generation processes; once complete, the designated style becomes available.

Response 201

Headers

Content-Type: application/json

Body

[
    {
        "id": 10,
        "name": "Coloured Points", 
        "url": "https://{domain}/services/api/v1/layers/123/styles/10/", 
        "state": "GENERATING", 
        "description": "A fake style for these fake boundary points.", 
        "created_at": "2014-06-27T00:36:52.723Z", 
        "published_at": null, 
        "is_default": false
    }
]

Response 400

Headers

Content-Type: application/json

Body

{
    "not-publishable": "This style cannot be published at this time."
}