Update Person With Preconditions

This example request illustrates how to do a conditional update of a person. Note the use of the If-Match, the If-Unmodified-Since request headers, and the result if preconditions failed. In other words, only update if the conditions in the request headers are met.

JSON

Request

POST /platform/tree/persons/12345
If-Unmodified-Since: Sat Dec 01 08:11:07 MST 2018
If-Match: J8Y5VFR
Content-Type: application/x-gedcomx-v1+json
Accept: application/x-gedcomx-v1+json
Authorization: Bearer YOUR_ACCESS_TOKEN_HERE{
  "persons" : [ {
    "id" : "12345",
    "facts" : [ {
      "id" : "ABCDE",
      "attribution" : {
        "changeMessage" : "...change message..."
      },
      "type" : "http://gedcomx.org/Birth",
      "date" : {
        "original" : "3 Apr 1836",
        "formal" : "+1836"
      },
      "place" : {
        "original" : "Moscow, Russia",
        "normalized" : [ {
          "lang" : "en",
          "value" : "Moscow, Moskva, Russia"
        } ]
      }
    } ]
  } ]
}

Response

HTTP/1.1 412 Precondition Failed
Content-type: application/x-gedcomx-v1+json
X-processing-time: 3
Warning: 400 FamilySearch "Unable to check preconditions.: java.text.ParseException: Error parsing entity tag: J8Y5VFR: Error parsing entity tag: J8Y5VFR"
Vary: Accept,Accept-Language,Accept-Encoding,Expect
Content-location: /platform/tree/persons/12345
Date: Sun, 03 Apr 1836 10:00:00 GMT-5
Cache-control: no-cache, no-store, no-transform, must-revalidate, max-age=0
Transfer-encoding: chunked{
  "errors" : [ {
  "code" : 412,
  "message" : "jakarta.ws.rs.WebApplicationException: java.text.ParseException: Error parsing entity tag: J8Y5VFR"
  } ]
  }

XML

Request

POST /platform/tree/persons/12345
If-Unmodified-Since: Sat Dec 01 08:11:07 MST 2018
If-Match: J8Y5VFR
Content-Type: application/x-gedcomx-v1+xml
Accept: application/x-gedcomx-v1+xml
Authorization: Bearer YOUR_ACCESS_TOKEN_HERE<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gedcomx xmlns:fs="http://familysearch.org/v1/" xmlns="http://gedcomx.org/v1/" xmlns:atom="http://www.w3.org/2005/Atom">
    <person id="12345">
        <fact type="http://gedcomx.org/Birth" id="ABCDE">
            <attribution>
                <changeMessage>...change message...</changeMessage>
            </attribution>
            <date>
                <original>3 Apr 1836</original>
                <formal>+1836</formal>
            </date>
            <place>
                <original>Moscow, Russia</original>
                <normalized xml:lang="en">Moscow, Moskva, Russia</normalized>
            </place>
        </fact>
    </person>
</gedcomx>

Response

HTTP/1.1 412 Precondition Failed
Content-type: application/x-gedcomx-v1+xml
X-processing-time: 3
Warning: 400 FamilySearch "Unable to check preconditions.: java.text.ParseException: Error parsing entity tag: J8Y5VFR: Error parsing entity tag: J8Y5VFR"
Vary: Accept,Accept-Language,Accept-Encoding,Expect
Content-location: /platform/tree/persons/12345
Date: Sun, 03 Apr 1836 10:00:00 GMT-5
Cache-control: no-cache, no-store, no-transform, must-revalidate, max-age=0
Transfer-encoding: chunked<?xml
  version="1.0" encoding="UTF-8" standalone="yes"?>
  <gedcomx xmlns:fs="http://familysearch.org/v1/" xmlns="http://gedcomx.org/v1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <fs:error>
  <fs:code>412</fs:code>
  <fs:message>jakarta.ws.rs.WebApplicationException: java.text.ParseException: Error parsing entity tag: J8Y5VFR</fs:message>
  </fs:error>
  </gedcomx>