0

I'm using flowable and try to pass a JSON as body, but it's seen as malformed when processing the request (or so I think since the error is Bad Request). Basically I'm passing some parameters this way:

@PostMapping(path = PathConstants.START_ACTION)
    public ResponseEntity<BaseResponse<ProcessInstance>> start(@PathVariable String processDefinitionId,
            @RequestBody(required = false) Map<String, Object> params)

The params are set using postman, this way:

{
    "body": {
        "email":"testmail@test", 
        "password":"password" 
    }

}

The process starts and the POST call is made, but Bad Request is given back. I've tried printing the variables of the process after this call and this is what I have:

body={email=testmail@test, password=password}

So I've tried passing this instead:

{
    "body": "{ \"email\":\"testmail@test\", \"password\":\"password\"}"

}

And when printing the variables I have:

body={"email":"testmail@test", "password":"password"}

but still it's a bad request. What is wrong with this JSON?

Usr
  • 2,628
  • 10
  • 51
  • 91

1 Answers1

0

If you want to pass a variable that is a JSON then you would need to make sure that body is type JsonNode from Jackson.

Looking at your request signature Map<String, Object>, Jackson would contain a map of maps.

I don't know what you are trying to do. However, I would highly advise you to work with predefined parameters in your REST API. If you need something generic you can use the REST API of Flowable to do what you want to do.

Filip
  • 19,269
  • 7
  • 51
  • 60