Keeping Caregiver Profile Data Synced

Fetching a list of caregiver profiles

After you have synced all caregiver profile data, you can keep them up to date. Save the timestamp of when you started this sync. It will be used when fetching updated versions of caregiver profiles.

Perform the same request to the caregiver profiles index and include a new since parameter. This will be the timestamp of when you last synced. The since parameter should be in the ISO8601 format. This response includes 10 profiles per page, and only the caregiver profile IDs. Only caregiver profiles that have been changed since the since parameter will be included.

curl \
  -H "Accept: application/json" \
  -H "X-Auth-Token: 54f958af0a4e0f272df3a76d63c14f79" \
  https://localhost/api/caregiver_profiles?since=2016-05-03T16:00:00-04:00
{
    "_links": {
        "find": {
            "href": "/api/caregiver_profiles/{id}",
            "templated": true
        },
        "next": {
            "href": "/api/caregiver_profiles?page=2&since=2016-05-03T16:00:00-04:00"
        },
        "self": {
            "href": "/api/caregiver_profiles"
        }
    },
    "caregiver_profiles": [
        { "id": 44233 },
        { "id": 44234 },
        { "id": 44235 },
        { "id": 44236 },
        { "id": 44337 },
        { "id": 45008 },
        { "id": 45009 },
        { "id": 45010 },
        { "id": 45011 },
        { "id": 47118 }
    ],
    "total_entries": 38,
    "total_pages": 4
}

To fetch the second page and on, use the next link provided in the _links object.

curl \
  -H "Accept: application/json" \
  -H "X-Auth-Token: 54f958af0a4e0f272df3a76d63c14f79" \
  https://localhost/api/caregiver_profiles?since=2016-05-03T16:00:00-04:00&page=2

Load a Detailed Caregiver Profile

Once you have a list of caregiver profiles ids, you can begin fetching the detailed profiles. The index response contains a templated response to fetch the profile. This is RFC 6570.

curl \
  -H "Accept: application/json" \
  -H "X-Auth-Token: 54f958af0a4e0f272df3a76d63c14f79" \
  https://localhost/api/caregiver_profiles/45009
{
    "caregiver_profile": {
        "address1": "1 main st.",
        "address2": null,
        "address3": null,
        "alternate_phone": null,
        "city": "littleton",
        "country": "United States",
        "county": null,
        "custom_fields": {
            "Blood Type": null,
            "Eye Color": null
        },
        "email": null,
        "first_name": "john",
        "id": 45009,
        "last_name": "doe",
        "middle_initial": null,
        "phone": "555-555-5555",
        "primary_language": "English",
        "relationship_to_child": "Child care provider",
        "secondary_language": "English",
        "state": "Massachusetts",
        "title": "Mr.",
        "zip": "11720"
    }
}