comparison OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp @ 4399:80fd140b12ba

New command-line option: "--openapi" to write the OpenAPI documentation of the REST API to a file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Dec 2020 12:21:03 +0100
parents 9e2fc6911ac8
children ad646ff506d0
comparison
equal deleted inserted replaced
4398:38c22715bb56 4399:80fd140b12ba
118 118
119 // Upload of DICOM files through HTTP --------------------------------------- 119 // Upload of DICOM files through HTTP ---------------------------------------
120 120
121 static void UploadDicomFile(RestApiPostCall& call) 121 static void UploadDicomFile(RestApiPostCall& call)
122 { 122 {
123 if (call.GetRequestOrigin() == RequestOrigin_Documentation)
124 {
125 Json::Value sample = Json::objectValue;
126 sample["ID"] = "19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5";
127 sample["ParentPatient"] = "ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3";
128 sample["ParentSeries"] = "3774320f-ccda46d8-69ee8641-9e791cbf-3ecbbcc6";
129 sample["ParentStudy"] = "66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e";
130 sample["Path"] = "/instances/19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5";
131 sample["Status"] = "Success";
132
133 call.GetDocumentation()
134 .SetTag("Instances")
135 .SetSummary("Upload DICOM files")
136 .AddRequestType(MimeType_Dicom, "DICOM file to be uploaded")
137 .AddRequestType(MimeType_Zip, "ZIP archive containing DICOM files (new in Orthanc 1.8.2)")
138 .AddAnswerType(MimeType_Json, "Information about the uploaded instance, "
139 "or list of information for each uploaded instance in the case of ZIP archive")
140 .SetSample(sample);
141 return;
142 }
143
123 ServerContext& context = OrthancRestApi::GetContext(call); 144 ServerContext& context = OrthancRestApi::GetContext(call);
124 145
125 CLOG(INFO, HTTP) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; 146 CLOG(INFO, HTTP) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP";
126 147
127 if (call.GetBodySize() == 0) 148 if (call.GetBodySize() == 0)