LUNA API Documentation

LUNA API Documentation

There are two API's available:

LUNA Viewer API provides you with a convenient way to incorporate images from the LUNA Viewer into other web resources, like a website, wiki, blog, etc.

Record Data API allows for read, add, update and delete the record data contained within the LUNA Library.

On this page:

LUNA Viewer API

A JavaScript request and response API used to deliver search results from the LUNA Viewer. 

Let’s say you have an exhibition you’d like to highlight on your website and the images reside in the LUNA Viewer, you can select this subset of images from the LUNA Viewer and promote them on your site.  When a user clicks on one of the images they are taken to the LUNA Viewer. This LUNA Viewer API is a great way to bring your users into LUNA via your other web resources, primarily for images but will also support data. Example from the David Rumsey Historical Map Collection:

 Searching

Example URL

 

Parameter

Description

Example

q

The query to run.  Specifying no query is the same as "view all." Query syntax is the same as is used by LUNA.  For fielded search, use the advanced search as a template.

q=test

or

q=Pub_Title=ohio

lc

Limit by collection. Luna collection IDs (Institution ID + "~" + Collection ID + "~" + Unique Collection ID), separated by comma.

lc=RUMSEY~8~1

or

lc=RUMSEY~8~1,LUNA~1~1

sort

Up to 4 Luna fields separated by comma. 

sort=Pub_List_No_InitialSort,

Pub_Date,Pub_List_No,

Series_No

mgid

Media Group ID -- use this to specify the ID # for a group

mgid=25

random

Whether to randomly sort the resultset.

true -- completely randomizes the order of the result set

false (default) -- uses the specified sort

random=true

os

Offset in result set. Used for paging.  Default is 0.

os=25

bs

