Downloading a [CET] Tree
A third-party application may need to import data from a [CET] into their data store. This document will offer a general structure for how to do that.
These are the steps follow when importing data from a [CET] into a 3rd Party Application.
- Save the current timestamp.
- Get a list of Person IDs
- Get data for each person
- Get data for each relationship
Save the Current Timestamp
If you plan to keep your application data in sync with the [CET] in FamilySearch using Tree Change History, get the timestamp when you start importing data from FamilySearch. Use this timestamp to call the Tree Change History endpoint, ensuring you capture any changes made during your import that weren't included in your [CET] calls.
Get a List of Person IDs
Use the Tree Persons endpoint with ?view=identifiers
to get all person IDs in a [CET]. Since the API returns paginated results, add each page of IDs to a list. Once all pages are retrieved, you'll have a complete list of tree IDs to work with.
Get Data for Each Person
For each person ID, retrieve the person details and data associated with the person. This includes the person details, sources, relationships, notes, and memories.
Get Person Details, Relationships, and Sources
For each person ID, retrieve their person details, relationships, and sources by using the Person endpoint with `?sourceDescriptions=true`.
Maintain a list of relationships for each Person. This will be used later. As you encounter a relationship on a person object, add it to your list, noting whether it is a couple relationship or parent-child relationship, ensuring that it does not already exist in the list.
Store the person details and the sources in your database. Since sources can be shared by multiple persons and relationship objects, it is important to track the sources stored in your database to avoid duplicates. Either maintain a list of sources that you write, or implement duplicate/collision detection in your database write process.
Get Notes
To get the notes for a person, use the Person Notes endpoint. Calling this endpoint will return the Notes for the requested Person ID. See Read Notes use case for an example.
Store the notes in your database.
Get Memories
To get the memories for a person, use the Person Memories endpoint. See Read Person Memories use case for an example.
Since memories can be shared by multiple person and relationship objects, it is important to track the memories stored in your database to prevent duplicates. Maintain a list of written memories or implement duplicate/collision detection during database writes.
Get Data for Each Relationship
Now that you have a list of relationships, get the notes and the sources for each relationship. When writing sources to your database, keep in mind that these can be shared between objects. Implement a scheme to ensure you don’t create duplicates.
Get Child and Parents Data
To retrieve the notes for a Child and Parents relationship, use the Child and Parents Notes endpoint. See the Read Child and Parents Relationship Notes use case for an example.
To retrieve the sources, use the Child and Parents Sources Query endpoint. See the Read Child and Parents Relationship Sources_use case for an example.
Get Couple Relationship Data
To retrieve notes for a Couple relationship, use the Couple Relationship Notes endpoint. See the Read Couple Relationship Notes use case for an example.
To retrieve the sources, use the Couple Relationship Sources Query endpoint. See the Read Couple Relationship Sources use case for an example.
Updated 4 months ago