comparison OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp @ 5310:b5c502bcaf99

added a route to DELETE /jobs/../archive
author Alain Mazy <am@osimis.io>
date Mon, 12 Jun 2023 18:42:06 +0200
parents f22c8fac764b
children fbe857e942cd
comparison
equal deleted inserted replaced
5309:fb231da5c0f1 5310:b5c502bcaf99
768 "Job has no such output: " + key); 768 "Job has no such output: " + key);
769 } 769 }
770 } 770 }
771 771
772 772
773 static void DeleteJobOutput(RestApiDeleteCall& call)
774 {
775 if (call.IsDocumentation())
776 {
777 call.GetDocumentation()
778 .SetTag("Jobs")
779 .SetSummary("Delete a job output")
780 .SetDescription("Delete the output produced by a job. As of Orthanc 1.12.1, only the jobs that generate a "
781 "DICOMDIR media or a ZIP archive provide such an output (with `key` equals to `archive`).")
782 .SetUriArgument("id", "Identifier of the job of interest")
783 .SetUriArgument("key", "Name of the output of interest");
784 return;
785 }
786
787 std::string job = call.GetUriComponent("id", "");
788 std::string key = call.GetUriComponent("key", "");
789
790 if (OrthancRestApi::GetContext(call).GetJobsEngine().
791 GetRegistry().DeleteJobOutput(job, key))
792 {
793 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
794 }
795 else
796 {
797 throw OrthancException(ErrorCode_InexistentItem,
798 "Job has no such output: " + key);
799 }
800 }
801
802
773 enum JobAction 803 enum JobAction
774 { 804 {
775 JobAction_Cancel, 805 JobAction_Cancel,
776 JobAction_Pause, 806 JobAction_Pause,
777 JobAction_Resubmit, 807 JobAction_Resubmit,
1111 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>); 1141 Register("/jobs/{id}/cancel", ApplyJobAction<JobAction_Cancel>);
1112 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>); 1142 Register("/jobs/{id}/pause", ApplyJobAction<JobAction_Pause>);
1113 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>); 1143 Register("/jobs/{id}/resubmit", ApplyJobAction<JobAction_Resubmit>);
1114 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>); 1144 Register("/jobs/{id}/resume", ApplyJobAction<JobAction_Resume>);
1115 Register("/jobs/{id}/{key}", GetJobOutput); 1145 Register("/jobs/{id}/{key}", GetJobOutput);
1146 Register("/jobs/{id}/{key}", DeleteJobOutput);
1116 1147
1117 // New in Orthanc 1.9.0 1148 // New in Orthanc 1.9.0
1118 Register("/tools/accepted-transfer-syntaxes", GetAcceptedTransferSyntaxes); 1149 Register("/tools/accepted-transfer-syntaxes", GetAcceptedTransferSyntaxes);
1119 Register("/tools/accepted-transfer-syntaxes", SetAcceptedTransferSyntaxes); 1150 Register("/tools/accepted-transfer-syntaxes", SetAcceptedTransferSyntaxes);
1120 Register("/tools/unknown-sop-class-accepted", GetUnknownSopClassAccepted); 1151 Register("/tools/unknown-sop-class-accepted", GetUnknownSopClassAccepted);