Batch Size (# of results to return). Default is 10.

bs=25

callback

Javascript callback.  When the JSON data is returned, pass the data to the following function.

callback=myFunction

<script>

function myFunction(nodes)

{

var lst = nodes['data'];

if (lst == undefined) lst = nodes;

for (var i=0;i < lst.length;i++)

{

   ...

   }

}

mid

Getting data for a specific record.  Sometimes you just want data for one record without doing a search for it.  Use the LUNA ID for the record (everything after /detail/).

mid=RUMSEY~8~1~520~60062

fullData

false by default.  Setting this to true will include more data from the LUNA server instead of just the thumbnail images.

 

This must be used with individual records or an offset < 5.

fullData=true

Results Structure

Metadata:

Note : this section is only included when the callback parameter is used.

The meta object is returned at the beginning of the response and contains basic information about the request including: total # of results, collections searched, info about the collections. A textual description of the search, and the offset.

Data:

The data array contains one object for each result. The values included are:

Additional values when fullData=true

 

Click below to see the JSON result example
{ "meta": { "totalNumberOfResults": "306", "collections": [ { "totalMediaCount": 21352, "type": "legacy", "name": "David Rumsey Collection", "id": "RUMSEY~8~1" } ], "searchDescription": "Search Results: Pub Title equal to 'Ohio'", "pageSize": "25", "offset": "0", "random": "false" }, "data": [ { "summaryFieldValues": "[{\\\"summaryDescriptionFieldSort\\\":1,\\\"value\\\":\\\"Hutchins, Thomas\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":1},{\\\"summaryDescriptionFieldSort\\\":2,\\\"value\\\":\\\"A New Map of the Western Parts of Virginia, Pennsylvania, Maryland and North Carolina, Comprehending the River Ohio, and all the Rivers, which fall into it, Part of the River Mississippi, the Whole of the Illinois River, Lake Erie, Part of the Lakes Huron, Michigan&c. And all the Country bordering on these Lakes and Rivers. By Thos. Hutchins, Captain in the 60 Regiment of Foot. London, Published according to Act of Parliament Novembr. ye 1st, 1778 by T. Hutchins ... Engrav'd by T. Cheevers.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":3,\\\"value\\\":\\\"T. Hutchins\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":4,\\\"value\\\":\\\"This map was published separately and at the same time as Hutchins'\\\\\\\"Topographical Description...\\\\\\\" and should accompany the book. Streeter calls it \\\\\\\"by far the best map of the west printed to that time.\\\\\\\" It was the first large scale map of the area west of the Allegheny Mountains based on personal observations, although Hutchins gives credit to Lewis Evans'\\\\\\\"Map of the Middle Colonies\\\\\\\" as the best prior source of information about the area. The map contains extensive printed notes which describe important aspects of the country depicted. This map ranks with the most important American maps issued in the 18th century and is now rare. Hutchins later became the first Geographer of the United States. With outline color. Map is dissected into 32 sections and mounted on linen. Folds into new green cloth folding boards and quarter leather green cloth slip case 24x16 with \\\\\\\"Hutchin's New Map Of Western Parts Of Virginia, Etc. 1778\\\\\\\" on the spine in gold.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0}]", "previewFieldValues": "[{\\\"summaryDescriptionFieldSort\\\":1,\\\"value\\\":\\\"Hutchins, Thomas\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":1},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"The Western Parts of Virginia, Pennsylvania, Maryland and North Carolina.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":2},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1778\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":3},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Case Map\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":4}]", "identity": "RUMSEY~8~1~281~30139", "urlSize0": "http://www.davidrumsey.com/rumsey/Size0/D0003/00030139.jpg?userid=5&username=rumsey-admin&resolution=0&servertype=JVA&cid=8&iid=RUMSEY&vcid=NA&usergroup=Rumsey-Admin&profileid=2", "fieldValues": "[{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"5044.000\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1778\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":3},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1,140,480\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1778\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":1,\\\"value\\\":\\\"Hutchins, Thomas\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":1},{\\\"summaryDescriptionFieldSort\\\":2,\\\"value\\\":\\\"A New Map of the Western Parts of Virginia, Pennsylvania, Maryland and North Carolina, Comprehending the River Ohio, and all the Rivers, which fall into it, Part of the River Mississippi, the Whole of the Illinois River, Lake Erie, Part of the Lakes Huron, Michigan&c. And all the Country bordering on these Lakes and Rivers. By Thos. Hutchins, Captain in the 60 Regiment of Foot. London, Published according to Act of Parliament Novembr. ye 1st, 1778 by T. Hutchins ... Engrav'd by T. Cheevers.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Streeter 1300, P-Maps 983, Ristow p 38-39, Smith, p 20-27, Brown 51.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":4,\\\"value\\\":\\\"This map was published separately and at the same time as Hutchins'\\\\\\\"Topographical Description...\\\\\\\" and should accompany the book. Streeter calls it \\\\\\\"by far the best map of the west printed to that time.\\\\\\\" It was the first large scale map of the area west of the Allegheny Mountains based on personal observations, although Hutchins gives credit to Lewis Evans'\\\\\\\"Map of the Middle Colonies\\\\\\\" as the best prior source of information about the area. The map contains extensive printed notes which describe important aspects of the country depicted. This map ranks with the most important American maps issued in the 18th century and is now rare. Hutchins later became the first Geographer of the United States. With outline color. Map is dissected into 32 sections and mounted on linen. Folds into new green cloth folding boards and quarter leather green cloth slip case 24x16 with \\\\\\\"Hutchin's New Map Of Western Parts Of Virginia, Etc. 1778\\\\\\\" on the spine in gold.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"91\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"112\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"U.S. Mid West\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Case Map\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":4},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"0000_5044.000_001\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"5044000\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Hutchins, Thomas\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1263855560464, 1263855560464, 1263855560464, 1263855560464, 1263855560464, 1263855560464, 1263855560464, 1263855560464\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"London\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Case Map\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Hutchins, Thomas\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"This map was published separately and at the same time as Hutchins'\\\\\\\"Topographical Description...\\\\\\\" and should accompany the book. Streeter calls it \\\\\\\"by far the best map of the west printed to that time.\\\\\\\" It was the first large scale map of the area west of the Allegheny Mountains based on personal observations, although Hutchins gives credit to Lewis Evans'\\\\\\\"Map of the Middle Colonies\\\\\\\" as the best prior source of information about the area. The map contains extensive printed notes which describe important aspects of the country depicted. This map ranks with the most important American maps issued in the 18th century and is now rare. Hutchins later became the first Geographer of the United States. With outline color. Map is dissected into 32 sections and mounted on linen. Folds into new green cloth folding boards and quarter leather green cloth slip case 24x16 with \\\\\\\"Hutchin's New Map Of Western Parts Of Virginia, Etc. 1778\\\\\\\" on the spine in gold.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"The Western Parts of Virginia, Pennsylvania, Maryland and North Carolina.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":2},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"1\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":3,\\\"value\\\":\\\"T. Hutchins\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"112\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"91\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Streeter 1300, P-Maps 983, Ristow p 38-39, Smith, p 20-27, Brown 51.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"Rumsey Collection\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"A New Map of the Western Parts of Virginia, Pennsylvania, Maryland and North Carolina, Comprehending the River Ohio, and all the Rivers, which fall into it, Part of the River Mississippi, the Whole of the Illinois River, Lake Erie, Part of the Lakes Huron, Michigan &c. And all the Country bordering on these Lakes and Rivers. By Thos. Hutchins, Captain in the 60 Regiment of Foot. London, Published according to Act of Parliament Novembr. ye 1st, 1778 by T. Hutchins ... Engrav'd by T. Cheevers.\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800, 18 Jan 2010 14:59:20 -0800\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0},{\\\"summaryDescriptionFieldSort\\\":0,\\\"value\\\":\\\"5044.000\\\",\\\"metaData\\\":false,\\\"previewFieldSort\\\":0}]", "misc": false, "docId": 0, "video": false, "urlSize2": "http://www.davidrumsey.com/rumsey/Size2/D0003/00032139.jpg?userid=5&username=rumsey-admin&resolution=2&servertype=JVA&cid=8&iid=RUMSEY&vcid=NA&usergroup=Rumsey-Admin&profileid=2", "id": "RUMSEY~8~1~281~30139", "attributes": "{\\\"empty\\\":false}", "urlSize1": "http://www.davidrumsey.com/rumsey/Size1/D0003/00031139.jpg?userid=5&username=rumsey-admin&resolution=1&servertype=JVA&cid=8&iid=RUMSEY&vcid=NA&usergroup=Rumsey-Admin&profileid=2", "audio": false, "description": "", "image": true, "mediaType": "IMAGE", "displayAttributeNames": "[\\\"displayTitle\\\"]", "displayName": "A New Map of the Western Parts of Virginia, Pennsylvania, Maryland and North Carolina, Comprehending the River Ohio, and all the Rivers, which fall into it, Part of the River Mississippi, the Whole of the Illinois River, Lake Erie, Part of the Lakes Huron, Michigan&c. And all the Country bordering on these Lakes and Rivers. By Thos. Hutchins, Captain in the 60 Regiment of Foot. London, Published according to Act of Parliament Novembr. ye 1st, 1778 by T. Hutchins ... Engrav'd by T. Cheevers." } ] }

