talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

REST person creation snags

JS
Joe Slag
Tue, Apr 5, 2011 12:25 AM

Thanks to help from the list, we have our Collectionspace 1.5 server up and
running, and I'm successfully creating objects via the REST interface by
means of a python script. I'm planning on putting together a blog post on
what's worked once I'm a little further along, but before that happens, I'd
like to get the Person part working, so that when programatically creating
collection objects, I can make sure that they're associated with the
appropriate Person records.

The script I've tried so far is at
https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201
code, and the Person does come back when I request a list of people via
REST, so it's at least partially successful.

However, the person record can't be found when searching through the web UI.
For my example, if I search for 'Chuck', I get a status message at the
bottom of the window saying 'We've encountered an error retrieving search
results. Please try again.'

Looking at the details of what's returned when listing the users via REST,
the one I created seems to be missing some fields. Here's an example of a
person created via the web:

<person_list_item>
<displayName>Helen Frankenthaler</displayName>
<shortIdentifier/>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri>

<refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName>
<csid>6645c8fb-3514-4286-bd4c</csid>
</person_list_item>

Here's the listing for a person created via my REST script:

<person_list_item>
<displayName>Chuck Close</displayName>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri>
<csid>ce1c1f65-55b8-4197-95e9</csid>
</person_list_item>

The latter lacks a <uri> or a <refName>. It also isn't coming back with an
empty <shortIdentifier/> tag.

Am I missing something in the REST person creation workflow?

thanks,
Joe

Thanks to help from the list, we have our Collectionspace 1.5 server up and running, and I'm successfully creating objects via the REST interface by means of a python script. I'm planning on putting together a blog post on what's worked once I'm a little further along, but before that happens, I'd like to get the Person part working, so that when programatically creating collection objects, I can make sure that they're associated with the appropriate Person records. The script I've tried so far is at https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201 code, and the Person does come back when I request a list of people via REST, so it's at least partially successful. However, the person record can't be found when searching through the web UI. For my example, if I search for 'Chuck', I get a status message at the bottom of the window saying 'We've encountered an error retrieving search results. Please try again.' Looking at the details of what's returned when listing the users via REST, the one I created seems to be missing some fields. Here's an example of a person created via the web: <person_list_item> <displayName>Helen Frankenthaler</displayName> <shortIdentifier/> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri> <refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName> <csid>6645c8fb-3514-4286-bd4c</csid> </person_list_item> Here's the listing for a person created via my REST script: <person_list_item> <displayName>Chuck Close</displayName> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri> <csid>ce1c1f65-55b8-4197-95e9</csid> </person_list_item> The latter lacks a <uri> or a <refName>. It also isn't coming back with an empty <shortIdentifier/> tag. Am I missing something in the REST person creation workflow? thanks, Joe
CP
Christopher Pott
Tue, Apr 5, 2011 9:11 AM

Hi,

I haven't used the Person REST interface in v1.5, but in some
earlier attempts (v1.3) I had success by:
a)setting inAuthority (eg. to the Default Person Authority csid)
b)setting shortIdentifier to empty with an explicit end tag
c)setting shortDisplayNameComputed to true
d)sending a second (update) request containing a refName (built
from the csid received in the first create response)

Regards,
Chris

-----Original Message-----
From: talk-bounces@lists.collectionspace.org on behalf of Joe Slag
Sent: Tue 4/5/2011 2:25 AM
To: talk@lists.collectionspace.org
Subject: [Talk] REST person creation snags

Thanks to help from the list, we have our Collectionspace 1.5 server up and
running, and I'm successfully creating objects via the REST interface by
means of a python script. I'm planning on putting together a blog post on
what's worked once I'm a little further along, but before that happens, I'd
like to get the Person part working, so that when programatically creating
collection objects, I can make sure that they're associated with the
appropriate Person records.

The script I've tried so far is at
https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201
code, and the Person does come back when I request a list of people via
REST, so it's at least partially successful.

However, the person record can't be found when searching through the web UI.
For my example, if I search for 'Chuck', I get a status message at the
bottom of the window saying 'We've encountered an error retrieving search
results. Please try again.'

Looking at the details of what's returned when listing the users via REST,
the one I created seems to be missing some fields. Here's an example of a
person created via the web:

<person_list_item>
<displayName>Helen Frankenthaler</displayName>
<shortIdentifier/>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri>

<refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName>
<csid>6645c8fb-3514-4286-bd4c</csid>
</person_list_item>

Here's the listing for a person created via my REST script:

<person_list_item>
<displayName>Chuck Close</displayName>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri>
<csid>ce1c1f65-55b8-4197-95e9</csid>
</person_list_item>

