Person Service REST APIs

Brief Description

For a full description, visit the Service Description and Assumptions page.


Assumptions

For a complete list of assumptions, visit the Service Description and Assumptions page.

References

Vocabulary and Authority Overview
Person Service Description and Assumptions
Person Service Entity Diagrams
Name Authority Schema and Name Authority Schema - Limited for Release 0.8

REST-based API

The Person Service offers a REST-based Application Programming Interface (API) to CRUD (create, read, update, and delete) operations on individual PersonAuthority instances, and on the associated Person instances. These follow the Common model for CollectionSpace REST services.

Note that the Person instances are not directly "addressible"; they can only be accessed via the parent PersonAuthority.

PersonAuthority CRUD+L services

Create a PersonAuthority

Creates a new PersonAuthority record. Assigns a unique, service-specified CollectionSpace ID (CSID) to that PersonAuthority record. Follows standard Create model. See the documentation of the PersonAuthority schema, below. Example:

POST /cspace-services/personauthorities HTTP/1.1

Read a PersonAuthority

Reads an existing PersonAuthority record, specified by its CollectionSpace ID (CSID). Follows standard Read model. See the documentation of the PersonAuthority schema, below.

General form:

GET /cspace-services/personauthorities/{id} HTTP/1.1

Example, reading an existing record with a CSID of e450e8e8-9f12-49f3-aba4-43b7c46344a2:

GET /cspace-services/personauthorities/e450e8e8-9f12-49f3-aba4-43b7c46344a2 HTTP/1.1

An alternate form reads an existing PersonAuthority record, specified by its Short Identifier, which matches the value of the shortIdentifier field in the record. Otherwise follows standard Read model. See the documentation of the PersonAuthority schema, below.

General form:

GET /cspace-services/vocabularies/urn:cspace:name({id}) HTTP/1.1

Example, reading an existing record with a shortIdentifier value of myDefaultPersonAuthority:

GET /cspace-services/vocabularies/urn:cspace:name(myDefaultPersonAuthority) HTTP/1.1
Update a PersonAuthority

Updates an existing PersonAuthority record, specified by its CollectionSpace ID (CSID) or Short Identifier. Follows standard Update model. See the documentation of the PersonAuthority schema, below. Example:

PUT /cspace-services/personauthorities/{id} HTTP/1.1
Delete a PersonAuthority

Deletes an existing PersonAuthority record, specified by its CollectionSpace ID (CSID) or Short Identifier. Follows standard Delete model. Example:

DELETE /cspace-services/personauthorities/{id} HTTP/1.1
List PersonAuthority instances

Lists existing PersonAuthority records, with summary information for each. Follows standard List model. See the documentation of the Vocabulary-List schema, below.

Examples:

GET /cspace-services/personauthorities HTTP/1.1

List supports query parameters for customizing list results, such as pagination controls, query filters, and sorting options. For example:

GET /cspace-services/personauthorities?pgSz=10 HTTP/1.1

List also supports query parameters for searching for matching records, including keyword search. For example:

GET /cspace-services/personauthorities?kw=foo&pgSz=10 HTTP/1.1

PersonAuthority REST payload schemas

The schemas below are abbreviated, and are thus illustrative. For a full list of the fields that may potentially be present in payloads when creating, updating, or reading PersonAuthority records, please see the most recent PersonAuthority schema|https://github.com/collectionspace/services/blob/master/services/person/3rdparty/nuxeo-platform-cs-person/src/main/resources/schemas/personauthorities_common.xsd]

PersonAuthority instance schema

Create and Update should use the following schema. The value of vocabType must be "PersonAuthority".

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="personauthorities">
  <ns2:personauthorities-common xmlns:ns2="http://services.collectionspace.org/person">
    <displayName>Museum Internal</displayName>
    <refName>urn:cspace:org.collectionspace.demo:personauthority:name(MuseumInternal)'Museum Internal'</refName>
    <vocabType>PersonAuthority</vocabType>
  </ns2:personauthorities-common>
</document>

Read will return the above, plus additional fields (uri and csid) for access:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="personauthorities">
  <ns2:personauthorities-common xmlns:ns2="http://services.collectionspace.org/person">
    ...
    <uri>/personauthorities/f0cf4c50-8f8a-4df0-869a</uri>
    <csid>f0cf4c50-8f8a-4df0-869a</csid>
  </ns2:personauthorities-common>
