JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const response = await client.attachments.getFile('att_01kfyc9dgdec1avkgs7tng8htg');
console.log(response.error);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
response = client.attachments.get_file(
"att_01kfyc9dgdec1avkgs7tng8htg",
)
print(response.error)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Attachments.GetFile(context.TODO(), "att_01kfyc9dgdec1avkgs7tng8htg")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Error)
}require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
response = surge.attachments.get_file("att_01kfyc9dgdec1avkgs7tng8htg")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$response = $client->attachments->getFile('att_01kfyc9dgdec1avkgs7tng8htg');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request GET \
--url https://api.surge.app/attachments/{attachment_id}/file \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.surge.app/attachments/{attachment_id}/file")
.header("Authorization", "Bearer <token>")
.asString();This response has no body data.{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Attachments
Retrieve attachment file
Download the media file for an MMS attachment. Returns a redirect to a short-lived signed URL.
GET
/
attachments
/
{attachment_id}
/
file
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const response = await client.attachments.getFile('att_01kfyc9dgdec1avkgs7tng8htg');
console.log(response.error);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
response = client.attachments.get_file(
"att_01kfyc9dgdec1avkgs7tng8htg",
)
print(response.error)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Attachments.GetFile(context.TODO(), "att_01kfyc9dgdec1avkgs7tng8htg")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Error)
}require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
response = surge.attachments.get_file("att_01kfyc9dgdec1avkgs7tng8htg")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$response = $client->attachments->getFile('att_01kfyc9dgdec1avkgs7tng8htg');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request GET \
--url https://api.surge.app/attachments/{attachment_id}/file \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.surge.app/attachments/{attachment_id}/file")
.header("Authorization", "Bearer <token>")
.asString();This response has no body data.{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}⌘I