Implementation POST /process-definition/key/{key}/start

Hi
I have a postman to launch a process adding businessKey
the request generated is something like

POST /engine-rest/process-definition/key/ProcessA/start HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.17.1
Accept: /
Cache-Control: no-cache
Postman-Token: 73939e65-4db1-4744-86d0-9d89fd5b642a
Host: 10.29.150.172:85
Accept-Encoding: gzip, deflate
Content-Length: 30
Connection: keep-alive
{“businessKey” : “hellodelu” }

And it works perfectly ^^ the process starts with a businessKey :smiley:

So the java implementation seemed very clear to me

final String resourceUrl = camundaprops.getServer() + “/process-definition/key/” + deploymentId + “/start”;
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setConnection(“keep-alive”);
headers.setCacheControl(CacheControl.noCache());
MultiValueMap<String, Object> body = new LinkedMultiValueMap<String, Object>();
body.add(“businessKey”, “whatelse”);
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(body, headers);
try {
ResponseEntity response = restTemplate.postForEntity(resourceUrl, request, String.class);
System.out.println(response);
} catch (RestClientException rce) {
System.out.println(rce.getMessage());
}

this kind of “build” for REST call is OK for anothers ressources
but when executing this i receive a 400 null systematically

i just don’t understand why
is there something i miss ??

Note:
in debug i can see

{businessKey=[whatelse]} for body
[Content-Type:“application/json”, Connection:“keep-alive”, Cache-Control:“no-cache”] for headers

Hi @flo,

You should use the process definition key instead of the deploymentId.

Hope this helps, Ingo

hi thx for replying
argh its just a name of variable. maybe confusing i assume

i just make it work with

JsonObject json = new JsonObject();
json.addProperty(“businessKey”, businessKey);

instead of MultiValueMap. Strange …

Can i ask one more question : is it possible to change the businessKey of a process instance? because i get something very exclusive making different every instance of a process but i get that data in the middle of the process
so i try with a sub process but his businessKey (seems to) inherits from his parent

Hi @flo,

you can change the value of the business key: https://docs.camunda.org/manual/7.11/user-guide/process-engine/delegation-code/#set-business-key-from-delegation-code

Hope this helps, Ingo