ancestors

8 views
Skip to first unread message

karmen

unread,
Jan 22, 2010, 7:28:00 PM1/22/10
to Ruby FS Stack
I used to be able to grab ancestors via:

client.summary_person(root.father.id, :ancestors=>MAX_ANCESTORS)

Is there a way to do that in the new api?

Karmen

karmen

unread,
Jan 25, 2010, 3:44:14 PM1/25/10
to Ruby FS Stack
Jimmy,

Grabbing ancestors with the :ancestors => #) was very helpful for
controlling how many levels of the pedigree you wanted. If you don't
have that functionality v2 then I'll need to implement my own for my
purposes.

Let me know when you can. Thanks.

Karmen

Jimmy Z

unread,
Jan 25, 2010, 5:06:59 PM1/25/10
to Ruby FS Stack
Hi Karmen,

v2 has an endpoint /familytree/v2/pedigree that allows you to pull up
to 4 generations of ancestors in one call. The data returned is
minimal (id, name, gender, version, living, parent IDs).

https://devnet.familysearch.org/docs/api-manual-reference-system/familytree-v2/r_api_family_tree_pedigree_v2.html

This is basically used for grabbing a fast snapshot of the pedigree
for drawing to the screen. If you want more detailed information, you
would need to do a person read to get the full details.

I haven't implemented this yet in the ruby-fs-stack.

As to the ancestors parameter on a person read, there isn't such thing
in v2.

--
Jimmy

karmen

unread,
Jan 25, 2010, 5:09:10 PM1/25/10
to Ruby FS Stack
looks it should give what I need. I'm investigating now...

Thank you!

Karmen

On Jan 25, 2:06 pm, Jimmy Z <jimmy.zimmer...@gmail.com> wrote:
> Hi Karmen,
>
> v2 has an endpoint /familytree/v2/pedigree that allows you to pull up
> to 4 generations of ancestors in one call. The data returned is
> minimal (id, name, gender, version, living, parent IDs).
>

> https://devnet.familysearch.org/docs/api-manual-reference-system/fami...

karmen

unread,
Jan 25, 2010, 5:57:45 PM1/25/10
to Ruby FS Stack
I'm trying this (where @client is an instance of FsCommunicator):

response = @client.get("https://api.familysearch.org/familytree/v2/
pedigree/#{ref}?ancestors=4&#{@session}")

I get an error:

GET //api.familysearch.org/familytree/v2/pedigree/KLY6-WQP?
ancestors=4&&sessionId=USYSB423897058617D94B9EB69BE8A706291.paam-002-067&dataFormat=application/
json
accept: */*
user-agent: Ruby-Fs-Stack/v.1 (JimmyZimmerman) FsCommunicator/0.1
(Ruby)

SocketError (getaddrinfo: nodename nor servname provided, or not
known):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:560:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:560:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:560:in `connect'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/timeout.rb:53:in `timeout'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/timeout.rb:93:in `timeout'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:560:in `connect'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:553:in `do_start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/net/http.rb:542:in `start'
/Library/Ruby/Gems/1.8/gems/ruby-fs-stack-0.4.2/lib/ruby-fs-stack/
fs_communicator.rb:81:in `get'


Do you see where I am going wrong?

Karmen

On Jan 25, 2:06 pm, Jimmy Z <jimmy.zimmer...@gmail.com> wrote:

> Hi Karmen,
>
> v2 has an endpoint /familytree/v2/pedigree that allows you to pull up
> to 4 generations of ancestors in one call. The data returned is
> minimal (id, name, gender, version, living, parent IDs).
>

> https://devnet.familysearch.org/docs/api-manual-reference-system/fami...

Jimmy Z

unread,
Jan 25, 2010, 7:03:39 PM1/25/10
to Ruby FS Stack
Hi Karmen,

Try the following:

response = @client.get("/familytree/v2/pedigree/#{ref}?ancestors=4")

the @client will take care of the session as long as it has it set:

@client.session = @session

The @client also takes care of the domain if it is set.

--
Jimmy

karmen

unread,
Jan 25, 2010, 7:31:35 PM1/25/10
to Ruby FS Stack
cool, that worked.

Looking at other tidbits of your code (thanks github) I was able to do
something like this:

familytree =
Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.from_json
(JSON.parse(response.body))

not sure if FamilyTree is the correct object to use but gives me back
something that might be usable. I tried to call persons off of the
familytree but got nil. So I'm looking into how to best grab father,
mother, grandfather, grandmother, etc. from the familytree object.

one step at time... Thanks for your help.

Karmen

On Jan 25, 4:03 pm, Jimmy Z <jimmy.zimmer...@gmail.com> wrote:
> Hi Karmen,
>

karmen

unread,
Jan 25, 2010, 8:31:34 PM1/25/10
to Ruby FS Stack
this is giving me some information:

familytree =
Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.from_json
(JSON.parse(response.body))

pp familytree.pedigrees.first

than I can grab id or persons off of that.

Next: extrapolate what I need...

Karmen

Jimmy Z

unread,
Jan 26, 2010, 9:45:59 AM1/26/10
to Ruby FS Stack
Yes.

familytree.pedigrees contains a list of pedigree results (you can
request up to 2 pedigrees per API call).

Each Pedigree object should have a "persons" array, which contains
plain person records as you are used to reading from the person read.
The information contained in the person is minimal (as mentioned
earlier), but it will have a parents array containing one parent set.

I believe the following will give the ID of the primary person's
father.

familytree.pedigrees.first.persons.first.parents.first.parents[0].id
familytree.pedigrees.first.persons.first.parents.first.parents
[0].gender #=> should be 'Male'

The "persons" array is an array of all people in that X generation
pedigree. It will not be nested, but will give references to the
parents.

I hope this helps.

Jimmy

karmen

unread,
Jan 26, 2010, 11:56:33 AM1/26/10
to Ruby FS Stack
Thanks, this information helps tremendously. The way we used pedigrees
and person objects in v1 changed for v2. In our app, I'll have to
rework what we did to make it work with the data we are getting back
in v2. Now that you've helped me get a pretty good grasp on the v2
data I will move forward with rewriting our stuff to match up.

I appreciate the help.

Karmen

Reply all
Reply to author
Forward
0 new messages