Error when sending CURL POST request to /import/ endpoint

I have followed the similar CURL structure as mentioned by @jnm here KoBo API examples, using new KPI endpoints but I am getting below error after I POST the form.

{
“status”: “error”,
“uid”: “ioFehpUsWMEiXsiCYNj344”,
“messages”: {
“error_type”: “Exception”,
“error”: "ImportTask data must contain base64Encoded , url , or single_xls_url "
},
“date_created”: “2020-01-10T06:20:02.606808Z”
}

Can someone please help me with this error. Is this related to any missing field in the XLS sheet or is it the file encoding itself or something I am not sending in the POST request? PS.

  • I am using a third party tool called Pentaho DI to generate the XLSform. When I upload the form directly from Kobo Toolbox web interface, it uploads successfully but from CURL POST to /import/ endpoint, it returns above JSON with error.
  • Also, I have my own Kobo Toolbox installation on AWS instance and I have already run the update to get the latest Kobo version.

Any help would be highly appreciated.

This is still working for me:

curl --user user:pass --header 'Accept: application/json' -X POST http://my.local.server/imports/ --form library=false --form file=@/tmp/myform.xlsx

Could you paste your exact curl command, excluding your password?

1 Like

Hello, thank you for your reply but the issue was with the multipart/form-data which wasn’t generated by Pentaho DI, so I fixed that and it fixed the response from API.

1 Like