</document>
PersonAuthority-List schema

List (and variants) will return the following schema.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ns2:abstract-common-list xmlns:ns2="http://services.collectionspace.org/person">
  <pageNum>0</pageNum>
  <pageSize>40</pageSize>
  <itemsInPage>3</itemsInPage>
  <totalItems>3</totalItems>
  <fieldsReturned>csid|uri|updatedAt|workflowState|displayName|refName|shortIdentifier|vocabType</fieldsReturned>
  <list-item>
    <displayName>Museum Internal</displayName>
    <refName>urn:cspace:org.collectionspace.demo:personauthority:name(MuseumInternal)'Museum Internal'</refName>
    <vocabType>PersonAuthority</vocabType>
    <uri>/personauthorities/f0cf4c50-8f8a-4df0-869a</uri>
    <csid>f0cf4c50-8f8a-4df0-869a</csid>
  </list-item>
  ...
</ns2:abstract-common-list>

Person CRUD+L services

Person instances are only accessible via the owning PersonAuthority. The sub-resource is accessed with "items" (for consistency across all vocabulary-like services). In the examples below, the {person-auth-id} parameter represents the CSID value of an existing PersonAuthority instance.

Create a Person in a PersonAuthority

Creates a new Person record. Assigns a unique, service-specified CollectionSpace ID (CSID) to that Person record. Follows standard Create model. See the documentation of the Person schema, below. Example:

POST /cspace-services/personauthorities/{person-auth-id}/items HTTP/1.1

You may also POST a part called

<ns3:relations-common-list>

and any new relations there will be created. For example, this POST will add a relationship. Note that you must know beforehand the CSIDs of related terms. These are shown here as the values 33380624-7f46-4e7a-962c and 22280624-7f46-4e7a-962c. These are the CSIDs of two other Person records, which must exist before this call. The special variable ${itemCSID} will be expanded to the CSID of the newly created Person.

<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">

  <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">
    <inAuthority>${inAuthority}</inAuthority>
    <shortIdentifier>${shortIdentifier}</shortIdentifier>
    <personTermGroupList>
      <personTermGroup>
        <termDisplayName>John Wayne</termDisplayName>
        <termPrefForLang>true</termPrefForLang>
        <foreName>John</foreName>
        <surName>Wayne</surName>
        <initials>JW</initials>
        <termStatus>accepted</termStatus>
      </personTermGroup>
    </personTermGroupList>
  </ns2:persons_common>

  <ns3:relations-common-list xmlns:ns3="http://collectionspace.org/services/relation" xmlns:ns2="http://collectionspace.org/services/jaxb">
  <relation-list-item>
    <predicate>hasBroader</predicate>
    <subject>
      <!-- a child of item -->
      <csid>33380624-7f46-4e7a-962c</csid>
      <documentType>Person</documentType>
    </subject>
    <object>
      <csid>${itemCSID}</csid>
      <documentType>Person</documentType>
    </object>
  </relation-list-item>

  <relation-list-item>
    <predicate>hasBroader</predicate>
    <predicateDisplayName>hasBroader</predicateDisplayName>
    <subject>
      <csid>${itemCSID}</csid>
      <documentType>Person</documentType>
    </subject>
    <object>
      <!-- a parent of item -->
      <csid>22280624-7f46-4e7a-962c</csid>
      <documentType>Person</documentType>
    </object>
  </relation-list-item>
  </ns3:relations-common-list>

</document>

NOTE: if you wish to delete related items, simply send relations-common-list as an empty element.  This is shown in a comment at the bottom of this page.
see: http://wiki.collectionspace.org/display/collectionspace/Person+Service+REST+APIs?focusedCommentId=72220749&#comment-72220749

Read a Person in a PersonAuthority

Reads an existing Person record, specified by its CollectionSpace ID (CSID) or Short Identifier. Follows standard Read model. See the documentation of the Person schema, below. Example:

GET /cspace-services/personauthorities/{person-auth-id}/items/{id} HTTP/1.1

