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)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
response = surge.attachments.get_file("att_01kfyc9dgdec1avkgs7tng8htg")
puts(response)curl --request GET \
--url https://api.surge.app/attachments/{attachment_id}/file \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/attachments/{attachment_id}/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.surge.app/attachments/{attachment_id}/file"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}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)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
response = surge.attachments.get_file("att_01kfyc9dgdec1avkgs7tng8htg")
puts(response)curl --request GET \
--url https://api.surge.app/attachments/{attachment_id}/file \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/attachments/{attachment_id}/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.surge.app/attachments/{attachment_id}/file"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}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"
}
}