Literature items

An item of literature that can be sent/shared with care seekers, service users or service user contacts.

The literature item object

Attributes

  • _id
    string

    A unique Id for the literature item.

  • archived
    string

    Flag indicating if the item of literature is archived.

  • created
    string

    The date/time the literature item was created.

  • file
    string

    A URL for the literature item's file (e.g. a PDF).

  • location
    string

    Literature can be added to the account and available to select for all locations (e.g. a brand brochure), or it can be added against a location so that it is only available to select for just that location (e.g. a care home brochure).

  • modified
    string

    The date/time the literature item was modified.

  • name
    string

    A name for the item of literature.

  • ref
    string

    A unique human friendly reference for the item of literature.

The literature item object
{
    "_id": "6724fbc74f73a2cebf63780c",
    "archived": false,
    "created": "2024-11-01 16:03:19",
    "file": "/douglas-court-brochure.w9sskv.pdf",
    "location": "6724fbc74f73a2cebf6377fa",
    "modified": "2024-11-01 16:03:19",
    "name": "Douglas Court brochure",
    "ref": "DCB"
}

List all literature items

Return a list of literature items for your account on CareHQ.

Parameters

  • attributes
    optional
    default ['_id']

    A list of attributes to include for fetched objects.

  • filters-account
    optional
    default unset

    A filter that allows literature items to be filtered by whether they are available at account level or not.

    • unset
    • yes
    • no
  • filters-archived
    optional
    default no

    A filter that allows literature items that are currently archived to be included or excluded.

    • unset
    • yes
    • no
  • filters-ids
    optional

    A filter that accepts a list of Ids and filters the items returned to those with an Id in the list.

  • filters-location
    optional

    A filter that accepts a list of location Ids and filters literature items by the location they relate to.

  • filters-modified_after
    optional

    A filter that accepts a date/time and filters the items returned to those modified after the date/time.

  • filters-modified_before
    optional

    A filter that accepts a date/time and filters the items returned to those modified before the date/time.

  • filters-q
    optional

    A case insensitive keyword filter applied to the following fields; name, ref.

  • page
    optional
    default 1

    The page number to fetch.

  • per_page
    optional
    default 10

    The number of items to return per page.

  • sort_by
    optional
    default _id

    A list of fields the returned items can be sorted by. Fields prefixed with minus (-) sign are sorted in descending order.

    • _id
    • created
    • modified
    • name

Response

Returns a page of literature items.

GET
/v1/literature-items
var literatureItems = apiClient.Request(
    HttpMethod.Get,
    "literature-items",
    new MultiValueDict()
        .Add("attributes", "name")
);
<?php

$literature_items = $api_client->request(
    'GET',
    'literature-items',
    [
        'attributes'=>['name']
    ]
);
literature_items = api_client(
    'GET',
    'literature-items',
    params={
        'attributes': ['name', 'file']
    }
)
literature_items = api_client.request(
    'GET',
    'literature-items',
    params: {
        'attributes' => ['name']
    }
)
Response
{
    "item_count": 3,
    "items": [
        {
            "_id": "6724fbc74f73a2cebf63780a",
            "file": "/account-brochure.ljiord.pdf",
            "name": "Account brochure"
        },
        {
            "_id": "6724fbc74f73a2cebf63780c",
            "file": "/douglas-court-brochure.w9sskv.pdf",
            "name": "Douglas Court brochure"
        },
        {
            "_id": "6724fbc74f73a2cebf63780e",
            "file": "/upton-house-brochure.z5cfkq.pdf",
            "name": "Upton House brochure"
        }
    ],
    "page": 1,
    "page_count": 1,
    "per_page": 10
}

Retrieve an item of literature

Retrieve a literature item object.

Response

Returns a literature item object.

GET
/v1/literature-items/<literature_item_id>
var literatureItem = apiClient.Request(
    HttpMethod.Get,
    $"literature-items/{literatureItemId}"
);
<?php

$literature_item = $api_client->request(
    'GET',
    'literature-items/' . $literature_item_id
);
literature_item = api_client(
    'GET',
    f'literature-items/{literature_item_id}'
)
literature_item = api_client.request(
    'GET',
    "literature-items/#{literature_item_id}"
)
Response
{
    "_id": "6724fbc74f73a2cebf63780c",
    "archived": false,
    "created": "2024-11-01 16:03:19",
    "file": "/douglas-court-brochure.w9sskv.pdf",
    "location": "6724fbc74f73a2cebf6377fa",
    "modified": "2024-11-01 16:03:19",
    "name": "Douglas Court brochure",
    "ref": "DCB"
}