Record Data API

Read, add, update and delete the record data contained within the LUNA Library.

This API uses OAuth to authenticate access to the LUNA Library. Once authorized the OAuth user can view, add, edit and delete Record data from the LUNA Library based on the privileges the OAuth user has been granted.

The LUNA Record Data API is about making the LUNA system sync with your external cataloging system, or data source. For example, if you are cataloging your records in Filemaker the Record Data API allows this data to sync with LUNA. So if you need to make edits to records you can continue to do so in Filemaker and these edits will also be updated in LUNA. Alternately if you want to edit records in LUNA the edits will also be updated in Filemaker.

Using OAuth with LUNA Library

What is OAuth?

We think Yahoo sums it up quite well. OAuth is an open, simple, and secure protocol that enables applications to authenticate users and interact with LUNA on their behalf. The end user's information is securely transferred without revealing the identity of the user. At Luna, we use OAuth to verify that an application trying to interact with the LUNA Library on your behalf is doing so only with the permissions you have granted it.

To learn more about OAuth 1.0, please visit:
http://oauth.net/core/1.0/

Getting Started

To get started, first obtain a key and shared consumer secret for the application by registering it with the LUNA Library (Change the domain name and port number for your server) :

http://www.example.com:8181/editor/e/developers/apps

On this page, you are presented with a list of applications currently registered under the username you are logged in as.

When you click on 'Create', you will be asked the following:
App Name - the name of the application that's going to be interacting with the LUNA Library.

Callback URL(optional) - the default URL to redirect an authorized user back to the application when a callback URL is not provided along with the original request.

App Description(optional) - A short description of this application

On the next page, two values will be generated:
Key - a unique identifier of this application registered with the LUNA Library

Token secret - a shared secret which the application will use to compute signatures.

Keep in mind that the application will have access to the same set of collections as the user account under which this application is registered.

Making OAuth Requests

The URLs for requesting tokens and authorization are as follows:

http:// + hostname + port_number + /editor/e/oauth/request_token
http:// + hostname + port_number + /editor/e/oauth/authorize
http:// + hostname + port_number + /editor/e/oauth/access_token

References:

Using the Record data API

/collections/{collectionId} (GET)

 

DESCRIPTION

