-
Notifications
You must be signed in to change notification settings - Fork 2
Accessing a GEDCOM X RS API
Jimmy Zimmerman edited this page Jul 17, 2015
·
1 revision
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();
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