CONTENTdm Server API Functions - dmwebservices
- Last updated
- Save as PDF
Overview
dmwebservices is a simple wrapper around the CONTENTdm Server API functions, with a few exceptions to improve error handling. A few additional API functions are handled by the utils controller on the CONTENTdm Website instead of by dmwebservices on the CONTENTdm Server.
dmwebservices provides an interface to the CONTENTdm Server API functions, in the form:
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=function/param1/param2/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- function: One of the API functions listed below
- param1, param2, etc.: Function-specific parameters documented in the function references linked below
- format: Either "xml" to return the response as XML, or "json" to return JSON
For CONTENTdm sites hosted by OCLC, note the following:
- The Website URL must use HTTPS:// rather than HTTP://
- Do not use a port number (":81") with the Website URL.
- Do not use the loopback interface ("localhost") in place of the WebsiteURL.
Application-level functions
wsAPIDescribe
- wsAPIDescribe
-
Signature Returns Example http://yourCONTENTdmURL/digital/bl/dmwebservices/index.php?q=wsAPIDescribe/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- format is either xml or json
The version number of the API.
http://yourCONTENTdmUR/digital/bl/dmwebservices/index.php?q=wsAPIDescribe/xml
Server-level functions
dmGetCollectionList
- dmGetCollectionList
-
Signature Example http://yourCONTENTdmURL/digital/bl/dmwebservices/index.php?q=dmGetCollectionList/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- format is either xml or json
http://yourCONTENTdmURL/digital/bl/dmwebservices/index.php?q=dmGetCollectionList/xml
dmGetDublinCoreFieldInfo
- dmGetDublinCoreFieldInfo
-
Signature Example http://yourCONTENTdmURL/digital/bl/dmwebservices/index.php?
q=dmGetDublinCoreFieldInfo/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetDublinCoreFieldInfo/xml
dmGetLocale
- dmGetLocale
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetLocale/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetLocale/xml
dmGetStopWords
- dmGetStopWords
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetStopWords/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- format is either xml or json
Stopwords.txt is a global file for the server, so no collection alias is required.
A list of the stop words listed in Stopwords.txt.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetStopWords/json
Collection-level functions
dmGetCollectionArchivalInfo
- dmGetCollectionArchivalInfo
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionArchivalInfo/alias/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionArchivalInfo/ctimes/xml
dmGetCollectionDisplayImageSettings
- dmGetCollectionDisplayImageSettings
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionDisplayImageSettings/alias/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionDisplayImageSettings/ctimes/xml
dmGetCollectionFieldInfo
- dmGetCollectionFieldInfo
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFieldInfo/alias/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
In JSON, Unicode characters in the field's name are converted to decimal Unicode entities. E.g., 題名 is converted to \u984c\u540d
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFieldInfo/ctimes/xml
dmGetCollectionFieldVocabulary
- dmGetCollectionFieldVocabulary
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFieldVocabulary/alias/nickname/forcedict/forcefullvoc/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- nickname is the field nickname
- forcedict is either "0" or "1". Specifying "1" forces a return of the dictionary instead of the controlled vocabulary. By default, if a controlled vocabulary is returned, only those terms that actually appear in the field metadata in the collection are returned.
- forcefullvoc is either "0" or "1". Specifying "1" forces a return of the full controlled vocabulary.
- format is either xml or json
Returns an array of terms for the field specified by the given collection alias and field nickname.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFieldVocabulary/ctimes/subjec/0/1/xml
dmGetCollectionFullResVolumeInfo
- dmGetCollectionFullResVolumeInfo
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFullResVolumeInfo/alias/volume/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- volume is the volume name
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionFullResVolumeInfo/ukr/83062/xml
dmGetCollectionImageSettings
- dmGetCollectionImageSettings
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionImageSettings/alias/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionImageSettings/ctimes/xml
dmGetCollectionParameters
- dmGetCollectionParameters
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetCollectionParameters/alias/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetCollectionParameters/ctimes/xml
dmGetCollectionPDFInfo
- dmGetCollectionPDFInfo
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionPDFInfo/alias/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionPDFInfo/ctimes/xml
dmGetCollectionWords
- dmGetCollectionWords
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionWords/alias/fields/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- fields is a !-delimited list of field nicknames listing the fields for which the words should be returned. Can also be "all" for all fields.
- format is either xml or json
A list in the specified format of the indexed words for all fields or only those specified. http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetCollectionWords/mycollection/title!subjec/xml
Item-level functions
dmCheckStreamingUrl
- dmCheckStreamingUrl
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmCheckStreamingUrl/alias/find/extension/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- find is the file name from the find property of dmGetItemInfo
- extension is the file extension
- format is json
This checks to see if an item type with no defined viewer is a streaming item as defined in stream.txt on the server. http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmCheckStreamingUrl/mycollection/1.ram/ram/json
returns:
{"s":true,"url":"http:\/\/www.myurl.com/1.ram"}
dmEADSearchTotals
- dmEADSearchTotals
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmEADSearchTotals/alias/searchterm^mode/id/pagecount/document_type/find/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- searchterm^mode where searchterm is the term searched for, and mode is the type of search. mode can be "any", "all", or "exact".
- id is the object ID
- pagecount is the number of pages in the compound object
- document_type is findingaid
- find is the file name from the find property of dmGetItemInfo
- format is xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmEADSearchTotals/mycollection/bridge^any/8/2/findingaid/9.cpd/json
returns:
{"pager":{"start":1,"maxrecs":10,"total":10},"records":[["6",39],["7",4]]}
dmFullTextTotals
- dmFullTextTotals
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmFullTextTotals/alias/field^searchterm^mode/return_field/id/pagecount/document_type/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- field^searchterm^mode where field is the full text search field; searchterm is the term searched for; and mode is the type of search. mode can be "any", "all", or "exact".
- return_field is the field returned from the search. For this function, this is the same as the searched full text field
- id is the object ID
- pagecount is the number of pages in the compound object
- document_type is type of document ("compobj")
- find is the file name from the find property of dmGetItemInfo
- format is xml or json
This returns the total number of page matches and the page IDs with the number of matches per page. The example search below finds matches on three of six pages, with one match on the page with ID 96. http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmFullTextTotals/mycollection/transc^bridge^any/transc/102/6/compobj/json
Returns
{"pager":{"start":0,"maxrecs":"6","total":3},"records":[[96,1],[98,5],[99,4]]}
dmGetCompoundObjectInfo
- dmGetCompoundObjectInfo
-
Returns the flat structure:
<?xml version="1.0"?>
Document
Page 1
76755.jpg
69997
Page 2
76756.jpg
69998
Page 3
76757.jpg
69999
Page 4
76758.jpg
70000
Page 5
76759.jpg
70001
dmGetImageInfo
- dmGetImageInfo
-
Signature Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetImageInfo/alias/pointer/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the pointer to the item whose image info you want to get
- format is either xml or json
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetImageInfo/pgpl/525/xml
dmGetItemInfo
- dmGetItemInfo
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetItemInfo/alias/pointer/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the pointer to the item for which you want metadata
- format is either xml or json
This function returns the descriptive metadata and administrative metadata for an item. Elements in the descriptive metadata are determined by the collection's field configuration, and administrative metadata is added automatically by CONTENTdm. Empty fields are present in XML as empty elements and in JSON as empty arrays. If the item is not found, the function returns the following error message:
-2Requested item not found
This function also makes direct calls to dmItemHasOCRText and dmItemFileSize to eliminate the need for extra API calls.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=dmGetItemInfo/uw/31/jsonreturns:
{
"title": "Prince George Citizen, Wednesday, May 17th 1916",
"date": "1916-05-17;",
"rights": "Public domain",
"format": "Text",
"type": "Image\/jpeg",
"langua": "eng",
"full": {
},
"fullrs": {
},
"find": "526.cpd",
"dmaccess": {
},
"dmimage": {
},
"dmcreated": "2009-09-22",
"dmmodified": "2009-09-22",
"dmoclcno": {
},
"dmrecord": "525",
"cdmfilesize":"216777",
"cdmfilesizeformatted":"0.21 MB",
"cdmhasocr":"1"
}The XML version of this record is:
1916-05-17;
Public domain
Text
Image/jpeg
eng
526.cpd
2009-09-22
2009-09-22
525
216777
0.21 MB
1
dmGetItemUrl
- dmGetItemUrl
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetItemUrl/alias/find/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- find is the file name from the find property of dmGetItemInfo
- format is json
This function retrieves the URL of a URL item.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetItemUrl/mycollection/1.url/json
returns:
{"URL":"http:\/\/www.myurl.com"}
dmGetRecent
- dmGetRecent
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetRecent/alias/num/fields/mode/imagesonly/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- num is the number of items to return
- fields is a !-delimited list of field nicknames listing the fields for which metadata should be returned. A maximum of five fields may be specified. A maximum of 100 bytes is returned for each field.
- mode is the type of query to execute to return either the most recent, the oldest, or a random set of items. 0=most recent (default), 1=oldest, 2=random
- imagesonly can be set to "1" or "0": 1=images only (default), 0=all items
- format can be xml or json
A list of records produced by the query, plus a total for the number of records returned.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetRecent/mycollection/5/title/0/1/xml
returns:
< xml version="1.0" encoding="UTF-8"?>
< results>
< total>5 < records>
< record>
< collection> < pointer> < title> < date> < /record>
< record>
< collection> < pointer> < title> < date> < /record>
< record>
< collection> < pointer> < title> < ;date> < ;/record>
< record>
< collection> < pointer> < title> < date> < /record>
< record>
< collection> < pointer> < title> < date> < record>
< /records>
< /results;>
dmGetStreamingFile
- dmGetStreamingFile
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetStreamingFile/alias/find/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- find is the file name from the find property of dmGetItemInfo
- format is either xml or json
This function will get the local file and deliver it as a streaming resource for playback or download.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmGetStreamingFile/mycollection/1.mp4/xml
dmItemFileSize
- dmItemFileSize
-
Signature Returns Example Note http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmItemFileSize/alias/pointer/extension/sizeunit/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the id of the item for which to retrieve the size
- extension is the file extension of the item
- sizeunit is an integer to denote the units for the returned formatted string: 0 for bytes, 1 for KB, 2 for MB, 3 for GB
- format can be xml or json or function. When calling the method directly through the URL, xml or json should be used. When calling the method from another function within the API (as done in dmGetItemInfo), function should be used.
An array with two items: the size in bytes (unformatted) and the formatted string based on the size unit passed in. http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmItemFileSize/mycollection/7/pdf/2/json
returns:
Array([size] => 16831177 [formatted] => 16.05 MB)
This function is also called directly from dmGetItemInfo to remove the need for additional API calls.
dmItemHasOCRText
- dmItemHasOCRText
-
Signature Returns Example Note http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmItemHasOCRText/alias/pointer/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the id of the item to check for OCR text
- format can be xml or json or function. When calling the method directly through the URL, xml or json should be used. When calling the method from another function within the API (as done in dmGetItemInfo), function should be used.
An array with a single item, hasOCR, with a value of 1 (has OCR text) or 0 (no OCR text).
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmItemHasOCRText/mycollection/7/json
returns:
Array([hasOCR] => 1)
This function is also called directly from dmGetItemInfo to remove the need for additional API calls.
dmQuery
- dmQuery
-
Signature Returns http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmQuery/alias/searchstrings/fields/sortby/
maxrecs/start/suppress/docptr/suggest/facets/showunpub/denormalizeFacets/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- If dmQuery is used with multiple collections the query parameters must follow the Dublin Core mapping rules and use the names from the Dublin Core map field in Field properties.
- alias is a single collection alias, a !-delimited list of collection aliases, or "all" for all collections.
- searchstrings is a four-part, ^-delimited group in the order field^string^mode^operator.
- Use "CISOSEARCHALL" for all fields; mode can be "all", "any", "exact", or "none"; operator can be "and" or "or".
- Multiple words in string need to be separated by "+".
- Up to six groups can be included, delimited by "!".
- To browse a collection, specify a single alias and "0" as a searchstrings value. The operator for the last searchstring will be ignored.
- fields is a !-delimited list of field nicknames, listing the fields for which metadata should be returned.
- A maximum of five fields may be specified. A maximum of 100 bytes is returned for each field.
- sortby is a !-delimited list of field nicknames, detailing how the result should be sorted, in field order.
- The field nicknames must appear in the field array. If the last element in the array is specified as "reverse".
- The sort will be in reverse (descending) order. Use "nosort" to sort the query by relevance.
- The field nicknames must appear in the field array. If the last element in the array is specified as "reverse".
- maxrecs is the maximum number of records to return, from 1 to 1024.
- start is the starting number of the first item returned in the result.
- suppress specifies whether to suppress compound object pages from the search. Use "1" to suppress or "0" to not suppress (i.e., include pages).
- docptr specifies the pointer value of a compound object to restrict the query just to the pages in that compound object. This requires that a single alias be specified. Use "0" if not specified.
- suggest specifies whether to return a spelling suggestion, if available for the searchstring's string. Use "1" to get suggestions or use "0" to not return a suggestion.
- facets is an optional !-delimited list of field nicknames to return as facets. Use "0" if not requesting facets.
- showunpub specifies whether to show or not show items from unpublished collections. Use "1" if requesting items from unpublished collections or "0" to hide items from unpublished collections.
- denormalizeFacets specifies whether to show capitalization and diacritics in facet fields that have shared Controlled Vocabulary. Use "1" if requesting capitalization and diacritics or "0" to turn off capitalization and diacritics.
- format is either "xml" or "json".
This function returns a list of records produced by the query, plus a pager that contains values for start, maxrecs, and total.
If facets is included, this function returns a list of facets on the indicated field(s).
If suggest is "1", the suggested spelling is returned.
If showunpub is "1", records from unpublished collections will be included.
If denormalizeFacets is "1", and facets is not "0", but instead a !-delimited list of field nicknames, then the requested facet fields will be shown with capitalization and diacritics.
dmQueryTotalRecs
- dmQueryTotalRecs
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmQueryTotalRecs/queries/format
- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- queries are ~-delimited and the parts of each query are |-delimited. The parts of each query are: alias|searchstring|return_fields|sort. See dmQuery for more detailed information.
- format is xml
The total number of records for each query.
http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?q=dmQueryTotalRecs/mycollection|subject^word^all^and|subjec!title|nosort~
mycollection|title^contentdm^all^and|subjec!title|nosort/xmlFor each query in queries, this function executes a query with a maximum limit of one record returned. It then pulls total records of the query from the pager info in the returned data.
GetItemDmmodified
- GetItemDmmodified
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=GetItemDmmodified/alias/pointer/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the pointer of the item whose last-modified date you want
- format is json
This function is not part of the standard CONTENTdm API. It is a subset of dmGetItemInfo, designed for efficient realtime retrieval of an item's last-modified date, so a full request to dmGetItemInfo can be issued if necessary.
The value of the dmmodified element for the requested item. If item is not found, returns the following error message:
-2
Requested item not foundhttp://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=GetItemDmmodified/uw/31/jsonreturns:
{"0":"2009-09-22"}
GetParent
- GetParent
-
Signature Returns Example http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=GetParent/alias/pointer/format- Replace yourCONTENTdmURL with your institution's CONTENTdm Website URL.
- alias is a collection alias
- pointer is the pointer of the item whose parent you want to get
- format is either xml or json
This function returns the pointer of the item that is the parent of the pointer in the URL signature. If no parent is found, this function returns "-1". http://yourCONTENTdmURL.com/digital/bl/dmwebservices/index.php?
q=GetParent/ukr/83062/xmlreturns:
< parent>83090</parent>