The latter lacks a <uri> or a <refName>. It also isn't coming back with an
empty <shortIdentifier/> tag.

Am I missing something in the REST person creation workflow?

thanks,
Joe

Hi, I haven't used the Person REST interface in v1.5, but in some earlier attempts (v1.3) I had success by: a)setting inAuthority (eg. to the Default Person Authority csid) b)setting shortIdentifier to empty with an explicit end tag c)setting shortDisplayNameComputed to true d)sending a second (update) request containing a refName (built from the csid received in the first create response) Regards, Chris -----Original Message----- From: talk-bounces@lists.collectionspace.org on behalf of Joe Slag Sent: Tue 4/5/2011 2:25 AM To: talk@lists.collectionspace.org Subject: [Talk] REST person creation snags Thanks to help from the list, we have our Collectionspace 1.5 server up and running, and I'm successfully creating objects via the REST interface by means of a python script. I'm planning on putting together a blog post on what's worked once I'm a little further along, but before that happens, I'd like to get the Person part working, so that when programatically creating collection objects, I can make sure that they're associated with the appropriate Person records. The script I've tried so far is at https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201 code, and the Person does come back when I request a list of people via REST, so it's at least partially successful. However, the person record can't be found when searching through the web UI. For my example, if I search for 'Chuck', I get a status message at the bottom of the window saying 'We've encountered an error retrieving search results. Please try again.' Looking at the details of what's returned when listing the users via REST, the one I created seems to be missing some fields. Here's an example of a person created via the web: <person_list_item> <displayName>Helen Frankenthaler</displayName> <shortIdentifier/> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri> <refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName> <csid>6645c8fb-3514-4286-bd4c</csid> </person_list_item> Here's the listing for a person created via my REST script: <person_list_item> <displayName>Chuck Close</displayName> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri> <csid>ce1c1f65-55b8-4197-95e9</csid> </person_list_item> The latter lacks a <uri> or a <refName>. It also isn't coming back with an empty <shortIdentifier/> tag. Am I missing something in the REST person creation workflow? thanks, Joe
AR
Aron Roberts
Tue, Apr 5, 2011 4:06 PM

On Tue, Apr 5, 2011 at 2:11 AM, Christopher Pott
Christopher.Pott@smk.dk wrote:

I haven't used the Person REST interface in v1.5, but in some
earlier attempts (v1.3) I had success by:
a)setting inAuthority (eg. to the Default Person Authority csid)
b)setting shortIdentifier to empty with an explicit end tag
c)setting shortDisplayNameComputed to true
d)sending a second (update) request containing a refName (built
from the csid received in the first create response)

Thanks, Chris!

Joe (and all) - two more resources to help you find out what Person
payloads should look like, and more generally, how to access all of
CollectionSpace's services, including those that may be slightly more
complex than the straightforward CRUD operations that are
characteristic of CollectionObjects, Acquisitions, etc.

  1. You can find API documentation for the Person service (and its
    parent, Person Authority service), which includes sample payloads and
    notes on requirements for the data that must be provided in specific
    fields at:

"Person Service REST APIs - Release v0.1"
http://wiki.collectionspace.org/x/IgByAQ

There are similar API docs for each service; you can find them
linked from this page:

"Service Layer - Services Currently Available"
http://wiki.collectionspace.org/x/DgDhAQ

Some of these docs may require updating to reflect the change from
Multipart MIME to pure XML payloads, but outside of that, they are
believed to be current and accurate.  If you or others find any
mismatches between documentation and current services, please let us
know and we'll update them right away.

  1. Another way to see what payloads are being sent and received by
    successful accesses of the services layer is to use a tool that lets
    you see the actual HTTP payloads in transit, and then run the client
    tests of the services layer.  This document describes how to use one
    such tool for viewing those payloads in transit:

"Using tcpmon to interactively debug calls to the Services Layer"
http://wiki.collectionspace.org/x/TYBiAg

If you then go to the appropriate directory in the services source
code tree; e.g. services/person/client, and run tests, e.g. 'mvn
test', you can see the actual HTTP calls and payloads being sent and
received by successful tests of CRUD and list-type operations.

Aron

--

Regards,
Chris

-----Original Message-----
From: talk-bounces@lists.collectionspace.org on behalf of Joe Slag
Sent: Tue 4/5/2011 2:25 AM
To: talk@lists.collectionspace.org
Subject: [Talk] REST person creation snags

Thanks to help from the list, we have our Collectionspace 1.5 server up and
running, and I'm successfully creating objects via the REST interface by
means of a python script. I'm planning on putting together a blog post on
what's worked once I'm a little further along, but before that happens, I'd
like to get the Person part working, so that when programatically creating
collection objects, I can make sure that they're associated with the
appropriate Person records.

