Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 2976:cb5d75143da0
Asynchronous generation of ZIP archives and DICOM medias
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Dec 2018 12:23:46 +0100 |
parents | 4767d36679ed |
children | 4e43e67f8ecf |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp Thu Dec 06 10:10:58 2018 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp Thu Dec 06 12:23:46 2018 +0100 @@ -325,6 +325,27 @@ } + static void GetJobOutput(RestApiGetCall& call) + { + std::string job = call.GetUriComponent("id", ""); + std::string key = call.GetUriComponent("key", ""); + + std::string value; + MimeType mime; + + if (OrthancRestApi::GetContext(call).GetJobsEngine(). + GetRegistry().GetJobOutput(value, mime, job, key)) + { + call.GetOutput().AnswerBuffer(value, mime); + } + else + { + throw OrthancException(ErrorCode_InexistentItem, + "Job has no such output: " + key); + } + } + + enum JobAction { JobAction_Cancel, @@ -392,5 +413,6 @@ Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>); Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>); Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>); + Register("/jobs/{id}/{key}", GetJobOutput); } }