Skip to content
Torben Barsballe edited this page Jun 18, 2015 · 10 revisions

API Endpoint to support icon use in style editor:

  • app/api/icons/list

    • GET - List of global icons.
  • app/api/icons/list/<workspace>

    • GET - List of icons contained in workspace.
  • app/api/icons

    • PUT - Upload any number of icons to the global styles directory.
  • app/api/icons/<workspace>

    • PUT - Upload any number of icons to the workspace.
  • app/api/icons/<filename.png>

    • GET - direct access to icon in the global styles directory.

    • DELETE

  • app/api/<workspace>/icons/<filename.png>

    • GET - direct access to icon in workspace.

    • DELETE

Icons formats:

  • gif: image/gif
  • jpeg: image/jpeg
  • jpg: image/jpeg
  • png: image/png
  • svg: image/svg+xml
  • properties: text/x-java-properties
  • ttf: application/font-sfnt

List

List of icons available for use when editing a style.

  • GET /api/icons/list
  • GET /api/icons/list/<workspace>

HTTP 200 OK:

[{"name":"<filename.png>",
  "mime":"image/png",
  "format":"png",
  "modified": <date>
  "url": "<url>",
  "used":true,
 }
]

api/icons/<workspace>:

PUT Icons

Upload provided file(s) to the global or workspaces styles folder.

  • PUT /api/icons
  • PUT /api/icons/<workspace>

Request body is a multipart form data value, allowing multiple files to be uploaded. File names are preserved, filename extension should and mime type are checked.

Files that do not match a supported file extension (i.e. matching a mime-type) are ignored and not copied to the workspace styles folder (check logs for warnings).

Example Request:

Response:

  • HTTP 201 CREATED - list of modified icons (same format as GET )

<a name="get"/a>

GET Icon

Direct raw access to icon:

  • api/icons/<filename.png>
  • api/icons/<workspace>/<filename.png>

The response mime type is based on the file extension.

api/icons/<workspace>/<filename.png>:

<a name="delete"/a>

DELETE Icon

Delete indicated icon:

  • DELETE /api/icons/<filename.png>
  • DELETE /api/icons/<workspace>/<filename.png>

Response:

  • HTTP 204 No Content - resource was successfully removed

Response body will be empty.

Clone this wiki locally