# HG changeset patch # User Sebastien Jodogne # Date 1428067504 -7200 # Node ID 9ec7ac03152d6d12ff71deffe74db59daf2dc3c8 # Parent 479e31b13de529f1f9cbd0b37cef4183a9c1815e "?expand" flag for URIs "/patients", "/studies" and "/series" diff -r 479e31b13de5 -r 9ec7ac03152d NEWS --- a/NEWS Fri Apr 03 13:53:08 2015 +0200 +++ b/NEWS Fri Apr 03 15:25:04 2015 +0200 @@ -1,6 +1,7 @@ Pending changes in the mainline =============================== +* "?expand" flag for URIs "/patients", "/studies" and "/series" * Support of FreeBSD * Prevent freeze on C-FIND if no DICOM tag is to be returned * Allow replacing PatientID/StudyInstanceUID/SeriesInstanceUID from Lua scripts diff -r 479e31b13de5 -r 9ec7ac03152d OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Fri Apr 03 13:53:08 2015 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Fri Apr 03 15:25:04 2015 +0200 @@ -45,9 +45,29 @@ template static void ListResources(RestApiGetCall& call) { + ServerIndex& index = OrthancRestApi::GetIndex(call); + Json::Value result; - OrthancRestApi::GetIndex(call).GetAllUuids(result, resourceType); - call.GetOutput().AnswerJson(result); + index.GetAllUuids(result, resourceType); + + if (call.HasArgument("expand")) + { + Json::Value expanded = Json::arrayValue; + for (Json::Value::ArrayIndex i = 0; i < result.size(); i++) + { + Json::Value item; + if (index.LookupResource(item, result[i].asString(), resourceType)) + { + expanded.append(item); + } + } + + call.GetOutput().AnswerJson(expanded); + } + else + { + call.GetOutput().AnswerJson(result); + } } template