5. A Review
● Web service API
– A set of digital services and/or resources
made accessible over a computer network.
● HTTP
– Hypertext Transfer Protocol
– Defines how to make requests and interpret
responses.
6. A Review
● Resources
– The units of data making up the “matter” of
the API.
– The “subject” of HTTP operations.
● Uniform Resource Identifier
– The locator for a resource.
– Includes a domain, path, query.
7. A Review
● Resource Representations
– How resources are serialized to a stream of
bytes.
– Often JSON and XML.
– a.k.a. “media types” or “data formats”
● See “Architecture of the World Wide Web”
– http://www.w3.org/TR/webarch/
22. What If...
...new resources become available?
Available Resources
● Person
● Relationship
● Person Search
● ...
Available Resources
● Person
● Relationship
● Person Search
● Records
● Record
● Record Search
● ...
23. What If...
...an API changes domains?
https://familysearch.org/platform
https://familysearch.io/platform
24. What If...
...a resource moves?
/platform/tree/persons/12345/matches
/platform/tree/persons/12345/duplicates
25. What If...
...subresources are included
in their “parent” resource?
/person/12345
Person
/person/12345/notes Person
Person
Notes
Source
References
/person/12345/sources
/person/12345
Person
+
Notes
+
Source References
26. What If...
● ...property order changes?
● ...some whitespace is added?
● ...XML changes namespace prefixes?
● ...caching policy changes?
● ...new resources are available?
● ...a resource moves?
● ...subresources are included in their
"parent" resource?
27. What If...
● ...property order changes?
● ...some whitespace is added?
● ...XML changes namespace prefixes?
● ...caching policy changes?
● ...new resources are available?
● ...a resource moves?
● ...subresources are included in their
"parent" resource?
49. What If...
...new resources become available?
Available Resources
● Person
● Relationship
● Person Search
● ...
Available Resources
● Person
● Relationship
● Person Search
● Records
● Record
● Record Search
● ...
50. What If...
...new resources become available?
Available Resources
● Person
● Relationship
● Person Search
● ...
Available Resources
● Person
● Relationship
● Person Search
● Records
● Record
● Record Search
● ...
Hypermedia
62. What If...
...subresources are included
in their “parent” resource?
/person/12345
Person
/person/12345/notes Person
Person
Notes
Source
References
/person/12345/sources
/person/12345
Person
+
Notes
+
Source References
63. What If...
...subresources are included
in their “parent” resource?
<html>
<head>
…
<link rel=”stylesheet” href=”...”/>
<script src=”...”></script>
…
</head>
<body>
…
</body>
</html>
64. What If...
...subresources are included
in their “parent” resource?
<html>
<head>
…
<link rel=”stylesheet” href=”...”/>
<script src=”...”></script>
…
</head>
<body>
…
</body>
</html>
Embedded Links
(Hypermedia)
65. What If...
...subresources are included
in their “parent” resource?
<html>
<head>
…
<link rel=”stylesheet” href=”...”/>
<script src=”...”></script>
…
</head>
<body>
…
</body>
</html>
<html>
<head>
…
<style>
…
</style>
<script>
…
</script>
…
</head>
<body>
…
</body>
</html>
66. What If...
...subresources are included
in their “parent” resource?
<html>
<head>
…
<link rel=”stylesheet” href=”...”/>
<script src=”...”></script>
…
</head>
<body>
…
</body>
</html>
<html>
<head>
…
<style>
…
</style>
<script>
…
</script>
…
</head>
<body>
…
</body>
</html>
HTML says...
“OK”
67. What If...
...subresources are included
in their “parent” resource?
<gedcomx>
<person id=”12345”>
…
<link rel=”source-references”
href=”/persons/12345/sources”/>
<link rel=”notes”
href=”/persons/12345/notes”/>
…
</person>
</gedcomx>
68. What If...
...subresources are included
in their “parent” resource?
<gedcomx>
<person id=”12345”>
…
<link rel=”source-references”
href=”/persons/12345/sources”/>
<link rel=”notes”
href=”/persons/12345/notes”/>
…
</person>
</gedcomx>
Embedded Links
(Hypermedia)
69. What If...
...subresources are included
in their “parent” resource?
<gedcomx>
<person id=”12345”>
…
<link rel=”source-references”
href=”/persons/12345/sources”/>
<link rel=”notes”
href=”/persons/12345/notes”/>
…
</person>
</gedcomx>
<gedcomx>
<person id=”12345”>
…
<source description=”...”/>
<note id=”...”>
…
</note>
</person>
</gedcomx>
70. What If...
...subresources are included
in their “parent” resource?
<gedcomx>
<person id=”12345”>
…
<link rel=”source-references”
href=”/persons/12345/sources”/>
<link rel=”notes”
href=”/persons/12345/notes”/>
…
</person>
</gedcomx>
<gedcomx>
<person id=”12345”>
…
<source description=”...”/>
<note id=”...”>
…
</note>
</person>
</gedcomx>
GEDCOM X says...
“OK”
80. How To...
● Add a person to a collection.
● Search a collection for persons.
● Do a “full” person read.
● Upload an artifact to a collection.
● Edit the birth date of a person.
● Read the list of photos on a person.
● Delete a person.
81. How To...
Add a person to a collection.
● Read the collection.
● Find the link to the “persons” of the
collection.
● POST the new person to that URI.
82. How To...
Add a person to a collection.
● Read the collection.
● Find the link to the “persons” of the
collection.
● POST the new person to that URI.
83. How To...
Add a person to a collection.
GET /platform/collections/tree
<gedcomx xmlns=”http://gedcomx.org/v1”>
<collection>
<title>FamilySearch Family Tree</title>
...
<link rel=”persons” href=”/path/to/persons/resource”/>
...
</collection>
</gedcomx>
84. How To...
Search a collection for persons.
● Read the collection.
● Find the link to the “person-search” of the
collection.
● Fill in the parameters and issue the
request.
85. How To...
GET /platform/collections/tree
<gedcomx xmlns=”http://gedcomx.org/v1”>
<collection>
<title>FamilySearch Family Tree</title>
...
<link rel=”person-search”
template=”/path/to/person/search{?q}”/>
...
</collection>
</gedcomx>
Search a collection for persons.
86. How To...
Do a “full” person read.
● Read the person.
● For each “embedded” link, get the
resource and embed it.
– Source references
– Discussion references
– Notes
– Relationships
87. How To...
Do a “full” person read.
<gedcomx xmlns=”http://gedcomx.org/v1”>
<person id=”P2”>
<name>...</name>
...
<link rel=”source-references” href=”/path/to/refs”/>
<link rel=”notes” href=”/path/to/notes”/>
<link rel=”child-relationships” href=”/path/to/rels”/>
<link rel=”parent-relationships” href=”/path/to/rels”/>
<link rel=”spouse-relationships” href=”/path/to/rels”/>
...
</person>
</gedcomx>
88. How To...
Upload an artifact to a collection.
● Read the collection.
● Find the link to the “artifacts”.
● POST the artifact.
89. How To...
Upload an artifact to a collection.
GET /platform/collections/tree
<gedcomx xmlns=”http://gedcomx.org/v1”>
<collection>
<title>FamilySearch Family Tree</title>
...
<link rel=”artifacts” href=”/path/to/artifacts/resource”/>
...
</collection>
</gedcomx>
90. How To...
Edit the birth date of a person.
● Read the person.
● Find the link to the “conclusions” of the
person.
● POST the changes.
91. How To...
Edit the birth date of a person.
<gedcomx xmlns=”http://gedcomx.org/v1”>
<person id=”P2”>
<name>...</name>
...
<link rel=”conclusions” href=”/path/to/conclusions”/>
...
</person>
</gedcomx>
92. How To...
Read the list of photos on a person.
● Read the person.
● Find the link to the “artifacts” of the
person.
93. How To...
Read the list of photos on a person.
<gedcomx xmlns=”http://gedcomx.org/v1”>
<person id=”P2”>
<name>...</name>
...
<link rel=”artifacts” href=”/path/to/artifacts”/>
...
</person>
</gedcomx>
94. How To...
Delete a person.
● Read the person.
● Find the “self” link.
● Apply the DELETE.
95. How To...
Delete a person.
<gedcomx xmlns=”http://gedcomx.org/v1”>
<person id=”P2”>
<name>...</name>
...
<link rel=”person” href=”/path/to/self”/>
...
</person>
</gedcomx>