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 ' ;
0 commit comments