Place Service REST APIs

Place Service Home

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
Place Service Description and Assumptions
Place Service Entity Diagrams
Place Authority Schema

REST-based API

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

Note that Place items are not directly "addressable"; they can only be accessed via the parent PlaceAuthority.

PlaceAuthority CRUD+L services

Create a PlaceAuthority

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

POST /cspace-services/placeauthorities HTTP/1.1
Read a PlaceAuthority

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

GET /cspace-services/placeauthorities/{id} HTTP/1.1
Update a PlaceAuthority

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

PUT /cspace-services/placeauthorities/{id} HTTP/1.1
Delete a PlaceAuthority

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

DELETE /cspace-services/placeauthorities/{id} HTTP/1.1
List PlaceAuthority instances

Lists existing PlaceAuthority records, with summary information for each. Follows standard List model, with pagination support. See the documentation of the PlaceAuthority-List schema, below. List supports the following common parameters for List results, pagination controls and query filters:

  • pgSz for page size
  • pgNum for page size

Examples:

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

PlaceAuthority 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 PlaceAuthority records, please see the most recent PlaceAuthority schema

PlaceAuthority instance schema

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

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<document name="placeauthorities">
  <ns2:placeauthorities_common xmlns:ns2="http://services.collectionspace.org/place">
    <displayName>Default PlaceAuthority</displayName>
    <shortIdentifier>place</shortIdentifier>
    <vocabType>PlaceAuthority</vocabType>
  </ns2:placeauthorities_common>
</document>

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

<?xml version="1.0" encoding="UTF-8"?>
<document name="placeauthorities">
  <ns2:collectionspace_core xmlns:ns2="http://collectionspace.org/collectionspace_core/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
    <uri>/placeauthorities/afbb91ca-3988-4524-bada</uri>
    ...
  </ns2:collectionspace_core>
  <ns2:placeauthorities_common xmlns:ns2="http://collectionspace.org/services/place" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
    <csid>afbb91ca-3988-4524-bada</csid>
    ...
  </ns2:placeauthorities_common>
</document>
PlaceAuthority-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://collectionspace.org/services/jaxb">
  <pageNum>0</pageNum>
  <pageSize>40</pageSize>
  <itemsInPage>3</itemsInPage>
  <totalItems>3</totalItems>
  <fieldsReturned>csid|uri|updatedAt|displayName|refName|shortIdentifier|vocabType</fieldsReturned>
  <list-item>
    <csid>afbb91ca-3988-4524-bada</csid>
    <uri>/placeauthorities/afbb91ca-3988-4524-bada</uri>
    <updatedAt>2012-03-29T00:51:04Z</updatedAt>
    <displayName>Default PlaceAuthority</displayName>
    <refName>urn:cspace:core.collectionspace.org:placeauthorities:name(place)'Default PlaceAuthority'</refName>
    <shortIdentifier>place</shortIdentifier>
    <vocabType/>
  </list-item>
  ...
</ns2:abstract-common-list>

Place CRUD+L services

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

Create a Place item in a PlaceAuthority

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

