comparison OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4462:da460bef88f8

"/modalities/{...}/query": New string argument "LocalAet"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jan 2021 17:02:10 +0100
parents 6831de40acd9
children 522e13a60cfc
comparison
equal deleted inserted replaced
4461:22abc6851191 4462:da460bef88f8
668 .SetRequestField(KEY_LEVEL, RestApiCallDocumentation::Type_String, 668 .SetRequestField(KEY_LEVEL, RestApiCallDocumentation::Type_String,
669 "Level of the query (`Patient`, `Study`, `Series` or `Instance`)", true) 669 "Level of the query (`Patient`, `Study`, `Series` or `Instance`)", true)
670 .SetRequestField(KEY_NORMALIZE, RestApiCallDocumentation::Type_Boolean, 670 .SetRequestField(KEY_NORMALIZE, RestApiCallDocumentation::Type_Boolean,
671 "Whether to normalize the query, i.e. whether to wipe out from the query, the DICOM tags " 671 "Whether to normalize the query, i.e. whether to wipe out from the query, the DICOM tags "
672 "that are not applicable for the query-retrieve level of interest", false) 672 "that are not applicable for the query-retrieve level of interest", false)
673 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
674 "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false)
673 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject, 675 .SetAnswerField("ID", RestApiCallDocumentation::Type_JsonObject,
674 "Identifier of the query, to be used with `/queries/{id}`") 676 "Identifier of the query, to be used with `/queries/{id}`")
675 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject, 677 .SetAnswerField("Path", RestApiCallDocumentation::Type_JsonObject,
676 "Root path to the query in the REST API"); 678 "Root path to the query in the REST API");
677 return; 679 return;
700 else if (request.isMember(KEY_QUERY) && 702 else if (request.isMember(KEY_QUERY) &&
701 request[KEY_QUERY].type() != Json::objectValue) 703 request[KEY_QUERY].type() != Json::objectValue)
702 { 704 {
703 throw OrthancException(ErrorCode_BadFileFormat, 705 throw OrthancException(ErrorCode_BadFileFormat,
704 "The field " + std::string(KEY_QUERY) + " must contain a JSON object"); 706 "The field " + std::string(KEY_QUERY) + " must contain a JSON object");
707 }
708 else if (request.isMember(KEY_LOCAL_AET) &&
709 request[KEY_LOCAL_AET].type() != Json::stringValue)
710 {
711 throw OrthancException(ErrorCode_BadFileFormat,
712 "The field " + std::string(KEY_LOCAL_AET) + " must contain a string");
705 } 713 }
706 else 714 else
707 { 715 {
708 std::unique_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context)); 716 std::unique_ptr<QueryRetrieveHandler> handler(new QueryRetrieveHandler(context));
709 717
723 } 731 }
724 732
725 if (request.isMember(KEY_NORMALIZE)) 733 if (request.isMember(KEY_NORMALIZE))
726 { 734 {
727 handler->SetFindNormalized(request[KEY_NORMALIZE].asBool()); 735 handler->SetFindNormalized(request[KEY_NORMALIZE].asBool());
736 }
737
738 if (request.isMember(KEY_LOCAL_AET))
739 {
740 handler->SetLocalAet(request[KEY_LOCAL_AET].asString());
728 } 741 }
729 742
730 AnswerQueryHandler(call, handler); 743 AnswerQueryHandler(call, handler);
731 } 744 }
732 } 745 }