Person Service REST APIs
Brief Description
Assumptions
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
- PersonAuthority REST payload schemas
- Person CRUD+L services
- Person REST payload schemas
- Contact CRUD+L services
- Contact REST payload schemas
PersonAuthority CRUD+L services
Create a PersonAuthority
Creates a new PersonAuthority record. Assigns a unique, service-specified /wiki/spaces/collectionspace/pages/666274321 to that PersonAuthority record. Follows standard Create model. See the documentation of the PersonAuthority schema, below. Example:
Read a PersonAuthority
Reads an existing PersonAuthority record, specified by its /wiki/spaces/collectionspace/pages/666274321. Follows standard Read model. See the documentation of the PersonAuthority schema, below.
General form:
Example, reading an existing record with a CSID of e450e8e8-9f12-49f3-aba4-43b7c46344a2:
An alternate form reads an existing PersonAuthority record, specified by its /wiki/spaces/collectionspace/pages/666273476, 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:
Example, reading an existing record with a shortIdentifier
value of myDefaultPersonAuthority
:
Update a PersonAuthority
Updates an existing PersonAuthority record, specified by its /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476. Follows standard Update model. See the documentation of the PersonAuthority schema, below. Example:
Delete a PersonAuthority
Deletes an existing PersonAuthority record, specified by its /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476. Follows standard Delete model. Example:
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:
List supports query parameters for customizing list results, such as pagination controls, query filters, and sorting options. For example:
List also supports query parameters for searching for matching records, including keyword search. For example:
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".
Read will return the above, plus additional fields (uri and csid) for access:
PersonAuthority-List schema
List (and variants) will return the following schema.
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 /wiki/spaces/collectionspace/pages/666274321 to that Person record. Follows standard Create model. See the documentation of the Person schema, below. Example:
You may also POST a part called
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.
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476. Follows standard Read model. See the documentation of the Person schema, below. Example:
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476. Follows standard Update model. See the documentation of the Person schema, below. Example:
You may also PUT a part called
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476. Follows standard Delete model. Example:
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476, 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:
Returns the items across all PersonAuthorities (i.e. across all vocabularies within a PersonAuthority):
List supports query parameters for customizing list results, such as pagination controls, query filters, and sorting options. For example:
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:
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:
Read will return the above, plus additional fields (uri and csid) for access:
Related Person term records
As of v1.7, Authorities return list items of related terms in a new part. NOTE the new section called
Here is a payload for a POST or PUT to /cspace-services/personauthorities/{csid}/items/{person-csid}
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.
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476 of an existing PersonAuthority instance, and the {person-id
} represents the /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476 of an existing Person item.
Create a Contact for a Person
Creates a new Contact record for a Person. Assigns a unique, service-specified /wiki/spaces/collectionspace/pages/666274321 to that Contact record. Follows standard Create model. See the documentation of the Contact schema, below. Example:
Read a Contact for a Person
Reads an existing Contact record for a Person, specified by its /wiki/spaces/collectionspace/pages/666274321. Follows standard Read model. See the documentation of the Contact schema, below. Example:
Update a Contact for a Person
Updates an existing Contact record for a Person, specified by its /wiki/spaces/collectionspace/pages/666274321. Follows standard Update model. See the documentation of the Contact schema, below. Example:
Delete a Contact for a Person
Deletes an existing Contact record for a Person, specified by its /wiki/spaces/collectionspace/pages/666274321. Follows standard Delete model. Example:
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 /wiki/spaces/collectionspace/pages/666274321 or /wiki/spaces/collectionspace/pages/666273476, 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:
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.
Read will return the above, as well. The example below shows the full set of attributes returned on the root element:
Contact List schema
List (and variants) will return the following schema.