-
Notifications
You must be signed in to change notification settings - Fork 2
x[DRAFT] Read Sources
This document applies to web apps that use PHP to connect to the FamilySearch API. Explanations, suggestions, and code samples are provided for the following read sources operations.
- Read Person Sources
- Read Relationship Sources
- Read User Source Box Sources
- Read Source Box Folder Sources
- Read Source References
- Establish the operating environment described in the FamilySearch PHP SDK Authentication document. You should have the PHP SDK library (gedcomx-php) loaded, a PHP server running, and an access token retrieved.
Place the example files in your FamilySearch PHP SDK test project directory. Copy or download a zip file of the Read Sources example files. At this point, make sure you have the following files in your project directory:
familysearch-auth.php
read-person-sources.php
read-relationship-sources.php
read-source-box.php
read-folder-sources.php
read-source-references.php
When you read the sources of a specified object such as a person or a relationship, you receive the following:
- Links to the previous, next, and current sources for the object.
- Collection information
- Notes about each source
- Contributor information
Read object sources if you want to find or list the sources provided for that object.
####Sample Code—Read Object Sources
In your browser, access the read-object-sources.php
file in your PHP SDK project directory (at http://localhost:5000/read-object-sources.php if you are using the embedded server), and examine the information displayed.
When you read sources contributed by a specified user, you receive the following:
- Links to the previous, next, and current source provided by a specified user
- The source collection.
- The source contributor.
- The source notes.
The information you read is cached in local memory so that you can potentially increase the performance of your app. See the Caching guide, to consider how caching can increase performance.
Read person user sources when you want to know the sources that the current user contributed.
####Sample Code—Read User Sources
In your browser, access the read-person-memories.php
file (at http://localhost:5000/read-person-memories.php if you are using the embedded server) and enter a PID of a person in your sandbox. You can get a PID by logging in to your sandbox and viewing a person's information.
The app will access the read-user-sources.php
file in your PHP SDK project directory and display sources that the current user submitted.
When you read the sources of a folder, you receive the following:
- Links to the previous, next, and current source descriptions.
- Collection information
- Notes about each source
- Contributor information
Read folder sources if you want to find or list the sources contained in that folder.
####Sample Code—Read Folder Sources
In your browser, access the read-folder-sources.php
file in your PHP SDK project directory (at http://localhost:5000/read-folder-sources.php if you are using the embedded server), and examine the information displayed.
When you read the source references to a specified source, you receive the following:
- Links to the previous, next, and current source reference.
- A link to the object (person or relationship) referencing the source.
- The source collection.
- The source contributor.
- The source notes.
Read source references if you want to find or list all objects that refer to a specific source.
####Sample Code—Read Source References
In your browser, access the read-source-references.php
file in your PHP SDK project directory (at http://localhost:5000/read-source-references.php if you are using the embedded server), and examine the information displayed.
#Congratulations!
You have just used the FamilySearch PHP SDK to access Family Tree sources in four different ways.
For more PHP SDK sample code see the PHP SDK functional test suite.