There are additional query parameters to get the relations for this item.
Query Parameters are defined and explained here, with examples: Authority REST API for Hierarchies

Update a Person in a PersonAuthority

Updates an existing Person record, specified by its CollectionSpace ID (CSID) or Short Identifier. Follows standard Update model. See the documentation of the Person schema, below. Example:

PUT /cspace-services/personauthorities/{person-auth-id}/items/{id} HTTP/1.1

You may also PUT a part called

<ns3:relations-common-list>

and any new relations there will be created. Relations to the updated item which are missing from the relations list in the PUT will be deleted from persistence. No target records are deleted, just the relations records that point to target records. e.g. POST to authority with Person "Bill Jr.", with relations-common-list that has an entry for ${itemCSID} hasBroader "Bill Sr." creates a relations record that references both Bill Sr. and Bill Jr. When a PUT is made that does not have the relation for Bill Sr., then Bill Jr. has no relations, so the relations record for Bill Jr.==>hasBroader==>Bill Sr. is deleted, but both "Bill Jr." and "Bill Sr." Person records remain.

Delete a Person in a PersonAuthority

Deletes an existing Person record, specified by its CollectionSpace ID (CSID) or Short Identifier. Follows standard Delete model. Example:

DELETE /cspace-services/personauthorities/{person-auth-id}/items/{id} HTTP/1.1
List Person instances in a PersonAuthority

Lists existing Person records, with summary information for each. Follows standard List model. The PersonAuthority ({person-auth-id}) may be specified using either a CollectionSpace ID (CSID) or Short Identifier, using the syntax described for Person read, above. To search for items in all PersonAuthorities (vocabularies within a PersonAuthority), use _ALL_. See the documentation of the PersonItem-List schema, below.

Examples:

Returns the items in a particular PersonAuthority:

GET /cspace-services/personauthorities/{person-auth-id}/items HTTP/1.1

Returns the items across all PersonAuthorities (i.e. across all vocabularies within a PersonAuthority):

GET /cspace-services/personauthorities/_ALL_/items HTTP/1.1

List supports query parameters for customizing list results, such as pagination controls, query filters, and sorting options. For example:

GET /cspace-services/personauthorities/{person-auth-id}/items?pgSz=10 HTTP/1.1

List also supports query parameters for searching for matching records, including:

  • keyword search
  • partial term matching search, for term completion
  • term status filtering, to exclude (filter out) records matching one or more statuses

For example:

GET /cspace-services/personauthorities/{person-auth-id}/items?pt=foo&pgSz=10 HTTP/1.1

Person REST payload schemas

The schemas below are abbreviated, and are thus illustrative. For a full list of the fields that may potentially be present in payloads when creating, updating, or reading individual Person records, please see the most recent Person schema (i.e. for an individual Person term within a PersonAuthority or vocabulary).

Person instance schema

Create and Update should use the following schema.

On create, the value of inAuthority must match the identifier of the parent PersonAuthority, and will not be modified once the instance is created.

You can view the full set of validation constraints on the data you submit when creating or updating Person instance records, in the most recent CollectionSpace code, via this Java source code file.

Here's an example payload for creating a new instance:

<?xml version="1.0" encoding="utf-8"?>
<document name="persons">
  <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <inAuthority>e5c217c5-26ad-4289-b778</inAuthority>
    <personTermGroupList>
      <personTermGroup>
        <termDisplayName>John Wayne</termDisplayName>
        <termPrefForLang>true</termPrefForLang>
        <foreName>John</foreName>
        <surName>Wayne</surName>
        <initials>JW</initials>
        <termStatus>accepted</termStatus>
      </personTermGroup>
    </personTermGroupList>
    <birthDateGroup>
      <scalarValuesComputed>true</scalarValuesComputed>
      <dateDisplayDate>May 26, 1907</dateDisplayDate>
      <dateEarliestSingleYear>1907</dateEarliestSingleYear>
      <dateEarliestSingleDay>26</dateEarliestSingleDay>
      <dateEarliestSingleMonth>5</dateEarliestSingleMonth>
    </birthDateGroup>
    <deathDateGroup>
      <scalarValuesComputed>true</scalarValuesComputed>
      <dateDisplayDate>June 11, 1979</dateDisplayDate>
      <dateEarliestSingleYear>1979</dateEarliestSingleYear>
      <dateEarliestSingleDay>11</dateEarliestSingleDay>
      <dateEarliestSingleMonth>6</dateEarliestSingleMonth>
    </deathDateGroup>
    <birthPlace>urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(IA_Winterset)'Winterset, Iowa'</birthPlace>
    <bioNote>born Marion Robert Morrison and better
      known by his stage name John Wayne, was an American film actor, director
      and producer. He epitomized rugged masculinity and has become an enduring
      American icon. He is famous for his distinctive voice, walk and height.
      He was also known for his conservative political views and his support in
      the 1950s for anti-communist positions.
    </bioNote>
    <nameNote>Screen name</nameNote>
  </ns2:persons_common>
