Client API

The Minddistrict API to access and modify client data is accessible under the sub-URL /c of the API. In addition to the basic user account API, the Client API provides:

Client JSON object

Information about clients in the Minddistrict API is transferred as json objects containing the following information:

Name

Value

Explanation

Value type

Notes

first_name

First name

-

String

Required
infix

Infix

-

String

last_name

Last name

-

String

Required
active

Active

Uncheck to deactivate the user acount. The user can not log in to the platform as long as the account is inactive.

Boolean

Required
external_source

External source of information

Name of the external information source or API user identifier. Can be empty. Should not be set by users nor API interaction. Based on this value and the corresponding configuration setting manual updates can be disallowed.

String

Read-only
email

Email address

The email address is used as login name for the platform. It should be unique in the platform. It may not contain uppercase characters.

String

Required
picture

Profile picture

You can upload a profile picture.

File

Setting-dependent
labels

Labels

Clients don’t see which labels are assigned to them.

List of labels

Setting-dependent
age

Age

-

Integer

Required, Read-only
gender

Gender

-

Choice: m, f, other or unknown

Required
date_of_birth

Date of birth

-

Date

Required, Setting-dependent
phone_number

Telephone number

-

String

Setting-dependent
id

Client ID

ID of the client, should be unique in the platform.

String

Setting-dependent
bsn

BSN

BSN of the client, should be unique in the platform.

String

Setting-dependent
name

Name

-

String

Required, Read-only

The @type meta information for this object is: http://ns.minddistrict.com/client.

Note

Depening on per-platform configuration, some fields are not available. Or, if made available they can be set to required as well. The presence of fields in the object serialization and what fields and values are allowed in the add and modification requests follow the platform’s configuration.

In other words, the examples below may contain not all fields that a specific platform enabled or requires or may contain fields that have been disabled in a certain platform configuration.

Notable examples of such fields are id, bsn, and telephone number fields.

Listing clients

To get a list of all client objects send a GET request to the API base URL with c/items appended:

GET /api/2/c/items HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440

The response will be a list of client objects and friend objects:

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

{
    "@items": [
        {
            "@changes": {
                "creation_time": "2021-03-31T06:48:46",
                "modification_time": "2021-03-31T06:48:49"
            },
            "@type": "http://ns.minddistrict.com/client",
            "@url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e",
            "active": true,
            "age": 51,
            "date_of_birth": "1970-01-01",
            "email": "wendy@example.com",
            "external_source": null,
            "first_name": "Wendy",
            "gender": "f",
            "infix": "",
            "labels": [
                "be6e40f0-a3b4-486b-a1c7-f9b97b483b00"
            ],
            "last_name": "Darling",
            "name": "Wendy Darling",
            "picture": {
                "@type": "link",
                "content_type": "image/jpeg",
                "filename": "../../fixtures/profile.jpg",
                "size": 4488,
                "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/preferences/picture/picture/f129fbd4d2af4b34bda1bfc7e923f200"
            }
        },
        {
            "@changes": {
                "creation_time": "2021-03-31T06:48:47",
                "modification_time": "2021-03-31T06:48:47"
            },
            "@type": "http://ns.minddistrict.com/friend",
            "@url": "https://customer.minddistrict.com/api/2/c/2c0b35bd1215411fbac68e1c17388dd4",
            "active": true
        },
        {
            "@changes": {
                "creation_time": "2021-03-31T06:48:47",
                "modification_time": "2021-03-31T06:48:47"
            },
            "@type": "http://ns.minddistrict.com/client",
            "@url": "https://customer.minddistrict.com/api/2/c/8eed290c804a408dbe0afa07fb2f1a1a",
            "active": true,
            "age": 51,
            "date_of_birth": "1970-01-01",
            "email": "michael@example.com",
            "external_source": null,
            "first_name": "Micha\u00ebl",
            "gender": "m",
            "infix": "",
            "labels": null,
            "last_name": "Darling",
            "name": "Micha\u00ebl Darling",
            "picture": null
        },
        {
            "@changes": {
                "creation_time": "2021-03-31T06:48:47",
                "modification_time": "2021-03-31T06:48:47"
            },
            "@type": "http://ns.minddistrict.com/client",
            "@url": "https://customer.minddistrict.com/api/2/c/3bc6a30f3fdc46fdaba7aac43f0e6e42",
            "active": true,
            "age": 51,
            "date_of_birth": "1970-01-01",
            "email": "gwendoline@example.com",
            "external_source": null,
            "first_name": "Gwendoline",
            "gender": "f",
            "infix": "",
            "labels": null,
            "last_name": "Darling",
            "name": "Gwendoline Darling",
            "picture": null
        }
    ],
    "@links": [],
    "@paging": {
        "found": 4,
        "limit": null,
        "start": null,
        "total": null
    }
}