The script I've tried so far is at
https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201
code, and the Person does come back when I request a list of people via
REST, so it's at least partially successful.

However, the person record can't be found when searching through the web UI.
For my example, if I search for 'Chuck', I get a status message at the
bottom of the window saying 'We've encountered an error retrieving search
results. Please try again.'

Looking at the details of what's returned when listing the users via REST,
the one I created seems to be missing some fields. Here's an example of a
person created via the web:

  <person_list_item>
    <displayName>Helen Frankenthaler</displayName>
    <shortIdentifier/>

 <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri>

 <refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName>
    <csid>6645c8fb-3514-4286-bd4c</csid>
  </person_list_item>

Here's the listing for a person created via my REST script:

  <person_list_item>
    <displayName>Chuck Close</displayName>

 <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri>
    <csid>ce1c1f65-55b8-4197-95e9</csid>
  </person_list_item>

The latter lacks a <uri> or a <refName>. It also isn't coming back with an
empty <shortIdentifier/> tag.

Am I missing something in the REST person creation workflow?

thanks,
Joe


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

On Tue, Apr 5, 2011 at 2:11 AM, Christopher Pott <Christopher.Pott@smk.dk> wrote: > I haven't used the Person REST interface in v1.5, but in some > earlier attempts (v1.3) I had success by: > a)setting inAuthority (eg. to the Default Person Authority csid) > b)setting shortIdentifier to empty with an explicit end tag > c)setting shortDisplayNameComputed to true > d)sending a second (update) request containing a refName (built > from the csid received in the first create response) Thanks, Chris! Joe (and all) - two more resources to help you find out what Person payloads should look like, and more generally, how to access all of CollectionSpace's services, including those that may be slightly more complex than the straightforward CRUD operations that are characteristic of CollectionObjects, Acquisitions, etc. 1. You can find API documentation for the Person service (and its parent, Person Authority service), which includes sample payloads and notes on requirements for the data that must be provided in specific fields at: "Person Service REST APIs - Release v0.1" http://wiki.collectionspace.org/x/IgByAQ There are similar API docs for each service; you can find them linked from this page: "Service Layer - Services Currently Available" http://wiki.collectionspace.org/x/DgDhAQ Some of these docs may require updating to reflect the change from Multipart MIME to pure XML payloads, but outside of that, they are believed to be current and accurate. If you or others find any mismatches between documentation and current services, please let us know and we'll update them right away. 2. Another way to see what payloads are being sent and received by successful accesses of the services layer is to use a tool that lets you see the actual HTTP payloads in transit, and then run the client tests of the services layer. This document describes how to use one such tool for viewing those payloads in transit: "Using tcpmon to interactively debug calls to the Services Layer" http://wiki.collectionspace.org/x/TYBiAg If you then go to the appropriate directory in the services source code tree; e.g. services/person/client, and run tests, e.g. 'mvn test', you can see the actual HTTP calls and payloads being sent and received by successful tests of CRUD and list-type operations. Aron -- > > Regards, > Chris > > > -----Original Message----- > From: talk-bounces@lists.collectionspace.org on behalf of Joe Slag > Sent: Tue 4/5/2011 2:25 AM > To: talk@lists.collectionspace.org > Subject: [Talk] REST person creation snags > > Thanks to help from the list, we have our Collectionspace 1.5 server up and > running, and I'm successfully creating objects via the REST interface by > means of a python script. I'm planning on putting together a blog post on > what's worked once I'm a little further along, but before that happens, I'd > like to get the Person part working, so that when programatically creating > collection objects, I can make sure that they're associated with the > appropriate Person records. > > The script I've tried so far is at > https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201 > code, and the Person does come back when I request a list of people via > REST, so it's at least partially successful. > > However, the person record can't be found when searching through the web UI. > For my example, if I search for 'Chuck', I get a status message at the > bottom of the window saying 'We've encountered an error retrieving search > results. Please try again.' > > Looking at the details of what's returned when listing the users via REST, > the one I created seems to be missing some fields. Here's an example of a > person created via the web: > >   <person_list_item> >     <displayName>Helen Frankenthaler</displayName> >     <shortIdentifier/> > >  <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4c</uri> > >  <refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-6465-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refName> >     <csid>6645c8fb-3514-4286-bd4c</csid> >   </person_list_item> > > Here's the listing for a person created via my REST script: > >   <person_list_item> >     <displayName>Chuck Close</displayName> > >  <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e9</uri> >     <csid>ce1c1f65-55b8-4197-95e9</csid> >   </person_list_item> > > The latter lacks a <uri> or a <refName>. It also isn't coming back with an > empty <shortIdentifier/> tag. > > Am I missing something in the REST person creation workflow? > > thanks, > Joe > > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org > >
PS
Patrick Schmitz
Tue, Apr 5, 2011 8:16 PM