</document>

Read will return the above, plus additional fields (uri and csid) for access:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="persons">
  <ns2:persons-common xmlns:ns2="http://services.collectionspace.org/person">
  ...
  <uri>/personauthorities/f0cf4c50-8f8a-4df0-869a/items/a256aed3-0b0a-44e6-84b0</uri>
  <csid>a256aed3-0b0a-44e6-84b0</csid>
  </ns2:persons-common>
</document>
Related Person term records

As of v1.7, Authorities return list items of related terms in a new part. NOTE the new section called

<ns3:relations-common-list>

Here is a payload for a POST or PUT to /cspace-services/personauthorities/{csid}/items/{person-csid}

<?xml version="1.0" encoding="UTF-8"?>
<document name="persons">

  <ns2:persons_common xmlns:ns2="http://collectionspace.org/services/person" xmlns:ns3="http://collectionspace.org/services/jaxb">
    <inAuthority>${inAuthority}</inAuthority>
    <shortIdentifier>${shortIdentifier}</shortIdentifier>
    <personTermGroupList>
      <personTermGroup>
        <termDisplayName>John Wayne</termDisplayName>
        <termPrefForLang>true</termPrefForLang>
        <foreName>John</foreName>
        <surName>Wayne</surName>
        <initials>JW</initials>
        <termStatus>accepted</termStatus>
      </personTermGroup>
    </personTermGroupList>
  </ns2:persons_common>
  <ns3:relations-common-list>
    <relation-list-item>
      <uri>/relations/b33de521-bb8b-4a2a-b5b1</uri>
      <csid>b33de521-bb8b-4a2a-b5b1</csid>
      <predicate>hasBroader</predicate>
      <subject>
        <csid>3f31e7c5-24cf-44ec-8443</csid>
        <documentType>Person</documentType>
      </subject>
      <object>
        <csid>ee2c1c22-01b6-406a-908d</csid>
        <documentType>Person</documentType>
      </object>
    </relation-list-item>
  </ns3:relations-common-list>
</document>

NOTE: the special variable ${itemCSID} will be expanded to the CSID generated for the current AuthorityItem. (For Java use, please use the constant in CommonAPI.AuthorityItemCSID_REPLACE )
So if you POST to personauthorities and you include relations-common-list, then the item is the person you posted, so it gets created first, then in all the relations listed in relations-common-list, they refer to that item.

The elements are documented in the Relations service REST APIs:
http://wiki.collectionspace.org/display/collectionspace/Relationship+Service+RESTful+APIs

Person-List schema

List (and variants) will return the following schema.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ns2:abstract-common-list xmlns:ns2="http://services.collectionspace.org/person">
  <pageNum>0</pageNum>
  <pageSize>40</pageSize>
  <itemsInPage>3</itemsInPage>
  <totalItems>3</totalItems>
   <fieldsReturned>csid|uri|updatedAt|workflowState|foreName|surName|termDisplayName|shortIdentifier|refName|termStatus</fieldsReturned>
  <list-item>
    <displayName>Fred Jackson</displayName>
    <refName>
      urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(FredJackson1342809753068)'Fred Jackson'
    </refName>
    <uri>/personauthorities/f0cf4c50-8f8a-4df0-869a/items/a256aed3-0b0a-44e6-84b0</uri>
    <csid>a256aed3-0b0a-44e6-84b0</csid>
  </list-item>
  ...
</ns2:abstract-common-list>

Contact CRUD+L services

Each Person may have one or more instances of Contacts.

