# Sending a message through REST API creates an additional Null variable

**URL:** <https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167>\
**Category:** Discussion & Questions\
**Tags:** process-engine\
**Created:** [June 14, 2021, 9:02am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167 "2021-06-14T09:02:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaxx](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/46a35a/32.png) [@jaxx](https://forum.camunda.io/u/jaxx)\
**Post date:** [June 14, 2021, 9:02am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/1 "2021-06-14T09:02:58Z")

</div>

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

![image](https://forum.camunda.io/uploads/default/original/2X/4/4d2309ff0dc3f47f3473a614222161e7f92665d8.png)

I trigger it through the REST API:  
 ![image](https://forum.camunda.io/uploads/default/original/2X/0/058d73dba506c28eefad6268201c97f60b2d450d.png)

 ![image](https://forum.camunda.io/uploads/default/original/2X/b/b5bb5d0704329d3ae93d60f2d76bd6b8a5ea0a53.png)

curl --location --request POST ‘[http://localhost:8080/engine-rest/message](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:

 ![image](https://forum.camunda.io/uploads/default/original/2X/1/1469ed717c337c807c9926807f3e46106c6d0a2e.png)

What can be the reason for this?  
I am attaching the diagram  
[interprocess\_cmmnctn2.bpmn](https://forum.camunda.io/uploads/short-url/v8RZjEROZzMy2DHQG8pGrJ2U0kC.bpmn) (3.2 KB)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Niall](https://forum.camunda.io/user_avatar/forum.camunda.io/niall/32/15333_2.png) [@Niall](https://forum.camunda.io/u/Niall)\
**Post date:** [June 14, 2021, 9:12am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/2 "2021-06-14T09:12:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jaxx](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/46a35a/32.png) [@jaxx](https://forum.camunda.io/u/jaxx)\
**Post date:** [June 14, 2021, 9:18am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/3 "2021-06-14T09:18:23Z")

</div>

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

 ![image](https://forum.camunda.io/uploads/default/original/2X/7/73ca5f0228ffd25770af4d533d2bd6fcc366cec5.png)  
 ![image](https://forum.camunda.io/uploads/default/original/2X/9/9314d14ef84acaa3c81320d9070f52a273b75b37.png)

---

<div class="post-metadata">

**Author:** ![Niall](https://forum.camunda.io/user_avatar/forum.camunda.io/niall/32/15333_2.png) [@Niall](https://forum.camunda.io/u/Niall)\
**Post date:** [June 14, 2021, 9:27am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/4 "2021-06-14T09:27:38Z")

</div>

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.

 ![image](https://forum.camunda.io/uploads/default/original/2X/c/c3750ccca527f04448541c9e26ac9eab371c2d0f.png)

---

<div class="post-metadata">

**Author:** ![jaxx](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/46a35a/32.png) [@jaxx](https://forum.camunda.io/u/jaxx)\
**Post date:** [June 14, 2021, 9:39am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/5 "2021-06-14T09:39:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aravindhrs](https://forum.camunda.io/user_avatar/forum.camunda.io/aravindhrs/32/32503_2.png) [@aravindhrs](https://forum.camunda.io/u/aravindhrs)\
**Post date:** [June 14, 2021, 9:45am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/6 "2021-06-14T09:45:25Z")

</div>

@jaxx you can refer here:

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

---

<div class="post-metadata">

**Author:** ![jaxx](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/46a35a/32.png) [@jaxx](https://forum.camunda.io/u/jaxx)\
**Post date:** [June 14, 2021, 9:48am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/7 "2021-06-14T09:48:01Z")

</div>

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”?

---

<div class="post-metadata">

**Author:** ![aravindhrs](https://forum.camunda.io/user_avatar/forum.camunda.io/aravindhrs/32/32503_2.png) [@aravindhrs](https://forum.camunda.io/u/aravindhrs)\
**Post date:** [June 14, 2021, 9:56am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/8 "2021-06-14T09:56:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jaxx](https://forum.camunda.io/letter_avatar_proxy/v4/letter/j/46a35a/32.png) [@jaxx](https://forum.camunda.io/u/jaxx)\
**Post date:** [June 14, 2021, 10:32am UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/9 "2021-06-14T10:32:36Z")

</div>

Ok, thank you, I will have this in mind

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 1:10pm UTC](https://forum.camunda.io/t/sending-a-message-through-rest-api-creates-an-additional-null-variable/28167/10 "2024-01-30T13:10:27Z")

</div>

Closed on January 30, 2024, 1:10pm UTC


