Skip to content

Tools

Tools are applications built on top of the graph, such as a search or a dashboard. Administrators register them in categories, and clients (e.g. a portal) list them to the users who are meant to see them. MarmotGraph only stores the definitions - the tools themselves run elsewhere.

Defining categories and tools requires the global functionality DEFINE_TOOLS, which comes with the global ADMIN role.

Define a category

POST /v4/tools/categories
Content-Type: application/json

{
  "name": "Search",
  "icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><circle cx=\"10\" cy=\"10\" r=\"7\"/></svg>"
}
  • name is mandatory and unique, ignoring the case.
  • icon is optional: the markup of an SVG document. Clients may embed it into their pages, so it has to be self-contained and passive - no scripts, event handlers, foreignObject, animations, document type or links (href, url(...)) to anything but elements of the icon itself. At most 100000 characters.

PUT /v4/tools/categories/{id} replaces name and icon, DELETE /v4/tools/categories/{id} removes a category once it has no tools anymore.

Define a tool

POST /v4/tools/definitions
Content-Type: application/json

{
  "name": "Dataset search",
  "description": "Full text search over the released datasets",
  "categoryId": "5b0e6f0c-3f8e-4a43-9a51-6d1c2f9e7b10",
  "endpoint": "https://search.example.org",
  "claims": {"groups": ["^/search-users$", "^/curators$"]}
}
  • name, categoryId and endpoint are mandatory, description is optional.
  • endpoint has to be an absolute http or https URL.
  • claims decides who gets the tool listed (see below).

The response contains the id of the tool. GET /v4/tools/definitions lists all definitions, PUT /v4/tools/definitions/{id} replaces one and DELETE /v4/tools/definitions/{id} removes it.

Who sees a tool

claims uses the same format as the claims of a role definition, and it's matched against the user information of the identity provider:

  • {"authenticated": true} lists the tool to every authenticated user.
  • Otherwise the structure mirrors the user information, and the leaves are a regular expression or a list of them, e.g. {"groups": ["^/search-users$"]} or {"realm_access": {"roles": ["curator"]}}. The tool is listed if any expression matches a value of the claim entirely.

Users with DEFINE_TOOLS see all tools. Changes to a definition apply to the listing immediately.

List the tools

GET /v4/tools/categories
GET /v4/tools?category=5b0e6f0c-3f8e-4a43-9a51-6d1c2f9e7b10

The first returns the categories with at least one tool the caller may see, including their icons, sorted by name. The second returns the tools the caller may see, sorted by category and name, without their claims. category is optional.