Contacts are only accessible via the owning Person. The sub-resource is accessed with "contacts". In the examples below, the {person-auth-id} parameter represents the CollectionSpace ID (CSID) or Short Identifier of an existing PersonAuthority instance, and the {person-id} represents the CollectionSpace ID (CSID) or Short Identifier of an existing Person item.

Create a Contact for a Person

Creates a new Contact record for a Person. Assigns a unique, service-specified CollectionSpace ID (CSID) to that Contact record. Follows standard Create model. See the documentation of the Contact schema, below. Example:

POST /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts HTTP/1.1
Read a Contact for a Person

Reads an existing Contact record for a Person, specified by its CollectionSpace ID (CSID). Follows standard Read model. See the documentation of the Contact schema, below. Example:

GET /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts/{id} HTTP/1.1
Update a Contact for a Person

Updates an existing Contact record for a Person, specified by its CollectionSpace ID (CSID). Follows standard Update model. See the documentation of the Contact schema, below. Example:

PUT /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts/{id} HTTP/1.1
Delete a Contact for a Person

Deletes an existing Contact record for a Person, specified by its CollectionSpace ID (CSID). Follows standard Delete model. Example:

DELETE /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts/{id} HTTP/1.1
List Contacts for a Person

Lists existing Contact records for a Person, with summary information for each. Follows standard List model. The PersonAuthority ({person-auth-id}) and PersonItem ({person-id}) may be specified either a CollectionSpace ID (CSID) or Short Identifier, using the syntax described for Person read, above. To search for contacts in all PersonAuthorities (vocabularies within a PersonAuthority), use _ALL_ for the {person-auth-id}. See the documentation of the Contact-List schema, below.

Examples:

GET /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts HTTP/1.1
GET /cspace-services/personauthorities/{person-auth-id}/items/{person-id}/contacts?pt=foo&pgSz=10 HTTP/1.1

Contact REST payload schemas

The schemas below are severely abbreviated, and are thus illustrative. For a full list of the fields that may potentially be present in payloads when creating, updating, or reading individual Contact sub-resource records, please see the Contact record schema for release 0.8.

Contact Instance schema

Create and Update should use the following schema.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="contacts">
<ns2:contacts_common xmlns:ns2="http://services.collectionspace.org/contact">
  <emailGroupList>
    <emailGroup>
      <emailType />
      <email>email@example.com</email>
    </emailGroup>
  </emailGroupList>
  <addressGroupList>
    <addressGroup>
        <addressPlace1>315 El Centro Pl.</addressPlace1>
      </addressGroup>
  </addressGroupList>
  ...
</ns2:contacts_common>
</document>

Read will return the above, as well. The example below shows the full set of attributes returned on the root element:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document
<ns2:contacts_common xmlns:ns2="http://services.collectionspace.org/contact"
  mxlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://collectionspace.org/services/contact
      http://services.collectionspace.org/contact/contacts_common.xsd">
  <inAuthority>7c2ddebe-1ccf-4908-bb9e</inAuthority>
  <inItem>7e5f5d6b-b92f-4e53-88d7</inItem>
  <displayName>email@example.com 315 El ...</displayName>
  <emailGroupList>
    <emailGroup>
      <emailType />
      <email>email@example.com</email>
    </emailGroup>
  </emailGroupList>
  <addressGroupList>
    <addressGroup>
        <addressPlace1>315 El Centro Pl.</addressPlace1>
      </addressGroup>
  </addressGroupList>
  ...
</ns2:contacts_common>
Contact List schema

List (and variants) will return the following schema.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <ns2:abstract-common-list xmlns:ns2="http://services.collectionspace.org/services/jaxb">
  <pageNum>0</pageNum>
  <pageSize>40</pageSize>
  <totalItems>3</totalItems>
  <list-item>
    <uri>/personauthorities/7c2ddebe-1ccf-4908-bb9e/items/7e5f5d6b-b92f-4e53-88d7/contacts/6ef7e4ae-f821-4235-990b</uri>
    <csid>6ef7e4ae-f821-4235-990b</csid>
    <displayName>email@example.com 315 El ...</displayName>
  </list-item>
  ...
</ns2:abstract-common-list>