Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add params back to the getPersonMatches method #147

Closed
justincy opened this issue Dec 22, 2015 · 7 comments
Closed

Add params back to the getPersonMatches method #147

justincy opened this issue Dec 22, 2015 · 7 comments

Comments

@justincy
Copy link
Contributor

The params parameter was removed from getPersonMatches() during the upgrade to v2 because it was incorrectly documented as not being used. We need the params object because the Person Matches Resource supports many query parameters such as requesting Record Hints instead of duplicates.

@DebbieHoltzendorff
Copy link

How do you get Record Hints in JavaScript 2.4?

@justincy
Copy link
Contributor Author

You can construct the URL yourself like this:

fsApiClient.get(person.getLink('matches').href + '?collection=https://familysearch.org/platform/collections/records')

@DebbieHoltzendorff
Copy link

Thank you that's a great idea.

Debbie Holtzendorff

On Tue, May 10, 2016 at 11:02 AM, Justin notifications@github.com wrote:

You can construct the URL yourself like this:

fsApiClient.get(person.getLink('matches').href + '?collection=https://familysearch.org/platform/collections/records')


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#147 (comment)

@DebbieHoltzendorff
Copy link

On Tue, May 10, 2016 at 11:02 AM, Justin notifications@github.com wrote:

fsApiClient.get(person.getLink('matches').href + '?collection=
https://familysearch.org/platform/collections/records')

Hi,
I really need your help. I am trying to read the hints for matching records
for a person with your suggestion but I cannot find any documentation for
getLink:

<script src='http://woodenvillage.org/jquery-1.11.2.min.js'></script> <script src='http://woodenvillage.org/familysearch-javascript-sdk2.4.min.js'></script> <script> var fsClient = new FamilySearch({ client_id: 'a0T3000000BfYxfEAF', environment: 'production', redirect_uri: 'http://woodenvillage.org/Debbie', save_access_token: true }); function _run() { fsClient.getAccessToken().then(function(response) { var accessToken = response; var ancestorId = '96TL-LY3'; //fsClient.getRecordMatches(ancestorId) //theUrl = 'https://familysearch.org/platform/tree/persons/' + ancestorIdId + '/matches?collection=https://familysearch.org/platform/collections/records&access_token=' + accessToken fsClient.get(ancestorId.getLink('matches').href + '?collection=https://familysearch.org/platform/collections/records') .then(function (response) { window.alert('Found Record Matches for (' + ancestorId + ') response=' + response); }); }) } </script>

Submit

Can you point me in the right direction?
Thank you,
Sister Debbie Holtzendorff

@justincy
Copy link
Contributor Author

getLink() is documented here: http://familysearch.github.io/familysearch-javascript-sdk/2.4/#/api/familysearch.types:constructor.BaseClass

In API responses you'll often see links, such as on this person example:

{
  "persons" : [ {
    "id" : "PPPJ-MYZ",
    "links" : {
      "ancestry" : {
        "href" : "https://familysearch.org/platform/tree/ancestry?person=PPPJ-MYZ"
      },
      "spouses" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/spouses"
      },
      "parents" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/parents"
      },
      "person" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ"
      },
      "descendancy" : {
        "href" : "https://familysearch.org/platform/tree/descendancy?person=PPPJ-MYZ"
      },
      "person-with-relationships" : {
        "href" : "https://familysearch.org/platform/tree/persons-with-relationships?person=PPPJ-MYZ"
      },
      "merge" : {
        "template" : "https://familysearch.org/platform/tree/persons/{pid}/merges/{dpid}{?filter,access_token}",
        "type" : "application/json,application/x-fs-v1+json,application/x-fs-v1+xml,application/xml,text/html",
        "accept" : "application/x-fs-v1+json,application/x-fs-v1+xml",
        "allow" : "GET,OPTIONS,POST",
        "title" : "Person Merge"
      },
      "change-history" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/changes"
      },
      "evidence-references" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/memory-references"
      },
      "children" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/children"
      },
      "child-relationships" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/child-relationships"
      },
      "collection" : {
        "href" : "https://familysearch.org/platform/collections/tree"
      },
      "ordinance-reservations" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/reservations"
      },
      "artifacts" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/memories"
      },
      "source-references" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/source-references"
      },
      "matches" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/matches"
      },
      "ordinances" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/ordinances"
      },
      "portraits" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/portraits"
      },
      "discussion-references" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/discussion-references"
      },
      "spouse-relationships" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/spouse-relationships"
      },
      "parent-relationships" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/parent-relationships"
      },
      "portrait" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/portrait"
      },
      "non-matches" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/not-a-match"
      },
      "notes" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/notes"
      },
      "source-descriptions" : {
        "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/sources"
      }
    },
    "attribution" : {
      "changeMessage" : "wikipedia knows"
    },
    "identifiers" : {
      "http://gedcomx.org/Persistent" : [ "https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ" ]
    },
    "living" : true,
    "gender" : {
      "type" : "http://gedcomx.org/Male"
    },
    "names" : [ {
      "id" : "name-id",
      "links" : {
        "conclusion" : {
          "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/name-id"
        }
      },
      "attribution" : {
        "contributor" : {
          "resource" : "urn:name-attribution",
          "resourceId" : "KNCV-RMZ"
        }
      },
      "type" : "http://gedcomx.org/BirthName",
      "nameForms" : [ {
        "fullText" : "Alex Aleksandrova",
        "parts" : [ {
          "type" : "http://gedcomx.org/Given",
          "value" : "Alex"
        }, {
          "type" : "http://gedcomx.org/Surname",
          "value" : "Aleksandrova"
        } ]
      }, {
        "fullText" : "Анастасия Александрова",
        "parts" : [ {
          "type" : "http://gedcomx.org/Given",
          "value" : "Анастасия"
        }, {
          "type" : "http://gedcomx.org/Surname",
          "value" : "Александрова"
        } ]
      } ],
      "preferred" : true
    } ],
    "facts" : [ {
      "id" : "born",
      "links" : {
        "conclusion" : {
          "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/born"
        }
      },
      "attribution" : {
        "contributor" : {
          "resource" : "urn:fact-attribution",
          "resourceId" : "RMQW-LPK"
        }
      },
      "type" : "http://gedcomx.org/Birth",
      "date" : {
        "original" : "3 Apr 1836",
        "formal" : "+1836"
      },
      "place" : {
        "original" : "Moscow, Russia",
        "normalized" : [ {
          "lang" : "en",
          "value" : "Moscow, Moskva, Russia"
        } ]
      }
    }, {
      "id" : "res",
      "links" : {
        "conclusion" : {
          "href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/res"
        }
      },
      "attribution" : {
        "contributor" : {
          "resource" : "https://familysearch.org/platform/users/agents/JNYR-KJP",
          "resourceId" : "JNYR-KJP"
        }
      },
      "type" : "http://gedcomx.org/Residence",
      "date" : {
        "original" : "13 Apr 1836",
        "formal" : "+1836-04-13"
      },
      "place" : {
        "original" : "Moscow, Russia",
        "description" : "#1276974106",
        "normalized" : [ {
          "value" : "Moskva, Moscow, Russia"
        } ]
      }
    } ],
    "display" : {
      "name" : "Alex Aleksandrova",
      "gender" : "Male",
      "lifespan" : "3 Apr 1836 - Dead",
      "birthDate" : "3 Apr 1836",
      "birthPlace" : "Moscow, Russia"
    }
  } ],
  "relationships" : [ ],
  "sourceDescriptions" : [ {
    "id" : "SD-PPPJ-MYZ",
    "links" : {
      "description" : {
        "href" : "https://familysearch.org/platform/sources/descriptions/SD-PPPJ-MYZ"
      }
    },
    "citations" : [ {
      "lang" : "en",
      "value" : "\"Family Tree,\" database, <i>FamilySearch</i> (http://familysearch.org : modified 20 April 2016, 12:58), entry for Alex Aleksandrova(PID https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ); contributed by various users."
    } ],
    "about" : "#PPPJ-MYZ",
    "componentOf" : {
      "description" : "https://familysearch.org/platform/collections/tree"
    },
    "titles" : [ {
      "value" : "Alex Aleksandrova"
    } ],
    "resourceType" : "http://gedcomx.org/Person",
    "identifiers" : {
      "http://gedcomx.org/Persistent" : [ "https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ" ]
    },
    "modified" : 1461178697000
  } ],
  "places" : [ {
    "id" : "1276974106",
    "names" : [ {
      "value" : "Moskva, Moscow, Russia"
    } ],
    "latitude" : 37.613983,
    "longitude" : 55.784296
  } ],
  "description" : "#SD-PPPJ-MYZ"
}

