How to send long variables in camunda through REST API?

Hi all,
I want to start a instance of my Camunda process through the REST API ,
http://localhost:8080/engine-rest/process-definition/key/processkey/start.
I want to pass in some variables and one among them is a pretty long JSON.
{
“variables”: {
“cardJson”: {
“type”: “String”,
“value”: {my long json}
}
}
}
But this api call is giving out 500 error as the variable is too long to store com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column ‘TEXT_’ at row 1
Any ways in which i can send long variables through camunda API

Hey @Sidharthan_Jayavelu! :slight_smile:
You should never have such long variables in a process instance. This is being considered as a bad practice. Take a look at this docs page: Handling data in processes | Camunda Platform 8 Docs

It will slow down your process engine quite a lot over time…

My recommendation is to store this very long JSON in a domain database or S3 bucket. It would be ideal if the process only keeps a link or id to where this file is stored.

Hopefully this was helpful for you!
Best,
Thomas

1 Like

@Sidharthan_Jayavelu You should consider storing the variable as:

  • Java Serialization (String object)
  • JSON serialization (JSON string)

Example using JSON serialization:

{
  "variables": {
    "cardJson": {
          "type": "Json",
          "value": "{\"name\":\"Aravindh\",\"technology\":\"camunda platform 7\"}"
          }
    }
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.