# HG changeset patch # User Sebastien Jodogne # Date 1411114670 -7200 # Node ID a921e3b5e7630bd34307a94536c04b4d80904201 # Parent 0561f2087cc90bcd2e4f031ec21f3f15376c8777 bulk tags retrieval diff -r 0561f2087cc9 -r a921e3b5e763 NEWS --- a/NEWS Thu Sep 18 17:48:55 2014 +0200 +++ b/NEWS Fri Sep 19 10:17:50 2014 +0200 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* "/instances-tags" to get the tags of all the child instances of a + patient/study/series with a single REST call (bulk tags retrieval) * Configuration/Lua to select the accepted C-Store SCP transfer syntaxes * Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities * Installation of plugin SDK in CMake diff -r 0561f2087cc9 -r a921e3b5e763 OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Thu Sep 18 17:48:55 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Fri Sep 19 10:17:50 2014 +0200 @@ -876,6 +876,42 @@ } + static void GetChildInstancesTags(RestApiGetCall& call) + { + ServerContext& context = OrthancRestApi::GetContext(call); + std::string publicId = call.GetUriComponent("id", ""); + bool simplify = call.HasArgument("simplify"); + + // Retrieve all the instances of this patient/study/series + typedef std::list Instances; + Instances instances; + + context.GetIndex().GetChildInstances(instances, publicId); // (*) + + Json::Value result = Json::arrayValue; + + for (Instances::const_iterator it = instances.begin(); + it != instances.end(); it++) + { + Json::Value full; + context.ReadJson(full, *it); + + if (simplify) + { + Json::Value simplified; + SimplifyTags(simplified, full); + result.append(simplified); + } + else + { + result.append(full); + } + } + + call.GetOutput().AnswerJson(result); + } + + void OrthancRestApi::RegisterResources() { @@ -954,6 +990,10 @@ Register("/studies/{id}/instances", GetChildResources); Register("/series/{id}/instances", GetChildResources); + Register("/patients/{id}/instances-tags", GetChildInstancesTags); + Register("/studies/{id}/instances-tags", GetChildInstancesTags); + Register("/series/{id}/instances-tags", GetChildInstancesTags); + Register("/instances/{id}/content/*", GetRawContent); } }