Clients search API

A simple search API is available on the client items endpoint. To search send a POST request to the API base URL with c/items appended. Put the JSON encoded search query parameters in the body of the request:

POST /api/2/c/items HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 41
Content-Type: application/json

{
    "email": "gwendoline@example.com"
}

The response will be a list of client objects:

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

{
    "@items": [
        {
            "@changes": {
                "creation_time": "2021-03-31T06:48:47",
                "modification_time": "2021-03-31T06:48:47"
            },
            "@type": "http://ns.minddistrict.com/client",
            "@url": "https://customer.minddistrict.com/api/2/c/3bc6a30f3fdc46fdaba7aac43f0e6e42",
            "active": true,
            "age": 51,
            "date_of_birth": "1970-01-01",
            "email": "gwendoline@example.com",
            "external_source": null,
            "first_name": "Gwendoline",
            "gender": "f",
            "infix": "",
            "labels": null,
            "last_name": "Darling",
            "name": "Gwendoline Darling",
            "picture": null
        }
    ],
    "@links": [],
    "@paging": {
        "found": 1,
        "limit": null,
        "start": null,
        "total": null
    }
}

The allowed parameters are listed below. All parameters are optional.

Name

Value

Value type

Notes

start

Integer

limit

Integer

active

active

Boolean

bsn

bsn

String

email

email

String

id

client id

String

Multiple parameters will be “AND”ed together. Currently you cannot search for items that have no value set for given parameter. This might change in at a later stage.

Adding a new client

To add a client send a POST request to the API base URL with /c appended. Put the JSON encoded data for the new client in the body of the request:

POST /api/2/c HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 164
Content-Type: application/json

{
    "active": false,
    "date_of_birth": "1961-02-18",
    "email": "john@example.com",
    "first_name": "John",
    "gender": "m",
    "last_name": "Darling"
}

The response will return the newly created client object:

HTTP/1.0 201 Created
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 588
Content-Type: application/json;charset=UTF-8
Location: https://customer.minddistrict.com/api/2/c/2ea86463363e45dba82087062d7c327b

{
    "@changes": {
        "creation_time": "2021-03-31T06:48:52",
        "modification_time": "2021-03-31T06:48:52"
    },
    "@type": "http://ns.minddistrict.com/client",
    "@url": "https://customer.minddistrict.com/api/2/c/2ea86463363e45dba82087062d7c327b",
    "active": false,
    "age": 60,
    "date_of_birth": "1961-02-18",
    "email": "john@example.com",
    "external_source": "3db8f91e6bf34ea3987997051ad08dc4",
    "first_name": "John",
    "gender": "m",
    "infix": "",
    "labels": null,
    "last_name": "Darling",
    "name": "John Darling",
    "picture": null
}

If the active flag was set to true, a welcome email will be sent to the client. If the flag was false, no email will be sent and the client will not be able to access the Minddistrict platform.

View a client

To view a client send a GET request to the URL of the client:

GET /api/2/c/c4a1446b21674c82b9cde931b5be1b3e HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440

The response will be the corresponding client object:

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

