Last active
February 9, 2017 20:29
-
-
Save djpillen/ec6686dc47bd1c3c7d65d8d024a6f4d4 to your computer and use it in GitHub Desktop.
API endpoint to get the Archival Object IDs associated with an ArchivesSpace Resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to a plugin's backend/controllers directory | |
class ArchivesSpaceService < Sinatra::Base | |
Endpoint.get('/repositories/:repo_id/resources/:id/archival_object_ids') | |
.description("Get a list of archival objects IDs associated with a resource") | |
.params(["id", :id], | |
["repo_id", :repo_id]) | |
.permissions([:view_repository]) | |
.returns([200, "OK"]) \ | |
do | |
resource = Resource.get_or_die(params[:id]) | |
graph = resource.object_graph.ids_for(ArchivalObject) | |
json_response(graph) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment