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": "66bfb4bc9ab4e3d6eb734912",
    "archived": false,
    "created": "2024-08-16 20:21:16",
    "file": "/douglas-court-brochure.213lp9.pdf",
    "location": "66bfb4bb9ab4e3d6eb734900",
    "modified": "2024-08-16 20:21:16",
    "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": "66bfb4bc9ab4e3d6eb734910",
            "file": "/account-brochure.pa78bl.pdf",
            "name": "Account brochure"
        },
        {
            "_id": "66bfb4bc9ab4e3d6eb734912",
            "file": "/douglas-court-brochure.213lp9.pdf",
            "name": "Douglas Court brochure"
        },
        {
            "_id": "66bfb4bc9ab4e3d6eb734914",
            "file": "/upton-house-brochure.danbmi.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": "66bfb4bc9ab4e3d6eb734912",
    "archived": false,
    "created": "2024-08-16 20:21:16",
    "file": "/douglas-court-brochure.213lp9.pdf",
    "location": "66bfb4bb9ab4e3d6eb734900",
    "modified": "2024-08-16 20:21:16",
    "name": "Douglas Court brochure",
    "ref": "DCB"
}