Message162

Author admin
Recipients
Date 2017-03-13.22:51:42
Content
[BitBucket user: Alain Mazy]
[BitBucket date: 2017-03-13.21:51:42]

Many of these methods only accept the AET as the body of the POST request but fails if the AET is passed as a single string with the content-type set to application/json.  That would be more RestFull to accept json requests as well.

in the integratin tests, we do have

DoPost(_REMOTE, '/queries/%s/answers/0/retrieve' % a, 'ORTHANC')

while we should also accept something like:

DoPost(_REMOTE, '/queries/%s/answers/0/retrieve' % a, 'ORTHANC', 'application/json')


i.e: 
```
static void RetrieveOneAnswer(RestApiPostCall& call)
  {
    size_t index = boost::lexical_cast<size_t>(call.GetUriComponent("index", ""));

    std::string modality;
    call.BodyToString(modality);
```
instead of that, we should have something like:
```
static void RetrieveOneAnswer(RestApiPostCall& call)
  {
    size_t index = boost::lexical_cast<size_t>(call.GetUriComponent("index", ""));
   if (call.ParseJsonRequest(request))
   {
      modality = request.asString()
   }
   else
   {
      std::string modality;
      call.BodyToString(modality);
   }

```
History
Date User Action Args
2026-07-29 15:51:19adminlinkissue36 messages
2026-07-29 15:51:19admincreate