The getLink() method returns a link by it's name, so in the example code I shared earlier we're fetching the matches link and extracting the href property.

In your example above you're trying to call getLink() on a person ID instead of a person object. That won't work.

@DebbieHoltzendorff
Copy link

Hi,
I still have not been able to get the record hints for a person. You sent
the following :
fsApiClient.get(person.getLink('matches').href + '?collection=
https://familysearch.org/platform/collections/records')

But I get 406 (Not Acceptable) for
https://familysearch.org/platform/tree/persons/LH81-JDL/matches?access_token=USYS1B8B74E4735BD7EC8490BEF3DED710B2_idses-prod03.a.fsglobal.net?collection=https://familysearch.org/platform/collections/records

I don't think matches accepts the "collection" parameter in JavaScript 2.4
anymore. Do you have any ideas?

My app:

fsClient.getAccessToken().then(function (response) {
accessToken = response;
fsClient.getPerson(personId).then(function (response) {
var person = response.getPerson();
console.log('Person is ' + person.getDisplayName());
fsClient.get(person.getLink('matches').href +
'&collection=https://familysearch.org/platform/collections/records'
)

Thanks,
Debbie Holtzendorff

Debbie Holtzendorff

On Wed, May 25, 2016 at 4:09 PM, Justin notifications@github.com wrote:

getLink() is documented here:
http://familysearch.github.io/familysearch-javascript-sdk/2.4/#/api/familysearch.types:constructor.BaseClass

In API responses you'll often see links, such as on this person example
https://familysearch.org/developers/docs/api/tree/Read_Person_usecase:

{
"persons" : [ {
"id" : "PPPJ-MYZ",
"links" : {
"ancestry" : {
"href" : "https://familysearch.org/platform/tree/ancestry?person=PPPJ-MYZ"
},
"spouses" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/spouses"
},
"parents" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/parents"
},
"person" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ"
},
"descendancy" : {
"href" : "https://familysearch.org/platform/tree/descendancy?person=PPPJ-MYZ"
},
"person-with-relationships" : {
"href" : "https://familysearch.org/platform/tree/persons-with-relationships?person=PPPJ-MYZ"
},
"merge" : {
"template" : "https://familysearch.org/platform/tree/persons/{pid}/merges/{dpid}{?filter,access_token}",
"type" : "application/json,application/x-fs-v1+json,application/x-fs-v1+xml,application/xml,text/html",
"accept" : "application/x-fs-v1+json,application/x-fs-v1+xml",
"allow" : "GET,OPTIONS,POST",
"title" : "Person Merge"
},
"change-history" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/changes"
},
"evidence-references" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/memory-references"
},
"children" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/children"
},
"child-relationships" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/child-relationships"
},
"collection" : {
"href" : "https://familysearch.org/platform/collections/tree"
},
"ordinance-reservations" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/reservations"
},
"artifacts" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/memories"
},
"source-references" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/source-references"
},
"matches" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/matches"
},
"ordinances" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/ordinances"
},
"portraits" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/portraits"
},
"discussion-references" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/discussion-references"
},
"spouse-relationships" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/spouse-relationships"
},
"parent-relationships" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/parent-relationships"
},
"portrait" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/portrait"
},
"non-matches" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/not-a-match"
},
"notes" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/notes"
},
"source-descriptions" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/sources"
}
},
"attribution" : {
"changeMessage" : "wikipedia knows"
},
"identifiers" : {
"http://gedcomx.org/Persistent" : [ "https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ" ]
},
"living" : true,
"gender" : {
"type" : "http://gedcomx.org/Male"
},
"names" : [ {
"id" : "name-id",
"links" : {
"conclusion" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/name-id"
}
},
"attribution" : {
"contributor" : {
"resource" : "urn:name-attribution",
"resourceId" : "KNCV-RMZ"
}
},
"type" : "http://gedcomx.org/BirthName",
"nameForms" : [ {
"fullText" : "Alex Aleksandrova",
"parts" : [ {
"type" : "http://gedcomx.org/Given",
"value" : "Alex"
}, {
"type" : "http://gedcomx.org/Surname",
"value" : "Aleksandrova"
} ]
}, {
"fullText" : "Анастасия Александрова",
"parts" : [ {
"type" : "http://gedcomx.org/Given",
"value" : "Анастасия"
}, {
"type" : "http://gedcomx.org/Surname",
"value" : "Александрова"
} ]
} ],
"preferred" : true
} ],
"facts" : [ {
"id" : "born",
"links" : {
"conclusion" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/born"
}
},
"attribution" : {
"contributor" : {
"resource" : "urn:fact-attribution",
"resourceId" : "RMQW-LPK"
}
},
"type" : "http://gedcomx.org/Birth",
"date" : {
"original" : "3 Apr 1836",
"formal" : "+1836"
},
"place" : {
"original" : "Moscow, Russia",
"normalized" : [ {
"lang" : "en",
"value" : "Moscow, Moskva, Russia"
} ]
}
}, {
"id" : "res",
"links" : {
"conclusion" : {
"href" : "https://familysearch.org/platform/tree/persons/PPPJ-MYZ/conclusions/res"
}
},
"attribution" : {
"contributor" : {
"resource" : "https://familysearch.org/platform/users/agents/JNYR-KJP",
"resourceId" : "JNYR-KJP"
}
},
"type" : "http://gedcomx.org/Residence",
"date" : {
"original" : "13 Apr 1836",
"formal" : "+1836-04-13"
},
"place" : {
"original" : "Moscow, Russia",
"description" : "#1276974106",
"normalized" : [ {
"value" : "Moskva, Moscow, Russia"
} ]
}
} ],
"display" : {
"name" : "Alex Aleksandrova",
"gender" : "Male",
"lifespan" : "3 Apr 1836 - Dead",
"birthDate" : "3 Apr 1836",
"birthPlace" : "Moscow, Russia"
}
} ],
"relationships" : [ ],
"sourceDescriptions" : [ {
"id" : "SD-PPPJ-MYZ",
"links" : {
"description" : {
"href" : "https://familysearch.org/platform/sources/descriptions/SD-PPPJ-MYZ"
}
},
"citations" : [ {
"lang" : "en",
"value" : ""Family Tree," database, FamilySearch (http://familysearch.org : modified 20 April 2016, 12:58), entry for Alex Aleksandrova(PID https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ); contributed by various users."
} ],
"about" : "#PPPJ-MYZ",
"componentOf" : {
"description" : "https://familysearch.org/platform/collections/tree"
},
"titles" : [ {
"value" : "Alex Aleksandrova"
} ],
"resourceType" : "http://gedcomx.org/Person",
"identifiers" : {
"http://gedcomx.org/Persistent" : [ "https://familysearch.org/ark:/61903/4:1:PPPJ-MYZ" ]
},
"modified" : 1461178697000
} ],
"places" : [ {
"id" : "1276974106",
"names" : [ {
"value" : "Moskva, Moscow, Russia"
} ],
"latitude" : 37.613983,
"longitude" : 55.784296
} ],
"description" : "#SD-PPPJ-MYZ"
}

The getLink() method returns a link by it's name, so in the example code
I shared earlier we're fetching the matches link and extracting the href
property.

In your example above you're trying to call getLink() on a person ID
instead of a person object. That won't work.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#147 (comment)

@justincy
Copy link
Contributor Author

@DebbieHoltzendorff Version 2.5.0 of the SDK was just released. It adds a Person.getRecordMatches() method which solves this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants