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 APIs
Request and response APIs 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:
Versions
The difference between version 1 and version 2 is in the response. Most calls are the same but version 2 has a couple additions as well.
Version 1:
Developed to allow access to content in LUNA which could then be used to power various widgets and other externally generated tools
Base path http://www.example.com/luna/servlet/as/fetchMediaSearch
Version 2:
Created to allow for more robust interface development and a base for the future LUNA interfaces
Base path http://www.example.com/luna/servlet/as/search
Available in 7.4+
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 |
excludeMetadata* | if =1, then it won't return field values |
|
showAll* | Returns all facet values for who, what, where or when | showAll=who |
*=Version 2 Only
**=Not used in Version 2
Results Structure
Version 1
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: Version 1 response format
{
"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."
}
]
}
IIIF URLs
As of version 7.3.1 you can include IIIF URL's in the response.
Version 2
Metadata:
At the beginning of the response and contains basic information about the request including:
totalResults: total # of results collections searched, info about the collections. A textual description of the search, and the offset.
iiifCollection: A iiif collection URI that gives you access to the results in iiif structure
collections: Contains the following information of the collection selected and in context.
collection ID
name
description
session: Contains various session information
availableCollections: contains the collection ID and the name of the collection for each item listed
loggedIn: true or false
resolutionSize: The current thumbnail resolution size
institutionName: The institution name that is defined in the LUNA instance. This is used to identify the Institution who is hosting the various collections.
Results:
results: An array that contains one object for each result.
displayName: The Title field value as chosen in the collection manager of LUNA
description: Not currently in use
mediaType: The type of media such as Image, Audio, Video or Miscellaneous
id: The LUNA ID for the item
fieldValues: Field and value pairs for all the descriptive metadata
urlSize0: size 0 image URL
urlSize1: size 1 image URL
urlSize2: size 2 image URL
urlSize3: size 3 image URL
urlSize4: size 4 image URL
iiifManifest: iiif manifest URI for this item
relatedFieldValues: contains the field and value need for a search of related items
Facets
When: Top 5 facet values with the count of items for When
What: Top 5 facet values with the count of items for What
Where: Top 5 facet values with the count of items for Where
Who: Top 5 facet values with the count of items for Who
https://www.davidrumsey.com/luna/servlet/as/search?os=0&bs=1&q=ohio
Click below to see the JSON result example: Version 2 response format
{
"totalResults":"2373",
"iiifCollection":"https://www.davidrumsey.com/luna/servlet/iiif/collection/s/h5uci2",
"collections":[
{
"RUMSEY~8~1":{
"name":"David Rumsey Historical Map Collection",
"description":"The David Rumsey Historical Map Collection focuses on 18th and 19th century North and South American cartographic materials. The collection includes atlases, globes, school geographies, maritime charts, and a variety of separate maps including pocket, wall, children's and manuscript maps. The online selection is an expanding cross section of images designed to highlight the depth and breadth of the collection. The digital images and associated descriptive data are © Cartography Associates."
}
}
],
"session":{
"availableCollections":[
{
"RUMSEY~8~1":"David Rumsey Historical Map Collection"
}
],
"loggedIn":false,
"resolutionSize":1
},
"institutionName":"Luna",
"results":[
{
"displayName":"Map and Cover: See the Wonderful World of Ohio. See Ohio by Auto. Ohio Department of Highways.",
"description":"",
"urlSize4":"http://www.davidrumsey.com/rumsey/Size4/RUMSEY~8~1/153/8875001.jpg",
"mediaType":"Image",
"id":"RUMSEY~8~1~272143~90045946",
"fieldValues":[
{
"Type":[
"Covers",
"Separate Map"
]
},
{
"State/Province":[
"Ohio"
]
},
{
"Pub Title":[
"See the Wonderful World of Ohio. See Ohio by Auto. Ohio Department of Highways."
]
},
{
"Short Title":[
"Map and Cover: See the Wonderful World of Ohio. See Ohio by Auto. Ohio Department of Highways."
]
},
{
"Pub Type":[
"Separate Map"
]
},
{
"Media item filename":[
"8875001.jp2"
]
},
{
"Publication Author":[
"Ohio Department of Highways"
]
},
{
"Page No":[
"cover side"
]
},
{
"Pub List No InitialSort":[
"8875.000_001"
]
},
{
"Obj Width cm":[
"84"
]
},
{
"Date":[
"1966"
]
},
{
"Series No":[
"1"
]
},
{
"Subject":[
"Pictorial map"
]
},
{
"Pub Note":[
"Double-sided. Color."
]
},
{
"Pub Width cm":[
"11"
]
},
{
"Author":[
"Ohio Department of Highways"
]
},
{
"Obj Height cm":[
"92"
]
},
{
"Image Order":[
"000 batch016"
]
},
{
"Publisher":[
"Ohio Department of Highways"
]
},
{
"Download 2":[
"<a href=http://www.lizardtech.com/downloads/category/#viewers target=_blank >GeoViewer for JP2 and SID files<\/a>"
]
},
{
"Pub Date":[
"1966"
]
},
{
"Pub Height cm":[
"24"
]
},
{
"Authors":[
"Ohio Department of Highways"
]
},
{
"List No":[
"8875.001"
]
},
{
"Image No":[
"8875001.jp2"
]
},
{
"Publisher Location":[
"Cleveland"
]
},
{
"Download 1":[
"<a href=http://www.davidrumsey.com/rumsey/download.pl?image=/153/8875001.jp2 target=_blank>Full Image Download in JP2 Format<\/a>"
]
},
{
"Full Title":[
"(Map including Cover to) See the Wonderful World of Ohio. See Ohio by Auto. Ohio Department of Highways."
]
},
{
"Pub List No":[
"8875.000"
]
},
{
"Pub Maps":[
"1"
]
},
{
"Processed Date":[
null
]
},
{
"Processed Date (epoch)":[
"2017-05-13T10:03:50Z"
]
},
{
"CanonicalServerAddress":[
null
]
}
],
"urlSize2":"http://www.davidrumsey.com/rumsey/Size2/RUMSEY~8~1/153/8875001.jpg",
"urlSize3":"http://www.davidrumsey.com/rumsey/Size3/RUMSEY~8~1/153/8875001.jpg",
"iiifManifest":"https://www.davidrumsey.com/luna/servlet/iiif/m/RUMSEY~8~1~272143~90045946/manifest",
"urlSize0":"http://www.davidrumsey.com/rumsey/Size0/RUMSEY~8~1/153/8875001.jpg",
"urlSize1":"http://www.davidrumsey.com/rumsey/Size1/RUMSEY~8~1/153/8875001.jpg",
"relatedFieldValues":[
{
"pub_list_no":[
"8875.000"
]
}
]
}
],
"facets":{
"When":[
{
"1877":296
},
{
"1874":194
},
{
"1876":193
},
{
"1892":138
},
{
"1899":132
}
],
"What":[
{
"County Atlas":1174
},
{
"Atlas Map":1129
},
{
"Property Ownership":682
},
{
"View":438
},
{
"Text Page":354
}
],
"Where":[
{
"Ohio":494
},
{
"Pennsylvania":198
},
{
"United States":154
},
{
"Beaver County (Pa.)":106
},
{
"Kentucky":103
}
],
"Who":[
{
"Caldwell, Joseph A.":335
},
{
"J.A. Caldwell":335
},
{
"Rand McNally and Company":306
},
{
"Howden, J.A.":255
},
{
"Cring, Henry":229
}
]
}
}
Related Item Counts
There is a special API call to get the related item count from an individual record. This allow you to display how many related items exist for that item. This uses Related item field defined in the Collection Manager
fetchRelatedItemFacets
Returns
count: number of related items
value: the related item term
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>
<totalResults>2</totalResults>
</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 |
Creating or Updating records will trim leading and trailing whitespect characters from values
/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 |