comparison OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp @ 4422:48303e493135

cont openapi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Dec 2020 16:05:07 +0100
parents a7d72378e1cb
children 2a69b58ff3ac
comparison
equal deleted inserted replaced
4421:a7d72378e1cb 4422:48303e493135
965 if (call.IsDocumentation()) 965 if (call.IsDocumentation())
966 { 966 {
967 DocumentRetrieveShared(call); 967 DocumentRetrieveShared(call);
968 call.GetDocumentation() 968 call.GetDocumentation()
969 .SetSummary("Retrieve one answer") 969 .SetSummary("Retrieve one answer")
970 .SetDescription("Start a C-MOVE command as a job, in order to retrieve one answer associated with the " 970 .SetDescription("Start a C-MOVE SCU command as a job, in order to retrieve one answer associated with the "
971 "query/retrieve operation whose identifiers are provided in the URL: " 971 "query/retrieve operation whose identifiers are provided in the URL: "
972 "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move") 972 "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move")
973 .SetUriArgument("index", "Index of the answer"); 973 .SetUriArgument("index", "Index of the answer");
974 return; 974 return;
975 } 975 }
984 if (call.IsDocumentation()) 984 if (call.IsDocumentation())
985 { 985 {
986 DocumentRetrieveShared(call); 986 DocumentRetrieveShared(call);
987 call.GetDocumentation() 987 call.GetDocumentation()
988 .SetSummary("Retrieve all answers") 988 .SetSummary("Retrieve all answers")
989 .SetDescription("Start a C-MOVE command as a job, in order to retrieve all the answers associated with the " 989 .SetDescription("Start a C-MOVE SCU command as a job, in order to retrieve all the answers associated with the "
990 "query/retrieve operation whose identifier is provided in the URL: " 990 "query/retrieve operation whose identifier is provided in the URL: "
991 "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move"); 991 "https://book.orthanc-server.com/users/rest.html#performing-retrieve-c-move");
992 return; 992 return;
993 } 993 }
994 994
1363 } 1363 }
1364 1364
1365 1365
1366 static void DicomStore(RestApiPostCall& call) 1366 static void DicomStore(RestApiPostCall& call)
1367 { 1367 {
1368 static const char* KEY_MOVE_ORIGINATOR_AET = "MoveOriginatorAet";
1369 static const char* KEY_MOVE_ORIGINATOR_ID = "MoveOriginatorID";
1370 static const char* KEY_STORAGE_COMMITMENT = "StorageCommitment";
1371
1372 if (call.IsDocumentation())
1373 {
1374 OrthancRestApi::DocumentSubmitCommandsJob(call);
1375 call.GetDocumentation()
1376 .SetTag("Networking")
1377 .SetSummary("Trigger C-STORE SCU")
1378 .SetDescription("Start a C-STORE SCU command as a job, in order to send DICOM resources stored locally "
1379 "to some remote DICOM modality whose identifier is provided in the URL: "
1380 "https://book.orthanc-server.com/users/rest.html#rest-store-scu")
1381 .SetRequestField(KEY_RESOURCES, RestApiCallDocumentation::Type_JsonListOfStrings,
1382 "List of the Orthanc identifiers of all the DICOM resources to be sent", true)
1383 .SetRequestField(KEY_LOCAL_AET, RestApiCallDocumentation::Type_String,
1384 "Local AET that is used for this commands, defaults to `DicomAet` configuration option", false)
1385 .SetRequestField(KEY_MOVE_ORIGINATOR_AET, RestApiCallDocumentation::Type_String,
1386 "Move originator AET that is used for this commands, in order to fake a C-MOVE SCU", false)
1387 .SetRequestField(KEY_MOVE_ORIGINATOR_ID, RestApiCallDocumentation::Type_Number,
1388 "Move originator ID that is used for this commands, in order to fake a C-MOVE SCU", false)
1389 .SetRequestField(KEY_STORAGE_COMMITMENT, RestApiCallDocumentation::Type_Boolean,
1390 "Whether to use DICOM storage commitment to validate the success of the C-STORE: "
1391 "https://book.orthanc-server.com/users/storage-commitment.html", false)
1392 .SetRequestField(KEY_TIMEOUT, RestApiCallDocumentation::Type_Number,
1393 "Timeout for the C-STORE command, in seconds", false)
1394 .SetUriArgument("id", "Identifier of the modality of interest");
1395 return;
1396 }
1397
1368 ServerContext& context = OrthancRestApi::GetContext(call); 1398 ServerContext& context = OrthancRestApi::GetContext(call);
1369 1399
1370 std::string remote = call.GetUriComponent("id", ""); 1400 std::string remote = call.GetUriComponent("id", "");
1371 1401
1372 Json::Value request; 1402 Json::Value request;
1375 GetInstancesToExport(request, *job, remote, call); 1405 GetInstancesToExport(request, *job, remote, call);
1376 1406
1377 std::string localAet = Toolbox::GetJsonStringField 1407 std::string localAet = Toolbox::GetJsonStringField
1378 (request, KEY_LOCAL_AET, context.GetDefaultLocalApplicationEntityTitle()); 1408 (request, KEY_LOCAL_AET, context.GetDefaultLocalApplicationEntityTitle());
1379 std::string moveOriginatorAET = Toolbox::GetJsonStringField 1409 std::string moveOriginatorAET = Toolbox::GetJsonStringField
1380 (request, "MoveOriginatorAet", context.GetDefaultLocalApplicationEntityTitle()); 1410 (request, KEY_MOVE_ORIGINATOR_AET, context.GetDefaultLocalApplicationEntityTitle());
1381 int moveOriginatorID = Toolbox::GetJsonIntegerField 1411 int moveOriginatorID = Toolbox::GetJsonIntegerField
1382 (request, "MoveOriginatorID", 0 /* By default, not a C-MOVE */); 1412 (request, KEY_MOVE_ORIGINATOR_ID, 0 /* By default, not a C-MOVE */);
1383 1413
1384 job->SetLocalAet(localAet); 1414 job->SetLocalAet(localAet);
1385 job->SetRemoteModality(MyGetModalityUsingSymbolicName(remote)); 1415 job->SetRemoteModality(MyGetModalityUsingSymbolicName(remote));
1386 1416
1387 if (moveOriginatorID != 0) 1417 if (moveOriginatorID != 0)
1388 { 1418 {
1389 job->SetMoveOriginator(moveOriginatorAET, moveOriginatorID); 1419 job->SetMoveOriginator(moveOriginatorAET, moveOriginatorID);
1390 } 1420 }
1391 1421
1392 // New in Orthanc 1.6.0 1422 // New in Orthanc 1.6.0
1393 if (Toolbox::GetJsonBooleanField(request, "StorageCommitment", false)) 1423 if (Toolbox::GetJsonBooleanField(request, KEY_STORAGE_COMMITMENT, false))
1394 { 1424 {
1395 job->EnableStorageCommitment(true); 1425 job->EnableStorageCommitment(true);
1396 } 1426 }
1397 1427
1398 // New in Orthanc 1.7.0 1428 // New in Orthanc 1.7.0