{
    "@changes": {
        "creation_time": "2021-03-31T06:48:46",
        "modification_time": "2021-03-31T06:48:49"
    },
    "@links": [
        {
            "name": "activation",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/activation"
        },
        {
            "name": "application",
            "url": "https://customer.minddistrict.com/api/2"
        },
        {
            "name": "catalogue.selfhelp.items",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/catalogue/items"
        },
        {
            "name": "conversations",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/conversations"
        },
        {
            "name": "diary",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/diary"
        },
        {
            "name": "diary.configuration",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/diary/configuration"
        },
        {
            "name": "diary.entries",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/diary/entries"
        },
        {
            "name": "diary.entries.items",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/diary/entries/items"
        },
        {
            "name": "diary.entries.schemas",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/diary/entries/schemas"
        },
        {
            "name": "planning",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/planning"
        },
        {
            "name": "planning.ics",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/planning/ics"
        },
        {
            "name": "planning.items",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/planning/items"
        },
        {
            "name": "relations",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations"
        },
        {
            "name": "relations.items",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/items"
        },
        {
            "name": "tasks",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/tasks"
        },
        {
            "name": "tasks.items",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/tasks/items"
        },
        {
            "name": "tools",
            "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/tools"
        }
    ],
    "@type": "http://ns.minddistrict.com/client",
    "@url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e",
    "active": true,
    "age": 51,
    "date_of_birth": "1970-01-01",
    "email": "wendy@example.com",
    "external_source": null,
    "first_name": "Wendy",
    "gender": "f",
    "infix": "",
    "labels": [
        "be6e40f0-a3b4-486b-a1c7-f9b97b483b00"
    ],
    "last_name": "Darling",
    "name": "Wendy Darling",
    "picture": {
        "@type": "link",
        "content_type": "image/jpeg",
        "filename": "../../fixtures/profile.jpg",
        "size": 4488,
        "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/preferences/picture/picture/f129fbd4d2af4b34bda1bfc7e923f200"
    }
}

This endpoint is also reachable via auxiliary URLs.

Editing a client

To modify client data send a PATCH request to the URL of the client with the modification contained in the body:

PATCH /api/2/c/c4a1446b21674c82b9cde931b5be1b3e HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 29
Content-Type: application/json

{
    "first_name": "James"
}

Please refer to Activating a client to change the active flag of a client.

This endpoint is also reachable via auxiliary URLs.

Activating a client

To activate or deactivate a client send a POST request to the URL of the client with /activation appended. Insert a JSON object in the body of the request with the relevant attributes:

POST /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/activation HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 23
Content-Type: application/json

{
    "active": false
}

When activating a client the parameter send_email controls whether and what kind of email will be sent. For a value of no no email is sent. For a value of welcome a welcome email is sent: this is the same email a client gets when they are added to the platform for the first time. For a value of activation an email will be sent that simply tells the client that their account has been activated.:

POST /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/activation HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 51
Content-Type: application/json

{
    "active": true,
    "send_email": "welcome"
}

The activation endpoint accepts the following parameters in the body of its request:

Name

Value

Value type

Notes

active

active

Boolean

Required
send_email

Type of (de)activation message.

Choice: activation, welcome or no

When deactivating a client by default an email is sent to the client informing them of the deactivation. When the send_email parameter is passed with a value of no such an email is not sent.:

POST /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/activation HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 47
Content-Type: application/json

{
    "active": false,
    "send_email": "no"
}

When a request is sent to activate a client who is already active, nothing happens, and the response has a 400 (error) status code. An email is also not sent.

When a request is sent to deactivate a client who is already inactive, nothing happens, and the response has a 400 (error) status code. An email is also not sent.

Merging clients

To merge one client into another send a POST request to the URL of the client you want to keep with /merge appended. The body of the request should be a client reference (given by either the id or canonical URL) to the client you want to have merged into the first client:

POST /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/merge HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtS8Ua9Pcla5dnUix2uJFPm0HT900z-5Y8-zrdwkYL8si-LAOjmPHwF-9ttGIQZ3emBV9IVe2F03-A7M1h0NTO4VrqQxdsKLhkJauBHDSaJk2un3c8_URGlF5EQ0Hu48G6ZVJhWNJum4hA7XLgzwl2kvbsPezsP7QdvWj91n227SGS4nGA-FmNuUhyE2462bOw2
Content-Length: 22
Content-Type: application/json

{
    "id": "123abc"
}

The client whose id or url is passed in will be completely merged into the client whose URL the request is sent to. All the tools will be transferred to the latter and that client will be the only one remaining.

Client/professional relations

The Client Relations API allows you to manage the relations a client has with various professionals. This has multiple effects within the Minddistrict platform; in particular privacy-sensitive information about a client is generally only visible to related professionals, and related professionals may get assigned tasks specific to that client.

A professional can have two types of relations with a client: attends and supervises. When a professional is a therapist treating the client an attends relation should be used. When a professional does not treat the client themself but needs to supervise the treatment a supervises relation should be used. Some organisations may have no use for the supervises relation.

A relation is a JSON object with the following keys:

Name

Value

Value type

professional

Related professional

JSON object

client

Related client

JSON object

predicate

The type of relation

Choice: attends or supervises

