comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4473:68f52897c119

new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 Jan 2021 14:48:10 +0100
parents 6831de40acd9
children 1f455b86b054
comparison
equal deleted inserted replaced
4472:28a4baadde17 4473:68f52897c119
319 319
320 ServerContext& context = OrthancRestApi::GetContext(call); 320 ServerContext& context = OrthancRestApi::GetContext(call);
321 321
322 std::string publicId = call.GetUriComponent("id", ""); 322 std::string publicId = call.GetUriComponent("id", "");
323 323
324 std::string body; 324 context.GetIndex().SetProtectedPatient(publicId, call.ParseBooleanBody());
325 call.BodyToString(body); 325 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
326 body = Toolbox::StripSpaces(body);
327
328 if (body == "0")
329 {
330 context.GetIndex().SetProtectedPatient(publicId, false);
331 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
332 }
333 else if (body == "1")
334 {
335 context.GetIndex().SetProtectedPatient(publicId, true);
336 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
337 }
338 else
339 {
340 // Bad request
341 }
342 } 326 }
343 327
344 328
345 // Get information about a single instance ---------------------------------- 329 // Get information about a single instance ----------------------------------
346 330
1037 1021
1038 smooth = false; 1022 smooth = false;
1039 1023
1040 if (call.HasArgument(ARG_SMOOTH)) 1024 if (call.HasArgument(ARG_SMOOTH))
1041 { 1025 {
1042 std::string value = call.GetArgument(ARG_SMOOTH, ""); 1026 smooth = RestApiCall::ParseBoolean(call.GetArgument(ARG_SMOOTH, ""));
1043 if (value == "0" ||
1044 value == "false")
1045 {
1046 smooth = false;
1047 }
1048 else if (value == "1" ||
1049 value == "true")
1050 {
1051 smooth = true;
1052 }
1053 else
1054 {
1055 throw OrthancException(ErrorCode_ParameterOutOfRange,
1056 "Argument must be Boolean: " + std::string(ARG_SMOOTH));
1057 }
1058 } 1027 }
1059 } 1028 }
1060 1029
1061 1030
1062 public: 1031 public: