[Solved] Create Task Attachment via API method "createTaskFile"

Hi All,

i am pretty new to Kanboard and am coding as a hobby with perl (due to home automation software named FHEM).

I want to integrate Kanboard to my home automation and with some functions of the API i had already success.

What I am hanging on currently is the “createTaskFile” method of the api.

I had already have success with a very small file (.txt file with one single line) to upload it with the “createTaskFile” method.

 Success with example curl command:

2020.12.10 21:45:41 1: sub: kBaddFileToTask, Variable cmd: curl -s
-u “xxx:xxxxx”
-d ‘{“jsonrpc”: “2.0”, “method”: “createTaskFile”, “id”:“66”, “params”: {
“project_id”: 2,
“task_id”: 6,
“filename”: “uploadedByFHEM.txt”,
“blob”: “SGFsbG8gV2VsdA==”
}}’
http://192.168.0.238/kanboard-1.2.16/jsonrpc.php

But as soon as I use (little larger) Files (not that much longer), I get a failure:

 FAILURE with example curl command:

2020.12.10 21:55:16 1: sub: kBaddFileToTask, Variable cmd: curl -s
-u “RE:5yTxTyHuRpWgogkj5PCy”
-d ‘{“jsonrpc”: “2.0”, “method”: “createTaskFile”, “id”:“921”, “params”: {
“project_id”: 2,
“task_id”: 6,
“filename”: “uploadedByFHEM.txt”,
“blob”: “SGFsbG8gV2VsdEhhbGxvIFdlbHRIYWxsbyBXZWx0SGFsbG8gV2VsdEhhbGxvIFdlbHRIYWxsbyBX
ZWx0SGFsbG8gV2VsdEhhbGxvIFdlbHRIYWxsbyBXZWx0SGFsbG8gV2VsdEhhbGxvIFdlbHRIYWxs
byBXZWx0SGFsbG8gV2VsdEhhbGxvIFdlbHRIYWxsbyBXZWx0”
}}’
http://192.168.0.238/kanboard-1.2.16/jsonrpc.php

I save the decoded blob in base64 to a file and the reload the blob to perl, so I have somehow the feeling that this could cause the error as soon as I have multiline base64 code, but I cannot grab it.

So If someone can help me through, I would appreciate it.

Thanks alot
Raemsna

I would suggest checking your servers max file upload size limit.

OK, i got it, I had to remove the \n in perl in order to get the base64 hash correctly formatted to work.
Thanks for the support!!
Raemsna