# HG changeset patch # User Alain Mazy # Date 1738768465 -3600 # Node ID 3d8d227dd96fc55da23abbe034508360a05e480a # Parent 6ee625ebd09c10564abefd55907d6892dd36724c return 404 instead of [] when calling e.g. /patients/not-a-patient-id/instances diff -r 6ee625ebd09c -r 3d8d227dd96f OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed Feb 05 16:09:39 2025 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed Feb 05 16:14:25 2025 +0100 @@ -3615,6 +3615,14 @@ Json::Value answer; finder.Execute(answer, OrthancRestApi::GetContext(call), format, false /* no "Metadata" field */); + + // Given the data model, if there are no children, it means there is no parent. + // https://discourse.orthanc-server.org/t/patients-id-instances-quirk/5498 + if (answer.size() == 0) + { + throw OrthancException(ErrorCode_UnknownResource); + } + call.GetOutput().AnswerJson(answer); }