Tasks API

Clients, friends and professionals can all be assigned tasks,which track some action the user needs to take within the Minddistrict platform.

Definition

A task can be in different states: when the task is created it is in state pending, and when the user completes the task by taking the required action the task moves to state done. The task API focuses on pending tasks, since these are the most important for end users.

A task contains a title and message, suitable for display to the end user, and a URL within the Minddistrict platform. A logged-in user who visits that URL will find the information they need to complete the task (in some cases simply visiting the URL is enough).

Note

As well as the url value which can be used as the target of a hyperlink displayed to end users, the JSON object representing a task contains a @url metadata key. This key is used throughout the API for the canonical URL for a resource within the API; it represents the task itself, and should not be displayed to end users.

Discovering tasks

To discover the URLs for accessing tasks for a particular user, send a GET request to the URL of that user, and look for the @links metadata. The following links will be available:

Description of the task links discoverable via a client, a friend or via a professional

Name

URL for

tasks

The tasks endpoint which reports metadata about the user’s tasks.

tasks.items

Listing pending tasks.

You can also find these links in the Changes API, reported whenever a client’s or professional’s tasks are updated.

Note

While you can probably guess these URLs from their names, we recommend you use the discovery mechanism rather than concatenating strings to generate the URLs your application will access. We do not guarantee that the URL structure will be predictable (e.g. we may choose to serve some resources from different locations for performance reasons), but you can always trust the URLs reported in @links.

View pending tasks

To view the pending tasks for a particular user, send a GET request to the tasks.items URL. This URL is discoverable in the @links metadata of

Here we show a client request; the request for a friend or a professional will be similar.:

GET /api/2/c/cb7bae66c0104b15ac661931811fe365/tasks/items HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABfxfsnijSVf9Tfcer0JhzekIF--SYw4ckwGJXCHGVX6LJAEZkTj6HOs3gGH8OsvcZ4PLSJp-x68spXU3S0xKlEvN5U5ECJx4EdyV7mQUOOhtxfyXfI5wHbL0x3KvizNUMGkFwYgsUvWLMZg7WVvvCuyH_XMlA3LLK4Rvmel0ZRR4CSJ_D1sOCblhrx6Ku3wHmKoeiE

The response will be the list of pending tasks for that user.:

HTTP/1.0 200 Ok
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 714
Content-Type: application/json;charset=UTF-8

{
    "@items": [
        {
            "@changes": {
                "creation_time": "2020-12-01T08:13:31",
                "modification_time": "2020-12-01T08:13:31"
            },
            "@type": "http://ns.minddistrict.com/task",
            "@url": "https://customer.minddistrict.com/api/2/c/cb7bae66c0104b15ac661931811fe365/tasks/t.6",
            "message": "Assignment \"Mijn ADHD\" available in \"ADHD\".",
            "title": "Assignment available",
            "url": "https://customer.minddistrict.com/c/cb7bae66c0104b15ac661931811fe365/tasks/t.6"
        }
    ],
    "@links": [],
    "@paging": {
        "found": 1,
        "limit": null,
        "start": null,
        "total": null
    }
}

Tasks container view

To view metadata about a user’s pending tasks, send a GET request to the tasks URL. This URL is discoverable in the @links metadata of

Here we show a client request; the request for a friend or a professional will be similar.:

GET /api/2/c/cb7bae66c0104b15ac661931811fe365/tasks HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABfxfsnijSVf9Tfcer0JhzekIF--SYw4ckwGJXCHGVX6LJAEZkTj6HOs3gGH8OsvcZ4PLSJp-x68spXU3S0xKlEvN5U5ECJx4EdyV7mQUOOhtxfyXfI5wHbL0x3KvizNUMGkFwYgsUvWLMZg7WVvvCuyH_XMlA3LLK4Rvmel0ZRR4CSJ_D1sOCblhrx6Ku3wHmKoeiE

Will trigger this result:

HTTP/1.0 200 Ok
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 327
Content-Type: application/json;charset=UTF-8

{
    "@links": [
        {
            "name": "items",
            "url": "https://customer.minddistrict.com/api/2/c/cb7bae66c0104b15ac661931811fe365/tasks/items"
        }
    ],
    "@type": "http://ns.minddistrict.com/tasks",
    "@url": "https://customer.minddistrict.com/api/2/c/cb7bae66c0104b15ac661931811fe365/tasks"
}