Starting Process with JSON payload

Hi,
I have a workflow end-point like

URL/process-definition/key:id/submit-form

I have a JSON payload like this

{
	"variables": {
		"amount": {
			"value":555,
			"type":"long"
		},
		"item": {
			"value": "item-xyz"
		}
	},
	 "businessKey" : "myBusinessKey",
	 "withVariablesInReturn": true
}

The intention is to submit the form with the JSON payload and read the JSON during the start of the workflow.
But when I hit this with the Rest API client I am not receiving the variable payload which I have sent with the request.
Here’s the sample workflow where I should able to process the JSON in Payload receiver task.

It will be helpful if you provide the Javascript API to receive and parse the JSON response.

Submit form is used when using the generated form fields. (The form tab config on the start event).

Are you using the generated form fields?

@StephenOTT Thanks for your quick reply.
I am not using the forms in the current workflow. I am trying to expose a rest endpoint of my workflow so that when the user hit the workflow URL(POST request) with JSON payload,

  1. The workflow should receive with the user request JSON - Pending
  2. The workflow should process the requested JSON data and should send the response back to the user rest endpoint -Done using HTTP connector.

Let me know in case more explainations are needed.

You need to use the generated forms if you want to use the submit form endpoint. Otherwise you should look at the StartInstance endpoint. You should also build a custom API rather than expose the Camunda API directly to the user, as there are lots of ways extra data can be injected into your Process instance.

1 Like

@StephenOTT Thanks. Let me follow the same.