comparison OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 2726:46061a91c88a jobs

new metadata (RemoteIP, CalledAET, HttpUsername), "?expand" metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Jul 2018 18:01:16 +0200
parents b71c59312bae
children d4e81e0a8324
comparison
equal deleted inserted replaced
2725:7caf01aa4d7b 2726:46061a91c88a
671 671
672 std::string publicId = call.GetUriComponent("id", ""); 672 std::string publicId = call.GetUriComponent("id", "");
673 std::list<MetadataType> metadata; 673 std::list<MetadataType> metadata;
674 674
675 OrthancRestApi::GetIndex(call).ListAvailableMetadata(metadata, publicId); 675 OrthancRestApi::GetIndex(call).ListAvailableMetadata(metadata, publicId);
676 Json::Value result = Json::arrayValue; 676
677 677 Json::Value result;
678 for (std::list<MetadataType>::const_iterator 678
679 it = metadata.begin(); it != metadata.end(); ++it) 679 if (call.HasArgument("expand"))
680 { 680 {
681 result.append(EnumerationToString(*it)); 681 result = Json::objectValue;
682
683 for (std::list<MetadataType>::const_iterator
684 it = metadata.begin(); it != metadata.end(); ++it)
685 {
686 std::string value;
687 if (OrthancRestApi::GetIndex(call).LookupMetadata(value, publicId, *it))
688 {
689 std::string key = EnumerationToString(*it);
690 result[key] = value;
691 }
692 }
693 }
694 else
695 {
696 result = Json::arrayValue;
697
698 for (std::list<MetadataType>::const_iterator
699 it = metadata.begin(); it != metadata.end(); ++it)
700 {
701 result.append(EnumerationToString(*it));
702 }
682 } 703 }
683 704
684 call.GetOutput().AnswerJson(result); 705 call.GetOutput().AnswerJson(result);
685 } 706 }
686 707