Create Presigned Object URL
Returns a timed and authenticated URL to download (GET) or upload (PUT) an object. This is the equivalent to AWS S3’s “presigned” URL. Please note that Telnyx performs authentication differently from AWS S3 and you MUST NOT use the presign method of AWS s3api CLI or SDK to generate the presigned URL.
Refer to: https://developers.telnyx.com/docs/cloud-storage/presigned-urls
POST
/
storage
/
buckets
/
{bucketName}
/
{objectName}
/
presigned_url
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.storage.buckets.createPresignedURL('', { bucketName: '' });
console.log(response.content);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.storage.buckets.create_presigned_url(
object_name="",
bucket_name="",
)
print(response.content)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Storage.Buckets.NewPresignedURL(
context.TODO(),
"",
telnyx.StorageBucketNewPresignedURLParams{
BucketName: "",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Content)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.storage.buckets.BucketCreatePresignedUrlParams;
import com.telnyx.sdk.models.storage.buckets.BucketCreatePresignedUrlResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
BucketCreatePresignedUrlParams params = BucketCreatePresignedUrlParams.builder()
.bucketName("")
.objectName("")
.build();
BucketCreatePresignedUrlResponse response = client.storage().buckets().createPresignedUrl(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.storage.buckets.create_presigned_url("", bucket_name: "")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->storage->buckets->createPresignedURL(
'', bucketName: '', ttl: 60
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx storage:buckets create-presigned-url \
--api-key 'My API Key' \
--bucket-name '' \
--object-name ''curl --request POST \
--url https://api.telnyx.com/v2/storage/buckets/{bucketName}/{objectName}/presigned_url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"ttl": 60
}'{
"content": {
"token": "<string>",
"presigned_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The name of the bucket
The name of the object
Body
application/json
The time to live of the token in seconds
Required range:
1 <= x <= 604800Example:
60
Response
Presigned URL Object Response
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.storage.buckets.createPresignedURL('', { bucketName: '' });
console.log(response.content);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.storage.buckets.create_presigned_url(
object_name="",
bucket_name="",
)
print(response.content)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Storage.Buckets.NewPresignedURL(
context.TODO(),
"",
telnyx.StorageBucketNewPresignedURLParams{
BucketName: "",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Content)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.storage.buckets.BucketCreatePresignedUrlParams;
import com.telnyx.sdk.models.storage.buckets.BucketCreatePresignedUrlResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
BucketCreatePresignedUrlParams params = BucketCreatePresignedUrlParams.builder()
.bucketName("")
.objectName("")
.build();
BucketCreatePresignedUrlResponse response = client.storage().buckets().createPresignedUrl(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.storage.buckets.create_presigned_url("", bucket_name: "")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->storage->buckets->createPresignedURL(
'', bucketName: '', ttl: 60
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx storage:buckets create-presigned-url \
--api-key 'My API Key' \
--bucket-name '' \
--object-name ''curl --request POST \
--url https://api.telnyx.com/v2/storage/buckets/{bucketName}/{objectName}/presigned_url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"ttl": 60
}'{
"content": {
"token": "<string>",
"presigned_url": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
}