Organization Service REST APIs
Brief Description
Assumptions
References
Vocabulary and Authority Overview
Organization Service Description and Assumptions
Organization Service Entity Diagrams
Name Authority Schema and Name Authority Schema - Limited for Release 0.8
REST-based API
The Organization Service offers a REST-based Application Programming Interface (API) to CRUD (create, read, update, and delete) operations on individual OrganizationAuthority instances, and on the associated Organization instances. These follow the Common model for CollectionSpace REST services.
Note that the Organization instances are not directly "addressible"; they can only be accessed via the parent OrganizationAuthority.
- OrganizationAuthority CRUD+L services
- OrganizationAuthority REST payload schemas
- Organization CRUD+L services
- Organization REST payload schemas
- Contact CRUD+L services
- Contact REST payload schemas
OrganizationAuthority CRUD+L services
Create an OrganizationAuthority
Creates a new OrganizationAuthority record. Assigns a unique, service-specified CollectionSpace ID (CSID) to that OrganizationAuthority record. Follows standard Create model. See the documentation of the OrganizationAuthority schema, below. Example:
POST /cspace-services/orgauthorities HTTP/1.1
Read an OrganizationAuthority
Reads an existing OrganizationAuthority record, specified by its CollectionSpace ID (CSID). Follows standard Read model. See the documentation of the OrganizationAuthority schema, below. Example:
GET /cspace-services/orgauthorities/{id} HTTP/1.1
Update an OrganizationAuthority
Updates an existing OrganizationAuthority record, specified by its CollectionSpace ID (CSID). Follows standard Update model. See the documentation of the OrganizationAuthority schema, below. Example:
PUT /cspace-services/orgauthorities/{id} HTTP/1.1
Delete an OrganizationAuthority
Deletes an existing OrganizationAuthority record, specified by its CollectionSpace ID (CSID). Follows standard Delete model. Example:
DELETE /cspace-services/orgauthorities/{id} HTTP/1.1
List OrganizationAuthority instances
Lists existing OrganizationAuthority records, with summary information for each. Follows standard List model, with pagination support. See the documentation of the OrganizationAuthority-List schema, below.
GET /cspace-services/orgauthorities 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/orgauthorities?pgSz=10 HTTP/1.1
List also supports query parameters for searching for matching records, including keyword search. For example:
GET /cspace-services/orgauthorities?kw=foo&pgSz=10 HTTP/1.1
OrganizationAuthority 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 OrganizationAuthority records, please see the most recent OrganizationAuthority schema.
OrganizationAuthority instance schema
Create and Update should use the following schema. The value of vocabType must be "OrgAuthority".
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <document name="orgauthorities"> <ns2:orgauthorities-common xmlns:ns2="http://services.collectionspace.org/organization"> <displayName>Local Organizations</displayName> <refName>urn:cspace:core.collectionspace.org:orgauthority:name(LocalOrgs)'Local Organizations'</refName> <vocabType>OrgAuthority</vocabType> ... </ns2:orgauthorities-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="orgauthorities"> <ns2:orgauthorities-common xmlns:ns2="http://services.collectionspace.org/organization"> ... <uri>/orgauthorities/f0cf4c50-8f8a-4df0-869a</uri> <csid>f0cf4c50-8f8a-4df0-869a</csid> </ns2:orgauthorities-common> </document>
OrganizationAuthority-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> <list-item> <displayName>Museum Internal</displayName> <refName>urn:cspace:core.collectionspace.org:orgauthorities:name(LocalOrgs)'Local Organizations'</refName> <vocabType>OrgAuthority</vocabType> <uri>/orgauthorities/f0cf4c50-8f8a-4df0-869a</uri> <csid>f0cf4c50-8f8a-4df0-869a</csid> </list-item> ... </ns2:abstract-common-list>
Organization CRUD+L services
Organization instances are only accessible via the owning OrganizationAuthority. The sub-resource is accessed with "items" (for consistency across all vocabulary-like services). In the examples below, the {org-auth-id} parameter represents an identifier (such as a CSID value or Short Identifier) of an existing OrganizationAuthority instance.
Create an Organization in an OrganizationAuthority
Creates a new Organization record. Assigns a unique, service-specified CollectionSpace ID (CSID) to that Organization record. Follows standard Create model. See the documentation of the Organization schema, below. Example:
POST /cspace-services/orgauthorities/{org-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 Organization 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="organizations"> <ns2:organizations_common xmlns:ns2="http://collectionspace.org/services/organization" xmlns:ns3="http://collectionspace.org/services/jaxb"> <inAuthority>42b2923f-b89b-494c-ba7f</inAuthority> <orgTermGroupList> <orgTermGroup> <additionsToName>University of California, Berkeley</additionsToName> <termName>The Original Example Museum of Berkeley, CA</termName> <termPrefForLang>true</termPrefForLang> <termDisplayName>Example Museum, Berkeley, CA</termDisplayName> <termStatus>provisional</termStatus> </orgTermGroup> </orgTermGroupList> </ns2:organizations_common> <!-- WARNING: ${itemCSID} does NOT get expanded by XmlReplay. It passes through and then the service deals with it. --> <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> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </subject> <object> <csid>e65d0867-3d10-4d2e-8eed</csid> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/e65d0867-3d10-4d2e-8eed</uri> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <csid>ba0c9e5f-0c00-4deb-b29d</csid> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/ba0c9e5f-0c00-4deb-b29d</uri> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/73487157-5110-4292-9cf8</uri> <csid>73487157-5110-4292-9cf8</csid> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/6884ecdc-e205-4407-b3f3</uri> <csid>6884ecdc-e205-4407-b3f3</csid> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</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 an Organization in an OrganizationAuthority
Reads an existing Organization record, specified by its CollectionSpace ID (CSID). Follows standard Read model. See the documentation of the Organization schema, below. Example:
GET /cspace-services/orgauthorities/{org-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 an Organization in an OrganizationAuthority
Updates an existing Organization record, specified by its CollectionSpace ID (CSID). Follows standard Update model. See the documentation of the Organization schema, below. Example:
PUT /cspace-services/orgauthorities/{org-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 Organization "Sub-Org", with relations-common-list that has an entry for ${itemCSID} hasBroader "Parent-Org" creates a relations record that references both Sub-Org and Parent-Org. When a PUT is made that does not have the relation for Parent-Org, then Sub-Org has no relations, so the relations record for Sub-Org==>hasBroader==>Parent-Org is deleted, but both "Sub-Org" and "Parent-Org" Person records remain.
Delete an Organization in an OrganizationAuthority
Deletes an existing Organization record, specified by its CollectionSpace ID (CSID). Follows standard Delete model. Example:
DELETE /cspace-services/orgauthorities/{org-auth-id}/items/{id} HTTP/1.1
List Organization instances in an OrganizationAuthority
Lists existing Organization records, with summary information for each. Follows standard List model, with pagination support. See the documentation of the Organization-List schema, below.
GET /cspace-services/orgauthorities/{org-auth-id}/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/orgauthorities/{org-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/orgauthorities/{org-auth-id}/items?pt=foo&pgSz=10 HTTP/1.1
Organization 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 Organization records, please see the most recent Organization schema (i.e. for an individual Organization term within a OrganizationAuthority or vocabulary).
Organization instance schema
Create and Update should use the following schema.
On create, the value of inAuthority must match the identifier of the parent OrganizationAuthority, 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 Organization instance records, in the most recent CollectionSpace code, via this Java source code file.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <document name="organizations"> <ns2:organizations_common xmlns:ns2="http://collectionspace.org/services/organization" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <inAuthority>42b2923f-b89b-494c-ba7f</inAuthority> <orgTermGroupList> <orgTermGroup> <additionsToName>University of California, Berkeley</additionsToName> <termName>The Original Example Museum of Berkeley, CA</termName> <termPrefForLang>true</termPrefForLang> <termDisplayName>Example Museum, Berkeley, CA</termDisplayName> <termStatus>provisional</termStatus> </orgTermGroup> </orgTermGroupList> <foundingDateGroup> <dateDisplayDate>1901</dateDisplayDate> <dateEarliestSingleYear>1901</dateEarliestSingleYear> </foundingDateGroup> <contactNames> <contactName>urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnDoe1342736103374)'John Doe'</contactName> </contactNames> <refName>urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ExampleMuseumBerkeleyCA1342737315637)'Example Museum, Berkeley, CA'</refName> </ns2:organizations_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="organizations"> <ns2:organizations-common xmlns:ns2="http://services.collectionspace.org/organization"> ... <uri>/orgauthorities/f0cf4c50-8f8a-4df0-869a/items/a256aed3-0b0a-44e6-84b0</uri> <csid>a256aed3-0b0a-44e6-84b0</csid> </ns2:organizations-common> </document>
Related Organization 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/orgauthorities/{csid}/items/{person-csid}
<?xml version="1.0" encoding="UTF-8"?> <document name="organizations"> <ns2:organizations_common xmlns:ns2="http://collectionspace.org/services/organization" xmlns:ns3="http://collectionspace.org/services/jaxb"> <orgTermGroupList> <orgTermGroup> <additionsToName>University of California, Berkeley</additionsToName> <termName>The Original Example Museum of Berkeley, CA</termName> <termPrefForLang>true</termPrefForLang> <termDisplayName>Example Museum, Berkeley, CA</termDisplayName> <termStatus>provisional</termStatus> </orgTermGroup> </orgTermGroupList> </ns2:organizations_common> <!-- WARNING: ${itemCSID} does NOT get expanded by XmlReplay. It passes through and then the service deals with it. --> <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> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </subject> <object> <csid>e65d0867-3d10-4d2e-8eed</csid> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/e65d0867-3d10-4d2e-8eed</uri> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <csid>ba0c9e5f-0c00-4deb-b29d</csid> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/ba0c9e5f-0c00-4deb-b29d</uri> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/73487157-5110-4292-9cf8</uri> <csid>73487157-5110-4292-9cf8</csid> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</documentType> </object> </relation-list-item> <relation-list-item> <predicate>hasBroader</predicate> <subject> <uri>/cspace-services/orgauthorities/urn:cspace:name(CSPACE3739OrganizationAuthority)/items/6884ecdc-e205-4407-b3f3</uri> <csid>6884ecdc-e205-4407-b3f3</csid> <documentType>Organization</documentType> </subject> <object> <csid>${itemCSID}</csid> <documentType>Organization</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 orgauthorities and you include relations-common-list, then the item is the organization 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
Organization-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> <pageNum>0</pageNum> <pageSize>40</pageSize> <itemsInPage>9</itemsInPage> <totalItems>9</totalItems <fieldsReturned>csid|uri|updatedAt|workflowState|termDisplayName|shortIdentifier|refName|termStatus</fieldsReturned> <list-item> <csid>a69237be-71c4-4cde-9140</csid> <uri>/orgauthorities/52a51b28-fcec-4d69-947d/items/a69237be-71c4-4cde-9140</uri> <updatedAt>2012-07-25T01:16:42Z</updatedAt> <workflowState>project</workflowState> <termDisplayName>Example Museum, Berkeley, CA</termDisplayName> <shortIdentifier>ExampleMuseumBerkeleyCA1343179002350</shortIdentifier> <refName>urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ExampleMuseumBerkeleyCA1343179002350)'Example Museum, Berkeley, CA'</refName> <termStatus>provisional</termStatus> </list-item> ... </ns2:organizations-common-list>
Contact CRUD+L services
Each Organization may have one or more instances of Contacts.
Contacts are only accessible via the owning Organization. The sub-resource is accessed with "contacts". In the examples below, the {org-auth-id
} parameter represents an identifier (such as a CSID value or Short Identifier) of an existing OrgAuthority instance, and the {organization-id
} represents an identifier (such as a CSID value or Short Identifier) of an existing Organization item.
Create a Contact for an Organization
Creates a new Contact record for an Organization. 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/orgauthorities/{org-auth-id}/items/{organization-id}/contacts HTTP/1.1
Read a Contact for an Organization
Reads an existing Contact record for a Organization, specified by its CollectionSpace ID (CSID). Follows standard Read model. See the documentation of the Contact schema, below. Example:
GET /cspace-services/orgauthorities/{org-auth-id}/items/{organization-id}/contacts/{id} HTTP/1.1
Update a Contact for an Organization
Updates an existing Contact record for an Organization, specified by its CollectionSpace ID (CSID). Follows standard Update model. See the documentation of the Contact schema, below. Example:
PUT /cspace-services/orgauthorities/{org-auth-id}/items/{organization-id}/contacts/{id} HTTP/1.1
Delete a Contact for an Organization
Deletes an existing Contact record for an Organization, specified by its CollectionSpace ID (CSID). Follows standard Delete model. Example:
DELETE /cspace-services/orgauthorities/{org-auth-id}/items/{organization-id}/contacts/{id} HTTP/1.1
List Contacts for an Organization
Lists existing Contact records for an Organization, with summary information for each. Follows standard List model. See the documentation of the Contact-List schema, below.
GET /cspace-services/orgauthorities/{org-auth-id}/items/{organization-id}/contacts 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/orgauthorities/{org-auth-id}/items/{organization-id}/contacts?pgSz=10 HTTP/1.1
List also supports query parameters for searching for matching records, including keyword search. For example:
GET /cspace-services/orgauthorities/{org-auth-id}/items/{organization-id}/contacts?kw=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>/orgauthorities/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>