comparison OrthancServer/Sources/OrthancRestApi/OrthancRestChanges.cpp @ 4403:ad646ff506d0

cont openapi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Dec 2020 18:32:13 +0100
parents d25f4c0fa160
children d928dfcacb4b
comparison
equal deleted inserted replaced
4402:b651989194d3 4403:ad646ff506d0
68 } 68 }
69 } 69 }
70 70
71 static void GetChanges(RestApiGetCall& call) 71 static void GetChanges(RestApiGetCall& call)
72 { 72 {
73 if (call.IsDocumentation())
74 {
75 call.GetDocumentation()
76 .SetTag("Tracking changes")
77 .SetSummary("List changes")
78 .SetDescription("Whenever Orthanc receives a new DICOM instance, this event is recorded in the so-called _Changes Log_. This enables remote scripts to react to the arrival of new DICOM resources. A typical application is auto-routing, where an external script waits for a new DICOM instance to arrive into Orthanc, then forward this instance to another modality.")
79 .SetHttpGetArgument("limit", RestApiCallDocumentation::Type_Number, "Limit the number of results", false)
80 .SetHttpGetArgument("since", RestApiCallDocumentation::Type_Number, "Show only the resources since the provided index", false)
81 .AddAnswerType(MimeType_Json, "The list of changes")
82 .SetAnswerField("Changes", RestApiCallDocumentation::Type_JsonListOfObjects, "The individual changes")
83 .SetAnswerField("Done", RestApiCallDocumentation::Type_Boolean,
84 "Whether the last reported change is the last of the full history")
85 .SetAnswerField("Last", RestApiCallDocumentation::Type_Number,
86 "The index of the last reported change, can be used for the `since` argument in subsequent calls to this route")
87 .SetHttpGetSample("https://demo.orthanc-server.com/changes?since=0&limit=2", true);
88 return;
89 }
90
73 ServerContext& context = OrthancRestApi::GetContext(call); 91 ServerContext& context = OrthancRestApi::GetContext(call);
74 92
75 //std::string filter = GetArgument(getArguments, "filter", ""); 93 //std::string filter = GetArgument(getArguments, "filter", "");
76 int64_t since; 94 int64_t since;
77 unsigned int limit; 95 unsigned int limit;
92 } 110 }
93 111
94 112
95 static void DeleteChanges(RestApiDeleteCall& call) 113 static void DeleteChanges(RestApiDeleteCall& call)
96 { 114 {
115 if (call.IsDocumentation())
116 {
117 call.GetDocumentation()
118 .SetTag("Tracking changes")
119 .SetSummary("Clear changes")
120 .SetDescription("Clear the full history stored in the changes log");
121 return;
122 }
123
97 OrthancRestApi::GetIndex(call).DeleteChanges(); 124 OrthancRestApi::GetIndex(call).DeleteChanges();
98 call.GetOutput().AnswerBuffer("", MimeType_PlainText); 125 call.GetOutput().AnswerBuffer("", MimeType_PlainText);
99 } 126 }
100 127
101 128