Skip to content

Accessing a GEDCOM X RS API

Jimmy Zimmerman edited this page Jul 17, 2015 · 1 revision

Read the Person for the Current User

use Gedcomx\Rs\Client\StateFactory;
use Gedcomx\Rs\Client\PersonState;
use Gedcomx\Conclusion\Person;

/**
 * @var StateFactory
 */
$stateFactory = new StateFactory();

/**
 * @var PersonState
 */
$currentPerson = $stateFactory
    ->newCollectionState("https://sandbox.familysearch.org/platform/collections/tree") //read the collection
    ->authenticateViaOAuth2Password("username", "password", "client_id") //authenticate if needed
    ->readPersonForCurrentUser(); //read the person for the current user

/**
 * @var Person
 */
$person = $currentPerson->getPerson();

Search a Collection for Persons

use Gedcomx\Rs\Client\StateFactory;
use Gedcomx\Rs\Client\PersonSearchResultsState;
use Gedcomx\Conclusion\Person;

/**
 * @var StateFactory
 */
$stateFactory = new StateFactory();

/**
 * @var PersonSearchResultsState
 */
$searchResults = $stateFactory
    ->newCollectionState("https://sandbox.familysearch.org/platform/collections/tree") //read the collection
    ->authenticateViaOAuth2Password("username", "password", "client_id") //authenticate if needed
    ->searchForPersons('givenName:Israel surname:Heaton gender:M birthDate:1880'); //search for Israel Heaton, b. 1880

//process the results

Home

Tutorial

  • Step 1: Register
  • Step 2: Set up your test environment
  • Step 3: Build tutorial.php
  • Step 4: Use the SDK Documentation

Sample App

Documentation

Design

Clone this wiki locally