Keeping Child Profile Data Synced

Fetching a list of child profiles

After you have synced all child 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 child profiles.

Perform the same request to the child 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 child profile IDs. Only child 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/child_profiles?since=2016-05-03T16:00:00-04:00
{
    "_links": {
        "find": {
            "href": "/api/child_profiles/{id}",
            "templated": true
        },
        "next": {
            "href": "/api/child_profiles?page=2&since=2016-05-03T16:00:00-04:00"
        },
        "self": {
            "href": "/api/child_profiles"
        }
    },
    "child_profiles": [
        { "id": 94154 },
        { "id": 35365 },
        { "id": 94047 },
        { "id": 94155 },
        { "id": 94156 },
        { "id": 94157 },
        { "id": 59373 },
        { "id": 94145 },
        { "id": 59374 },
        { "id": 59375 }
    ],
    "total_entries": 24,
    "total_pages": 3
}

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/child_profiles?since=2016-05-03T16:00:00-04:00&page=2

Load a Detailed Child Profile

Once you have a list of child 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/child_profiles/94156
{
    "_links": {
        "caregiver_profiles": {
            "href": "/api/child_profiles/94156/caregiver_profiles"
        },
        "screenings": {
            "href": "/api/child_profiles/94156/screenings"
        }
    },
    "child_profile": {
        "account": "DEMO Account",
        "address1": "920 19 ST S",
        "address2": null,
        "address3": null,
        "adjusted_age": [
            47,
            5
        ],
        "alternate_id": null,
        "birth_weight": null,
        "city": "ST PETERSBURG",
        "country": "United States",
        "county": null,
        "custom_fields": {
            "Blood Type": null,
            "City": null,
            "County": null,
            "Person Completing the Screening": null,
            "Social Security #": null,
            "Type": null
        },
        "date_of_admission": null,
        "dob": "2012-05-29",
        "ethnicity": null,
        "first_name": "Ford",
        "gender": "Male",
        "id": 94156,
        "last_name": "Betty",
        "medical_risk_factors": "No",
        "middle_initial": null,
        "other_agencies_involved": "No",
        "phone": "727-563-6787",
        "primary_home_language": null,
        "program": "Program A",
        "program_id": 2362,
        "provider": null,
        "secondary_home_language": null,
        "state": "Florida",
        "status": "Active",
        "weeks_premature": 0,
        "zip": "33712"
    }
}