Hi Joe -

The problem you are encountering looks a lot like an issue we were facing
with deployments here at Berkeley. If I am correct, this is a function of
how Persons are being created and referenced. There is a fix for this in the
services, but we need to prioritize the integration of this with the App
layer before we can check in the services changes and make them available in
the builds. I have a to-do item for this on my list already, and will be
talking to Megan and the Cambridge folks about this later this week (am
travelling right now, but will be back home tomorrow).

Sorry for the hassle, we'll try to get this addressed right away.

Patrick


From: talk-bounces@lists.collectionspace.org
[mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Joe Slag
Sent: Monday, April 04, 2011 5:25 PM
To: talk@lists.collectionspace.org
Subject: [Talk] REST person creation snags

Thanks to help from the list, we have our Collectionspace 1.5 server up and
running, and I'm successfully creating objects via the REST interface by
means of a python script. I'm planning on putting together a blog post on
what's worked once I'm a little further along, but before that happens, I'd
like to get the Person part working, so that when programatically creating
collection objects, I can make sure that they're associated with the
appropriate Person records.

The script I've tried so far is at
https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201
code, and the Person does come back when I request a list of people via
REST, so it's at least partially successful.

However, the person record can't be found when searching through the web UI.
For my example, if I search for 'Chuck', I get a status message at the
bottom of the window saying 'We've encountered an error retrieving search
results. Please try again.'

Looking at the details of what's returned when listing the users via REST,
the one I created seems to be missing some fields. Here's an example of a
person created via the web:

<person_list_item>
<displayName>Helen Frankenthaler</displayName>
<shortIdentifier/>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4
c</uri>

<refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-646
5-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refNam
e>
<csid>6645c8fb-3514-4286-bd4c</csid>
</person_list_item>

Here's the listing for a person created via my REST script:

<person_list_item>
<displayName>Chuck Close</displayName>

<uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e
9</uri>
<csid>ce1c1f65-55b8-4197-95e9</csid>
</person_list_item>

The latter lacks a <uri> or a <refName>. It also isn't coming back with an
empty <shortIdentifier/> tag.

Am I missing something in the REST person creation workflow?

thanks,
Joe

Hi Joe - The problem you are encountering looks a lot like an issue we were facing with deployments here at Berkeley. If I am correct, this is a function of how Persons are being created and referenced. There is a fix for this in the services, but we need to prioritize the integration of this with the App layer before we can check in the services changes and make them available in the builds. I have a to-do item for this on my list already, and will be talking to Megan and the Cambridge folks about this later this week (am travelling right now, but will be back home tomorrow). Sorry for the hassle, we'll try to get this addressed right away. Patrick _____ From: talk-bounces@lists.collectionspace.org [mailto:talk-bounces@lists.collectionspace.org] On Behalf Of Joe Slag Sent: Monday, April 04, 2011 5:25 PM To: talk@lists.collectionspace.org Subject: [Talk] REST person creation snags Thanks to help from the list, we have our Collectionspace 1.5 server up and running, and I'm successfully creating objects via the REST interface by means of a python script. I'm planning on putting together a blog post on what's worked once I'm a little further along, but before that happens, I'd like to get the Person part working, so that when programatically creating collection objects, I can make sure that they're associated with the appropriate Person records. The script I've tried so far is at https://gist.github.com/5493965531b54905e5c8 -- running it returns a 201 code, and the Person does come back when I request a list of people via REST, so it's at least partially successful. However, the person record can't be found when searching through the web UI. For my example, if I search for 'Chuck', I get a status message at the bottom of the window saying 'We've encountered an error retrieving search results. Please try again.' Looking at the details of what's returned when listing the users via REST, the one I created seems to be missing some fields. Here's an example of a person created via the web: <person_list_item> <displayName>Helen Frankenthaler</displayName> <shortIdentifier/> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/6645c8fb-3514-4286-bd4 c</uri> <refName>urn:cspace:org.collectionspace.demo:personauthority:id(9e207a1a-646 5-4917-a2ce):person:id(6645c8fb-3514-4286-bd4c)'Helen+Frankenthaler'</refNam e> <csid>6645c8fb-3514-4286-bd4c</csid> </person_list_item> Here's the listing for a person created via my REST script: <person_list_item> <displayName>Chuck Close</displayName> <uri>/personauthorities/9e207a1a-6465-4917-a2ce/items/ce1c1f65-55b8-4197-95e 9</uri> <csid>ce1c1f65-55b8-4197-95e9</csid> </person_list_item> The latter lacks a <uri> or a <refName>. It also isn't coming back with an empty <shortIdentifier/> tag. Am I missing something in the REST person creation workflow? thanks, Joe