Gets a list of “items” from the collection. An “item” can contain only media, only record, or both media and record if linked together. Use Get-Record request to retrieve full record data. Paging is possible with parameters.

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection

PARAMETERS

os The result offset. Server will return items starting from this number.


 

pgs The size of the results return. Default is 50.

METHOD

GET

ERROR

400 General Error

RETURNS

Sample XML response: (Click below to show)
<librarySearchResult>    <item>        <batchId>0</batchId>        <collectionId>1</collectionId>        <fileExt>jpg</fileExt>        <fileName>CMA_.1986.7det02.jpg</fileName>        <mediaId>19</mediaId>        <status>0</status>        <type>1</type>        <typeString>Image</typeString>      <url>http://myserver:8080/MediaManager/srvr?mediafile=/Size0/DIVAD~1~1/9/CMA_.1986.7det02.jpg</url>        <url>http://myserver:8080/MediaManager/srvr?mediafile=/Size1/DIVAD~1~1/9/CMA_.1986.7det02.jpg</url>        <url>http://myserver:8080/MediaManager/srvr?mediafile=/Size2/DIVAD~1~1/9/CMA_.1986.7det02.jpg</url>        <committed>true</committed>        <recordId/>        <starred>false</starred>    </item>    <item>        <batchId>0</batchId>        <collectionId>0</collectionId>        <mediaId>0</mediaId>        <status>1</status>        <type>0</type>        <committed>true</committed>        <recordId>2120</recordId>        <starred>false</starred>    </item> </librarySearchResult>


 

/collections/{collectionId} (POST)

Description

Uploads new record(s) to the specified collection.

URL Structure

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier of the collection

METHOD

POST

REQUEST BODY

(required)   The record(s) being uploaded in XML. The entire POST body will be treated as XML. Example:


 

   <recordList>

     <record>

       <field_name1>...</field_name1>

       <field_group_name1>

         <field_name2>...</field_name2>

       </field_group_name1>

     </record>

     ...

   </recordList>


 

ERROR

400 General error from processing uploaded records.

 

/collections/{collectionId}/records/{recordId}  (PUT)

 

DESCRIPTION

Update an existing record

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>/records/<Record ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection


 

Record ID   The unique identifier for the record

METHOD

PUT

REQUEST BODY

(required)   The record being updated in XML. Must contain exactly 1 record. The entire POST body will be treated as XML. Example:

 

   <recordList>

     <record>

       <field_name1>...</field_name1>

       <field_group_name1>

         <field_name2>...</field_name2>

       </field_group_name1>

     </record>

   </recordList>



ERROR

400   Invalid Record ID or content body contains more than 1 record


 

404 Unable to find record with the provided record ID

 

 /collections/{collectionId}/records/{recordId}  (DELETE)

 

DESCRIPTION

Delete an existing record

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>/records/<Record ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection


 

Record ID   The unique identifier for the record

METHOD

DELETE

ERROR

400 Invalid Record ID


 

404 Unable to find record with the provided record ID

/collections/{collectionId}/mappings/record/{recordId}/media/{mediaId} (POST)

DESCRIPTION

Create a mapping between a record and a media

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>/mappings/record/<Record ID>/media/<Media ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection


 

Record ID   The unique identifier for the record


 

Media ID   The unique identifier for the media

METHOD

POST

ERROR

400 Invalid Record ID or Media ID


 

404 No record found with the given Record ID

 

 

/collections/{collectionId}/mappings/record/{recordId}/media/{mediaId} (PUT)

 

DESCRIPTION

Update existing mappings with the record. Any existing media currently linked to the record will be unlinked and replaced by this mapping.

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>/mappings/record/<Record ID>/media/<Media ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection


 

Record ID   The unique identifier for the record


 

Media ID   The unique identifier for the media

METHOD

PUT

ERROR

400 Invalid Record ID or Media ID


 

404 No record found with the given Record ID

/collections/{collectionId}/mappings/record/{recordId}/media/{mediaId} (DELETE)

 

DESCRIPTION

Remove this mapping from the record. Other media that is linked to the record will be left untouched.

URL STRUCTURE

http://<LUNA Library Base URL>/editor/e/api/collections/<Collection ID>/mappings/record/<Record ID>/media/<Media ID>


 

LUNA Library Base URL   The server address and port number to the Luna installation


 

Collection ID The unique identifier for the collection


 

Record ID   The unique identifier for the record


 

Media ID   The unique identifier for the media

METHOD