The @type meta information for this object is: http://ns.minddistrict.com/relation.

The json object professional contains:

Name

Value

Value type

id

ID

String

url

Canonical URL of the user

String

The json object client contains:

Name

Value

Value type

id

ID

String

url

Canonical URL of the user

String

Listing client/professional relations

To view the relations a client has with professionals, send a GET request to the relations.items URL. This URL is discoverable in the @links metadata of

Example request:

GET /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/items HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPqrhCCvMZaP5HjMI5pXMVZ-Pf1novgNpTI3KU9MDy1NMs2Mo-CPhtMsXMA89_qJjCwSKXBcjXdjmbmYfNIMKkYgxEogXwgsrV4wCERvWwNqdDcpuUfwAh9Y9y9Ogt2qtfuWFZQuDpMNImXc_ftlL1VMnTjUIeWThHCfYdy083adrmcQcZOmNzDFykyt-iRcMl

The response will be the list of relations the client has with professionals:

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

{
    "@items": [
        {
            "@type": "http://ns.minddistrict.com/relation",
            "@url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/da0ad133e303495d9bf6a31d779059c1",
            "client": {
                "@type": "http://ns.minddistrict.com/user-reference/client",
                "id": null,
                "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e"
            },
            "predicate": "attends",
            "professional": {
                "@type": "http://ns.minddistrict.com/user-reference/professional",
                "id": "tina123456",
                "url": "https://customer.minddistrict.com/api/2/p/25a4dd7130d14824a7b97eb5b6a2633c"
            }
        },
        {
            "@type": "http://ns.minddistrict.com/relation",
            "@url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/584ea1dd54e946dc9ba8db5cb45295be",
            "client": {
                "@type": "http://ns.minddistrict.com/user-reference/client",
                "id": null,
                "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e"
            },
            "predicate": "attends",
            "professional": {
                "@type": "http://ns.minddistrict.com/user-reference/professional",
                "id": null,
                "url": "https://customer.minddistrict.com/api/2/p/3db8f91e6bf34ea3987997051ad08dc4"
            }
        }
    ],
    "@links": []
}

Relating a client to a professional

To relate a client to a particular professional, send a POST request to the client’s relations URL. This URL is discoverable in the @links metadata of a client under the name relations.

Specify the relation type ("attends" or "supervises") and the professional to be related (with a professional reference) in the body of the request.

Warning

It is not possible to create multiple relations for the same combination of client, professional and predicate.

The following query:

POST /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440
Content-Length: 133
Content-Type: application/json

{
    "@type": "http://ns.minddistrict.com/relation",
    "predicate": "attends",
    "professional": {
        "id": "p1234"
    }
}

The response will be the relation that was created:

HTTP/1.0 201 Created
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 638
Content-Type: application/json;charset=UTF-8
Location: https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/0293ea8b2680495e8ab1962b5cbc7c78

{
    "@type": "http://ns.minddistrict.com/relation",
    "@url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/0293ea8b2680495e8ab1962b5cbc7c78",
    "client": {
        "@type": "http://ns.minddistrict.com/user-reference/client",
        "id": null,
        "url": "https://customer.minddistrict.com/api/2/c/c4a1446b21674c82b9cde931b5be1b3e"
    },
    "predicate": "attends",
    "professional": {
        "@type": "http://ns.minddistrict.com/user-reference/professional",
        "id": "p1234",
        "url": "https://customer.minddistrict.com/api/2/p/501428e2f3e34bf2a9b49cc9f22e1ddb"
    }
}

When the relation can not be created, an error message is returned:

HTTP/1.0 400 Bad Request
Content-Length: 59
Content-Type: application/json;charset=UTF-8

{
    "code": 400,
    "message": "Invalid new relation."
}

Removing a client/professional relation

To remove the relation between a client and a professional, send a DELETE request to the relation’s URL. You can find the relation in the client’s relations list.

Example request:

DELETE /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations/584ea1dd54e946dc9ba8db5cb45295be HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPh6WxHk6ZVMRNlpozycJz0NO6OoHPDWTOK5IJPue55hF3EB829TOwvNYKu6sORVhTg1O8C4JRat_r7c_s3b7cXT4ZmuWGHsQ-c9MH-2MSyu1wbBeHDlm03ZahY37mNoLaiJ_mL5p0EjYs2vROcJboy0_KMu944oIf6mLmf-7GCu5tsobjm-qxj9M_dev04440

