Deck API attachment upload via curl

I try to upload an attachment to a deck card after creating the card via API and curl.

The creation of the card works fine, but then adding the attachment does not work properly. I already found out, that the Content-Type-Header should not be set (according to the manual every call should be set to Content-Type: application/json but that seems wrong here). When I tried to put the file content and the type into a json, also the file is not handled at all.

My curl task:
/usr/bin/curl -u ‘user:pass’ -X POST -H “OCS-APIRequest: true” -H “Accept: application/json” -d ‘type=audio/mpeg’ -d ‘file=@/Users/heiko/Desktop/Interim/nickmsg_257114_f4310d25-ea53-45e6-84b9-52e4fff2826c.mp3’ ‘

The result:

So as it seems the server accepts the call but does not handle the file?!

Can anybody see what is wrong in the curl task and teach me how to do it right?
Or is something wrong with any setting, since the attachments are nc-files now and not dock files anymore?

Appreciate your help, thank you!

Append ?type=file to the request maybe?

1 Like

Thank you for the solution and also for showing me, where to look for the original code, this helped a lot.
I thought I have to add the file=… into the POST-Body. I was wrong.
Great, you made my week!

1 Like