How to create signed URL via the API

Hi,
I'm trying to follow this API guide: https://www.linode.com/docs/api/object-storage/#object-storage-object-url-create
to create a signed URL for one of the files stored in a bucket, but when I send

POST https://api.linode.com/v4/object-storage/buckets/my_clusterId/my_bucket/object-url
Content-Type: "application/json"
Authorization: Bearer my_token

{
    "method": "GET",
    "name": "my_file",
    "expires_in": 3600
    }

I'm getting an "Invalid JSON" error. I think my JSON looks exactly like the example, and even the JSON validators find it valid. Could someone provide some insight why this is happening? Thanks.

1 Reply

Ok, so I had "-s around the application/json in the Content-Type header. Removing those the request started working. Why that would generate an Invalid JSON response though is unknown to me.
So the correct request is:

POST https://api.linode.com/v4/object-storage/buckets/my_clusterId/my_bucket/object-url
Content-Type: application/json
Authorization: Bearer my_token

{
    "method": "GET",
    "name": "my_file",
    "expires_in": 3600
    }

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