POST /cspace-services/placeauthorities/{place-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 the CSIDs of two other Place records, which must exist before this call. The special variable ${itemCSID} will be expanded to the CSID of the newly created Place. (For Java use, please use the constant in CommonAPI.AuthorityItemCSID_REPLACE )

<?xml version="1.0" encoding="UTF-8"?>
<document name="places">
    <ns2:places_common xmlns:ns2="http://collectionspace.org/services/place" xmlns:ns3="http://collectionspace.org/services/jaxb">
    	<inAuthority>aab04036-7c9a-492d-a4d5</inAuthority>
    	<shortIdentifier>SantaClaraCountyCA</shortIdentifier>
          <placeTermGroupList>
            <placeTermGroup>
            <historicalStatus>current</historicalStatus>
            <termDisplayName>Santa Clara County, CA</termDisplayName>
          </placeTermGroup>
        </placeTermGroupList>
        ...
      </ns2:places_common>
      <ns3:relations-common-list xmlns:ns3="http://collectionspace.org/services/relation" xmlns:ns2="http://collectionspace.org/services/jaxb">
        <!-- NOTE: The newly created object can only have one parent (i.e., be the subject of the
             hasBroader relationship), but it can have many children (i.e., be the object of that relationship). -->
	     <relation-list-item>
		  <predicate>hasBroader</predicate>
		  <subject>
			<csid>${itemCSID}</csid>
			<documentType>Placeitem</documentType>
		  </subject>
		  <object>
			<csid>4a895c6e-c3b0-4fdd-a9a3</csid>
			<uri>/cspace-services/placeauthorities/urn:cspace:name(place)/items/4a895c6e-c3b0-4fdd-a9a3</uri>
			<documentType>Placeitem</documentType>
		  </object>
		</relation-list-item>
		<relation-list-item>
		  <predicate>hasBroader</predicate>
		  <subject>
			<csid>70c840c5-b0a7-4e59-a2fb</csid>
			<uri>/cspace-services/placeauthorities/urn:cspace:name(place)/items/70c840c5-b0a7-4e59-a2fb</uri>
			<documentType>Placeitem</documentType>
		  </subject>
		  <object>
			<csid>${itemCSID}</csid>
			<documentType>Placeitem</documentType>
		  </object>
		</relation-list-item>
		<relation-list-item>
		  <predicate>hasBroader</predicate>
		  <subject>
			<uri>/cspace-services/placeauthorities/urn:cspace:name(place)/items/e52c20df-23db-4531-8368</uri>
			<csid>e52c20df-23db-4531-8368</csid>
			<documentType>Placeitem</documentType>
		  </subject>
		  <object>
			<csid>${itemCSID}</csid>
			<documentType>Placeitem</documentType>
		  </object>
		</relation-list-item>
		<relation-list-item>
		  <predicate>hasBroader</predicate>
		  <subject>
			<uri>/cspace-services/placeauthorities/urn:cspace:name(place)/items/ba275c55-9545-48f3-900e</uri>
			<csid>ba275c55-9545-48f3-900e</csid>
			<documentType>Placeitem</documentType>
		  </subject>
		  <object>
			<csid>${itemCSID}</csid>
			<documentType>Placeitem</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 here:
http://wiki.collectionspace.org/display/collectionspace/Person+Service+REST+APIs?focusedCommentId=72220749&#comment-72220749

Read a Place in a PlaceAuthority

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

GET /cspace-services/placeauthorities/{place-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 Place in a PlaceAuthority

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

PUT /cspace-services/placeauthorities/{place-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 Place "San Jose, CA", with relations-common-list that has an entry for ${itemCSID} hasBroader "Santa Clara County" creates a relations record that references both San Jose, CA and Santa Clara County. When a PUT is made that does not have the relation for Santa Clara County, then San Jose, CA has no relations, so the relations record for San Jose, CA==>hasBroader==>Santa Clara County is deleted, but both "San Jose, CA" and "Santa Clara County" Place records remain.

Delete a Place in a PlaceAuthority

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

DELETE /cspace-services/placeauthorities/{place-auth-id}/items/{id} HTTP/1.1
List Place instances in a PlaceAuthority

Lists existing Place records, with summary information for each. Follows standard List model. See the documentation of the Place-List schema, below. List supports the following common parameters for List results, pagination controls and query filters:

  • pgSz for page size
  • pgNum for page size
  • pt for partial-term matching, to support term completion.

Examples:

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

Place 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 Place records, please see the most recent Place schema (i.e. for an individual Place term within a PlaceAuthority or vocabulary).

Place instance schema

Create and Update should use the following schema.

On create, the value of inAuthority must match the identifier of the parent PlaceAuthority, 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 Place instance records, in the most recent CollectionSpace code, via this Java source code file.

<?xml version="1.0" encoding="UTF-8"?>
<document name="places">
  <ns2:places_common xmlns:ns2="http://collectionspace.org/services/place" xmlns:ns3="http://collectionspace.org/services/jaxb">
    <inAuthority>6ca3db57-7c96-47b6-b17d</inAuthority>
    <shortIdentifier>SanJoseCA</shortIdentifier>
    <placeTermGroupList>
      <placeTermGroup>
        <historicalStatus>current</historicalStatus>
        <termDisplayName>San Jose, CA</termDisplayName>
      </placeTermGroupList>
    </placeTermGroup>
    ...
  </ns2:places_common>
</document>

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

<?xml version="1.0" encoding="UTF-8"?>
<document name="places">
  <ns2:collectionspace_core xmlns:ns2="http://collectionspace.org/collectionspace_core/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
    <uri>/placeauthorities/6ca3db57-7c96-47b6-b17d/items/d286deaa-245c-4505-8b6d</uri>
    ...
  </ns2:collectionspace_core>
  <ns2:places_common xmlns:ns2="http://collectionspace.org/services/place" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
    <csid>d286deaa-245c-4505-8b6d</csid>
    ...
  </ns2:places_common>
  ...
</document>
Place-List schema

List (and variants) will return a schema similar to the following example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
  <pageNum>0</pageNum>
  <pageSize>40</pageSize>
  <itemsInPage>8</itemsInPage>
  <totalItems>8</totalItems>
  <fieldsReturned>csid|uri|updatedAt|termType|displayName|shortIdentifier|refName|termStatus</fieldsReturned>
  <list-item>
    <csid>8efbeed8-b592-4683-869f</csid>
    <uri>/placeauthorities/6ca3db57-7c96-47b6-b17d/items/8efbeed8-b592-4683-869f</uri>
    <updatedAt>2012-03-29T01:26:46Z</updatedAt>
    <displayName>San Jose, CA</displayName>
    <shortIdentifier>SanJoseCA</shortIdentifier>
    <refName>urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(SanJoseCA)'San Jose, CA'</refName>
    <termStatus/>
  </list-item>
  ...
</ns2:abstract-common-list>