Create attachments for issues via GitLab API

I have to create attachments for my issues via GitLab API and it looks like Notes should be the means for it. The files I want to attach reside on my PC. (But it would be ok if the upload worked from a remote server.)

I’ve tried everything I could, but without success: it seems that when you create an attachment using the web interface, a link with a 33 char long id is generated, e.g.

https://gitlab.com/username/project_name/uploads/123e4567d3b8fa24e63d7593e99ee2a7/sample_file.txt

When I follow the Upload a file APIfunction documentation, ie:

curl -X POST -v -# -o output -T somefile.txt -H “PRIVATE-TOKEN: $TOKEN” “https://gitlab.com/api/v3/projects/$PROJECT_ID/uploads

I receive a 201 created HTTP response and a [data not shown]" as the curl output. Nowhere can I find the id/url for the uploaded file.

PS Just for those who would consider: uploading the files to the repository is not an option.

Nvm, I just needed a bit of a curl-fu:

curl -X POST -i --trace-ascii /dev/stderr -o output -F “file=@./somefile.txt” -H “PRIVATE-TOKEN: $TOKEN” “https://gitlab.com/api/v3/projects/$PROJECT_ID/uploads

solved it. (The resulting url is https://gitlab.com/username/projectname/id_from_curl_response/somefile.txt)