The response will be an HTTP 204 No Content:

HTTP/1.0 204 No Content
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/plain;charset=UTF-8

Relations metadata

To view metadata about the client’s relations container, send a GET request to the relations URL. This URL is discoverable in the @links metadata of

  • a client under the name relations.

Example request:

GET /api/2/c/c4a1446b21674c82b9cde931b5be1b3e/relations HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtPqrhCCvMZaP5HjMI5pXMVZ-Pf1novgNpTI3KU9MDy1NMs2Mo-CPhtMsXMA89_qJjCwSKXBcjXdjmbmYfNIMKkYgxEogXwgsrV4wCERvWwNqdDcpuUfwAh9Y9y9Ogt2qtfuWFZQuDpMNImXc_ftlL1VMnTjUIeWThHCfYdy083adrmcQcZOmNzDFykyt-iRcMl

Will trigger this result:

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

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

Client access log

Information about access to dossiers of clients not in the caseload of the professional is recorded in the “client access log”. This includes searches outside of the professional’s caseload and temporary access requests. The information for the client access log is transferred as json objects containing the following information:

Example request:

GET /api/2/configuration/clientaccess/accesslog/items HTTP/1.1
Host: customer.minddistrict.com
Accept: application/json
Authorization: md-token gAAAAABgZBtSn_EDZUhMvU-PnFgqgpwOy3Bc0k-CFQROZ0jXwhKv2pQQ7KxByhVCzonhFmoJlhMgQeSW4NMxrocj6dP7rX3Wix4uaCu0qZx-75zLEeNHfnmQEggtIPx2ZSJcLzpIfdVPWAPGJhfSe_t_2RSe1WyJgzw7rJMeHShBrXKVGyfnu2u5hdk0LrBThLHUWl1JXl7c

The response will be a list of log record objects:

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

{
    "@items": [
        {
            "@type": "http://ns.minddistrict.com/error/record",
            "@url": "https://customer.minddistrict.com/api/2/configuration/clientaccess/accesslog/1617173330983212",
            "datetime": "2021-03-31T06:48:50",
            "extra": [
                {
                    "message": "6da90637aa9845f1b204bbaebf1c8d38",
                    "name": "client-id"
                },
                {
                    "message": "directly related",
                    "name": "type"
                },
                {
                    "message": "My colleague cannot handle this patient, I will take over",
                    "name": "intention"
                }
            ],
            "message": "Therapist related themself, or requested a relation",
            "user_id": "3ebcbfa7f7d1466baf20ad722a17454b"
        },
        {
            "@type": "http://ns.minddistrict.com/error/record",
            "@url": "https://customer.minddistrict.com/api/2/configuration/clientaccess/accesslog/1617173330983195",
            "datetime": "2021-03-31T06:48:50",
            "extra": [
                {
                    "message": "6da90637aa9845f1b204bbaebf1c8d38",
                    "name": "client-id"
                },
                {
                    "message": "I needed emergency access to the client dossier",
                    "name": "motivation"
                }
            ],
            "message": "Temporary access obtained",
            "user_id": "3ebcbfa7f7d1466baf20ad722a17454b"
        },
        {
            "@type": "http://ns.minddistrict.com/error/record",
            "@url": "https://customer.minddistrict.com/api/2/configuration/clientaccess/accesslog/1617173330983127",
            "datetime": "2021-03-31T06:48:50",
            "extra": [
                {
                    "message": "Emergency situation, I need to find the patient",
                    "name": "motivation"
                },
                {
                    "message": "{\"motivation\": \"Foobar\", \"term1\": \"value1\", \"term2\": 2001, \"term3\": true, \"professional\": \"theo@example.com\"}",
                    "name": "query"
                }
            ],
            "message": "Search outside of caseload",
            "user_id": "3ebcbfa7f7d1466baf20ad722a17454b"
        }
    ],
    "@links": [],
    "@paging": {
        "found": 3,
        "limit": null,
        "start": null,
        "total": 3
    }
}

Log record JSON object

Name

Value

Explanation

Value type

Notes

datetime

When this error happened

-

Date with time

Required
user_id

Internal user ID who triggered this error

-

String

Required
message

Error message

-

String

Required
extra

Extra information

-

List of mapping

The @type meta information for this object is: http://ns.minddistrict.com/error/record.

Note

Access to the temporary access log API requires the API errors role for the API user.