Sending a message through REST API creates an additional Null variable

Hello
I have the following problem
I have a very simple process, started by a message:

image

I trigger it through the REST API:
image

curl --location --request POST ‘http://localhost:8080/engine-rest/message
–header ‘Content-Type: application/json’
–data-raw ‘{
“messageName” : “QuestionCreated2”,
“businessKey” : “1”,
“processVariables” : {
“question” : {
“value” : “What time is it?”,
“type”: “String”
}
}
}’

The process starts, but for some reason I see an additional Null variable in the Cockpit:

What can be the reason for this?
I am attaching the diagram
interprocess_cmmnctn2.bpmn (3.2 KB)

Thanks in advance

That does seem really, really strange.
Does the same thing happen if you start the process using the regular start process by key rest call rather than via the message api?

yes, it seems:
(although I am not sure if it is correct to start the process by key, without sending the message)


Well… that was a fun mystery to solve.

Turns out that you’ve got a space in the Initiator field. This then creates a variable with with the username of the initiator of the process instance. in your case it’s done via message so the value is null.
If you remove the space the variable shouldn’t appear.

Thank you, Niall
This solved the problem.
Where can I find more information about this “Initiator” field - how it can be used?

@jaxx you can refer here:

https://docs.camunda.org/manual/7.15/reference/bpmn20/custom-extensions/extension-attributes/#initiator

Hi @aravindhrs
It is written “The attribute specifies a process variable in which the user id of the process initiator is set.”
So if I understand correctly the Camunda engine will set this field automatically when the process is started by a given user, but in case of Message start event I must set this field “manually”?

If a process is started with an authenticated user, ie. if you are logged in in the tasklist, initiator of the process instances should be set. You can get it either by the Java API or the REST API.

In case of message start event, for initiator you can refer the process variable which is sent from the message payload.

Ok, thank you, I will have this in mind