BEST PRACTICES 
and what things to avoid
Sometimes the specification is misunderstood, 
or relevant parts of the specification are missed 
or not documented well.
Tip #1 
To specify the type of data returned from a call to the API, 
avoid using .xml and .json on the URL. 
Instead: 
Use Accept header for a GET 
Use Content-Type for a POST and PUT
Examples 
GET /platform/tree/ancestry.xml?person=PS11-234 
VS. 
GET /platform/tree/ancestry?person=PS11-234 
Accept: application/x-fs-v1+xml
Tip #2 
For the media-type header, use the version media type 
instead of “application/xml” or “application/json”
Example 
Accept: application/x-fs-v1+xml 
Accept: application/x-gedcomx-v1+xml
Example
Tip #3 
List media types using commas
Example 
Accept: application/x-gedcomx-v1+xml, 
application/atom+xml,application/xml
Tip #4 
Use the Authorization header instead of the access_token 
stringparameter 
Authorization: Bearer {access_token}
Example 
Authorization: Bearer USYSblahblahblahfsglobal.net
Tip #5 
Access tokens expire after 1 hour of inactivity 
or after 24 hours 
Whichever comes first
Tip #6 
Watch out for conflicting cookies between 
sandbox and production 
Example: access token cookie
Tip #7 
Use the Warning header to understand errors from 
FamilySearch. 
e.g. 
Warning: blah blah blah
Tip #8 
Watch for pending modifications at 
https://familysearch.org/platform/pending-modifications
Example
Tip #9 
Use the “X-FS-Feature-Tag” Header
API Evolution Guide 
Dealing with Change
API Evolution Guide 
Changes regarding the protocol 
Changes regarding resources 
Changes regarding resource representations
Changes Regarding Protocol 
When the FamilySearch API is using HTTP insufficiently or 
incorrectly
Changes Regarding Resources 
Resources are units of information 
• Person in the tree 
• Source description 
• Photo 
• Search results
Changes Regarding Resources 
Resources change because: 
User - merged duplicate people 
System – resource in database is denormalized
Resource Representations Changes 
GEDCOM X for genealogical data 
Extensions for custom and proprietary resources
Resource Representations Changes 
Data format changes - 
adding properties 
removing properties 
changing the datatype of a property value
Changes 
Compatible Changes 
Incompatible Changes
Compatible Changes 
Examples: 
Additive Changes 
Semantically-Equivalent
Incompatible Changes 
Examples: 
Deletion of properties 
Changes to the datatypes of property values
Rollout of Incompatible Changes 
Pending Modifications 
https://familysearch.org/platform/pending-modifications 
HTTP Request Header 
“X-FS-Feature-Tag” 
value is a comma delimited list of labels from the 
pending modification page
Example 
X-FS-Feature-Tag: 
remove-identity-v2-login, 
birth-date-not-considered-death-declaration
Tip #10 
Use Hypermedia to drive your application state
Reason 
• In case of compatible changes, your client is: 
• More adaptable 
• More Robust 
• More Maintainable 
• Less Pain
Reason 
• The API makes compatible changes without breaking the 
clients 
• The client detect changes to resources through the 
hypermedia

Api best practices

Editor's Notes

  • #3 That said, FamilySearch recognizes that writing forward-compatible and backward-compatible software is a challenge and requires a good understanding of the supporting specifications.
  • #4 You can send both. Reason - helps with caching
  • #6 Reason - Stay compatable
  • #9 Reason - ask for all supported media types at the same time. Put in priority order
  • #11 OAuth 2 bearer token protocol. Helps with security and caching
  • #14 We recommend using a different browser for logging in to the Family Tree sandbox web client than you use to log in to the production system. The reason is that cookies for the sandbox web client can conflict with cookies from our production site.
  • #19 The applications that FamilySearch develops are active, living systems. New features are added, old functionality is pruned, and bugs are fixed. While change is generally considered to be a good thing, it is often very difficult to manage. This is especially true for software developers who are particularly concerned with making sure that the software they produce is stable and functioning properly.
  • #20 A lot of effort has been applied to the FamilySearch API to align it with the principles of API design and best practices that have been tested and proven in the technology industry. Many of these principles and practices are built on the architecture of the World Wide Web and have been formalized by experts who have successfully applied that architecture to real-world highly-adaptable APIs.