Uploading multiple files simultaneously to a support ticket through REST (curl) fails in Linux
Platform Notice: Cloud, Server, and Data Center - This article applies equally to all platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
There are situations where multiple files are needed to be uploaded to a support ticket, and doing it through the support portal can take a lot of time. The link https://transfer.atlassian.com/auth_token offers a solution for it, but the command provided fails in Linux.
Environment
Running the command line in a Linux machine.
Diagnosis
When attempting to execute the command offered in the link mentioned previously, the error shown is:
$ curl -u NTU3MDU4OjM5MGZkMzEyLWY0OTUtNDgyZi04MmFkLThhZDZlMjRiZjljMA==:<token> -X POST \
--header "Transfer-Encoding: chunked" \
-F "files[]=@/var/atlassian/application-data/bitbucket/export/Bitbucket.zip" \
-F "files[]=@/var/atlassian/application-data/bitbucket/export/thread_dumps.zip" \
https://transfer.atlassian.com/api/upload/ABC-12345
$ curl: (26) Failed to open/read local data from file/application
Cause
Even though the command is correct, Linux can't process double quotation marks as the example shows.
Solution
Change the double quotation marks for single quotation marks:
$ curl -u NTU3MDU4OjM5MGZkMzEyLWY0OTUtNDgyZi04MmFkLThhZDZlMjRiZjljMA==:<token> -X POST \
--header "Transfer-Encoding: chunked" \
-F 'files[]=@/var/atlassian/application-data/bitbucket/export/Bitbucket.zip' \
-F 'files[]=@/var/atlassian/application-data/bitbucket/export/thread_dumps.zip' \
https://transfer.atlassian.com/api/upload/ABC-12345