Upload file from URL.
curl --request POST \
--url https://apix.us.amity.co/api/v4/files/from-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"fileUrl": "<string>",
"preferredFilename": "<string>",
"accessType": "public"
}
'import requests
url = "https://apix.us.amity.co/api/v4/files/from-url"
payload = {
"fileUrl": "<string>",
"preferredFilename": "<string>",
"accessType": "public"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({fileUrl: '<string>', preferredFilename: '<string>', accessType: 'public'})
};
fetch('https://apix.us.amity.co/api/v4/files/from-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v4/files/from-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileUrl' => '<string>',
'preferredFilename' => '<string>',
'accessType' => 'public'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v4/files/from-url"
payload := strings.NewReader("{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
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.post("https://apix.us.amity.co/api/v4/files/from-url")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v4/files/from-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}"
response = http.request(request)
puts response.read_body[
{
"fileId": "<string>",
"fileUrl": "<string>",
"type": "file",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "test.pdf",
"extension": "pdf",
"size": 2107842,
"mimeType": "application/pdf",
"metadata": {}
}
}
]{
"status": "error",
"code": 400100,
"message": "Unauthorized"
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 408000,
"message": "Request Timeout"
}{
"status": "error",
"code": 413000,
"message": "Payload too large."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 400311,
"message": "RateLimit Exceed."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}File
Upload file from URL.
This endpoint allows you to upload a file from a URL to Social+ cloud storage.
Note: This feature requires enablement. Please contact social.plus support to enable this feature.
File size limit: 1,073,741,824 byte
POST
/
api
/
v4
/
files
/
from-url
Upload file from URL.
curl --request POST \
--url https://apix.us.amity.co/api/v4/files/from-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"fileUrl": "<string>",
"preferredFilename": "<string>",
"accessType": "public"
}
'import requests
url = "https://apix.us.amity.co/api/v4/files/from-url"
payload = {
"fileUrl": "<string>",
"preferredFilename": "<string>",
"accessType": "public"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Bearer <token>'},
body: JSON.stringify({fileUrl: '<string>', preferredFilename: '<string>', accessType: 'public'})
};
fetch('https://apix.us.amity.co/api/v4/files/from-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apix.us.amity.co/api/v4/files/from-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileUrl' => '<string>',
'preferredFilename' => '<string>',
'accessType' => 'public'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apix.us.amity.co/api/v4/files/from-url"
payload := strings.NewReader("{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
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.post("https://apix.us.amity.co/api/v4/files/from-url")
.header("Content-Type", "<content-type>")
.header("Authorization", "Bearer <token>")
.body("{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apix.us.amity.co/api/v4/files/from-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Bearer <token>'
request.body = "{\n \"fileUrl\": \"<string>\",\n \"preferredFilename\": \"<string>\",\n \"accessType\": \"public\"\n}"
response = http.request(request)
puts response.read_body[
{
"fileId": "<string>",
"fileUrl": "<string>",
"type": "file",
"accessType": "public",
"altText": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"attributes": {
"name": "test.pdf",
"extension": "pdf",
"size": 2107842,
"mimeType": "application/pdf",
"metadata": {}
}
}
]{
"status": "error",
"code": 400100,
"message": "Unauthorized"
}{
"status": "error",
"code": 400300,
"message": "Forbidden error."
}{
"status": "error",
"code": 400400,
"message": "Resource Not Found."
}{
"status": "error",
"code": 408000,
"message": "Request Timeout"
}{
"status": "error",
"code": 413000,
"message": "Payload too large."
}{
"status": "error",
"code": 500000,
"message": "Parameters validation error!."
}{
"status": "error",
"code": 400311,
"message": "RateLimit Exceed."
}{
"status": "error",
"code": 500000,
"message": "Unexpected error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
application/json
Response
File Upload Result
Root file key on cloud storage.
url to download the file
File type.
Available options:
image, file, video Example:
"file"
File access type. network type requires authentication to download.
Available options:
public, network Alternative text for the file.
The date/time when a file is uploaded.
The date/time when a file is updated.
Show child attributes
Show child attributes
⌘I