Schema and Resource Layout

Viewing the Schema

To return a list of all available resources on the API we can do the following:

https://api.caremessenger.co.uk/v2?format=json

Which would return something like

{
    "customer": "http://172.17.10.222:8000/v2/customer",
    "site": "http://172.17.10.222:8000/v2/site",
    "user": "http://172.17.10.222:8000/v2/user",
    "resident": "http://172.17.10.222:8000/v2/resident-temp",
    "customer-admin": "http://172.17.10.222:8000/v2/customer-admin",
    "staff": "http://172.17.10.222:8000/v2/staff",
    "supporter": "http://172.17.10.222:8000/v2/supporter",
    "supporter-resident-association": "http://172.17.10.222:8000/v2/supporter-resident-association",
    "set-top-box": "http://172.17.10.222:8000/v2/set-top-box",
    "set-top-box-log": "http://172.17.10.222:8000/v2/set-top-box-log",
    "message-set": "http://172.17.10.222:8000/v2/message-set",
    "message-recipient": "http://172.17.10.222:8000/v2/message-recipient",
    "message-image": "http://172.17.10.222:8000/v2/message-image",
    "message-video": "http://172.17.10.222:8000/v2/message-video",
    "scheduled-message-set": "http://172.17.10.222:8000/v2/scheduled-message-set",
    "scheduled-message-set-rule": "http://172.17.10.222:8000/v2/scheduled-message-set-rule",
    "pusher-log": "http://172.17.10.222:8000/v2/pusher-log",
    "webhook": "http://172.17.10.222:8000/v2/webhook",
    "webhook-log": "http://172.17.10.222:8000/v2/webhook-log",
    "mobile-device": "http://172.17.10.222:8000/v2/mobile-device",
    "assistance-provider": "http://172.17.10.222:8000/v2/assistance-provider",
    "assistance-request": "http://172.17.10.222:8000/v2/assistance-request",
    "assistance-request-status": "http://172.17.10.222:8000/v2/assistance-request-status"
}

List and Detail Endpoints on Resources

For each resource available on the API, at a minimum there is a list and detail endpoint available. Using the site resource as an example, you would request a list of sites by sending a GET request to the following URI

List Endpoint

https://api.caremessenger.co.uk/v2/site

Sample Response

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 28,
            "name": "Acacia Avenue",
            "slug": "acacia-avenue",
            "customer": 18,
            "created": "2015-02-03T09:11:55.962689Z",
            "modified": "2015-02-03T09:11:56.007253Z",
            "lat": null,
            "lon": null,
            "is_active": true,
            "calendar": 28
        },
        {
            "id": 30,
            "name": "Main Road",
            "slug": "main-road",
            "customer": 18,
            "created": "2015-02-05T10:44:34.668606Z",
            "modified": "2015-02-05T12:09:49.329011Z",
            "lat": null,
            "lon": null,
            "is_active": true,
            "calendar": 30
        }
    ]
}

You could then request details regarding a specific site by appending the site’s id to the URI

Detail Endpoint

https://api.caremessenger.co.uk/v2/site/28

Sample Response

{
    "id": 28,
    "name": "Muskham View",
    "slug": "muskham-view",
    "customer": 18,
    "created": "2015-02-03T09:11:55.962689Z",
    "modified": "2015-02-03T09:11:56.007253Z",
    "lat": null,
    "lon": null,
    "is_active": true,
    "calendar": 28
}

Note

Detail endpoints will always return just the single object, the count and pagination fields will not be present. For more information regarding pagination please see Pagination and Filtering