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:

    • identity - the LUNA ID

    • mediaType - IMAGE, etc

    • urlSize0 - size 0 image URL

    • urlSize1 - size 1 image URL

    • urlSize2 - size 2 image URL

Additional values when fullData=true

    • displayName - the "title" field as mapped in the LAS

    • summary field values (the data shown in a mouse-over on a LUNA result set)

    • preview field values (the thumbnail labels)

    • urlSize3 - size 3 image URL

    • urlSize4 - size 4 image URL