Use Camunda to deploy bpmn, dmn... and other API's

Niall,
I have a follow up question as I am running into an issue trying to use a service task to with an http-connector using a Javascript script trying to post a “file” type of variable. I saw this post that seems to be bumping into the same issue. To summarize, I was able to start a process sending a file in and I can see the bpmn file as a variable in camunda and I can download it.


My problem is that I cannot a find a way to send the file (store in ‘fileToDeploy’) back to the /deployment/create camunda API. When I try to decode the file and store it into a variable, I get an exception telling me that the variable is too large. This is the code for the payload I was trying to put together.

var payload =
{
“deployment-name”: “model_deployment”,
“enable-duplicate-filtering”: “false”,
“deployment-source”: “automation”,
“bpmnFile”: {
“value”: execution.getVariable(“fileToDeploy”),
“options”: {
“filename”: execution.getVariable(“fileName”),
“contentType”: null
}
}
}
JSON.stringify(payload);
How do I get an handle on the execution.getVariable(‘fileToDeploy’) in such a way that I can send it back out? Thank you for your help. Cheers.