How do I upload a object storage file using the API

I have an NodeJs (specifically, NestJs) API to which users can upload files (PDFs, Images). I wish to upload those files to Linode Object Storage. The uploaded files should be private, and are only accessed through signed URLs, which are obtained from my API (which calls Linode).

I am able to create Signed URLs and use them.
But I'm not sure how to upload a file.
The API documentation implies that I can use it to upload files by either generating it with a different method value (PUT or POST ?), or by calling the creation endpoint differently. The problem is that they don't specify how to include the file itself.

I'm using Postman for testing this, and depending on how I try to call the API I either get InvalidArgument response or Error: aborted.

I have tried every combination of POST and PUT requests on both the signed URL creation API endpoint, and the signed link itself, and using form-data to provide the file itself

I have also inspected the requests the Cloud Manager sends, and they never seem to include the actual file.

I really want to do this over HTTP and not by using the AWS-SDK library since it's (in my opinion) a very single action and I don't need a 80mb library that includes all AWS services.

How do I need to structure my request and its data in order to upload a file through Linode API?

2 Replies

I have the same issue which is driving me crazy. Did you figure out the answer?

Update: This is the correct format:

curl -X PUT -H "Content-Type: image/png" -T ~/pictures/buff.png $presignedurl

Make sure not to include any Authorization header.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct