Skip to content

Commit fd07eb8

Browse files
committed
create person example
1 parent 7bfd6e6 commit fd07eb8

File tree

3 files changed

+97
-2
lines changed

3 files changed

+97
-2
lines changed

examples/_sidebar.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<a class="list-group-item" href="readPersonDuplicates.php">Read Person Duplicates</a>
1414
<a class="list-group-item" href="readPersonRecordHints.php">Read Person Record Hints</a>
1515
<a class="list-group-item" href="readUserMemories.php">Read User Memories</a>
16+
<a class="list-group-item" href="createPerson.php">Create Person</a>
1617
<a class="list-group-item" href="createAttachSource.php">Create and Attach a Source</a>
1718
<a class="list-group-item" href="triggerThrottling.php">Trigger Throttling</a>
1819
</div>

examples/createPerson.php

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
include_once '_includes.php';
4+
include_once '_header.php';
5+
6+
// Fetch a person if a person id has been provided
7+
if ($_POST['person']) {
8+
echo '<h2>Create Person Response</h2>';
9+
$response = $fs->post('/platform/tree/persons', [
10+
'body' => [
11+
'persons' => [
12+
json_decode($_POST['person'])
13+
]
14+
]
15+
]);
16+
prettyPrint($response);
17+
}
18+
19+
// Show a form if a person id hasn't been provided
20+
else {
21+
?>
22+
<form method="POST">
23+
<label>Person Data:</label>
24+
<textarea name="person">{
25+
"living" : false,
26+
"gender" : {
27+
"type" : "http://gedcomx.org/Male"
28+
},
29+
"names" : [ {
30+
"type" : "http://gedcomx.org/BirthName",
31+
"nameForms" : [ {
32+
"fullText" : "Ebenezer Clark",
33+
"parts" : [ {
34+
"type" : "http://gedcomx.org/Given",
35+
"value" : "Ebenezer"
36+
}, {
37+
"type" : "http://gedcomx.org/Surname",
38+
"value" : "Clark"
39+
} ]
40+
} ],
41+
"preferred" : true
42+
} ],
43+
"facts" : [ {
44+
"type" : "http://gedcomx.org/Birth",
45+
"date" : {
46+
"original" : "29 Nov 1651",
47+
"formal" : "+1651-11-29"
48+
},
49+
"place" : {
50+
"original" : "NEW HAVEN,NEW HAVEN,CONN"
51+
}
52+
}, {
53+
"type" : "http://gedcomx.org/Death",
54+
"date" : {
55+
"original" : "1721",
56+
"formal" : "+1721"
57+
},
58+
"place" : {
59+
"original" : "WALLINGFORD,NEW HAVEN CONN."
60+
}
61+
}, {
62+
"type" : "http://gedcomx.org/Burial",
63+
"date" : {
64+
"original" : "1721",
65+
"formal" : "+1721"
66+
},
67+
"place" : {
68+
"original" : "WALLINGFORD,NEW HAVEN CONN."
69+
}
70+
}, {
71+
"type" : "http://gedcomx.org/Christening",
72+
"date" : {
73+
"original" : "29 Nov 1651",
74+
"formal" : "+1651-11-29"
75+
},
76+
"place" : {
77+
"original" : "NEW HAVEN,NEW HAVEN,CONN"
78+
}
79+
} ]
80+
}
81+
</textarea>
82+
<button>Submit</button>
83+
</form>
84+
<style>
85+
textarea {
86+
display: block;
87+
width: 100%;
88+
height: 300px;
89+
margin-bottom: 1em;
90+
}
91+
</style>
92+
<?php
93+
}
94+
95+
include_once '_footer.php';

examples/oauthResponse.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
include_once '_header.php';
55

66
echo '<h2>OAuth Response</h2>';
7-
echo '<h3>Access Token</h3>';
8-
echo '<pre>', $fs->oauthResponse(), '</pre>';
7+
prettyPrint($fs->oauthResponse());
98

109
include_once '_footer.php';

0 commit comments

Comments
 (0)