iOS — Initiate direct-to-S3 multipart upload for a new file slot
curl --request POST \
--url http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"milestone_athlete_rel_id": 88,
"file_name": "reel.mp4",
"file_size": 8421376,
"file_mime_type": "video/mp4"
}
'import requests
url = "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate"
payload = {
"milestone_athlete_rel_id": 88,
"file_name": "reel.mp4",
"file_size": 8421376,
"file_mime_type": "video/mp4"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
milestone_athlete_rel_id: 88,
file_name: 'reel.mp4',
file_size: 8421376,
file_mime_type: 'video/mp4'
})
};
fetch('http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate', 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 => "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate",
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([
'milestone_athlete_rel_id' => 88,
'file_name' => 'reel.mp4',
'file_size' => 8421376,
'file_mime_type' => 'video/mp4'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate"
payload := strings.NewReader("{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"session_id": 501,
"upload_id": "2~abcDEF123ghiJKL456mnoPQR789stuVWX0",
"s3_key": "deal-folders/12/slot-1/v1/reel.mp4",
"parts": [
{
"part_number": 1,
"presigned_url": "https://mogl-prod.s3.amazonaws.com/deal-folders/12/slot-1/v1/reel.mp4?partNumber=1&uploadId=2~abc...&X-Amz-Signature=..."
}
]
}
}{
"message": "Unauthenticated."
}{
"status": "error",
"message": "Deal folder not found."
}{
"message": "The given data was invalid.",
"errors": {}
}iOS — Initiate direct-to-S3 multipart upload for a new file slot
iOS-only. Step 1 of 2. Creates an S3 multipart upload session for a new file slot and returns presigned URLs (one per ~10 MB part) valid for 24 hours. After uploading every part to S3, call POST /deal-folder//files/complete with the returned session_id and per-part ETags. Accessible by athlete, brand, or agent.
POST
/
deal-folder
/
{dealFolder}
/
files
/
initiate
iOS — Initiate direct-to-S3 multipart upload for a new file slot
curl --request POST \
--url http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"milestone_athlete_rel_id": 88,
"file_name": "reel.mp4",
"file_size": 8421376,
"file_mime_type": "video/mp4"
}
'import requests
url = "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate"
payload = {
"milestone_athlete_rel_id": 88,
"file_name": "reel.mp4",
"file_size": 8421376,
"file_mime_type": "video/mp4"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
milestone_athlete_rel_id: 88,
file_name: 'reel.mp4',
file_size: 8421376,
file_mime_type: 'video/mp4'
})
};
fetch('http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate', 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 => "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate",
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([
'milestone_athlete_rel_id' => 88,
'file_name' => 'reel.mp4',
'file_size' => 8421376,
'file_mime_type' => 'video/mp4'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate"
payload := strings.NewReader("{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/mogl/mogl-backend/api/deal-folder/{dealFolder}/files/initiate")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"milestone_athlete_rel_id\": 88,\n \"file_name\": \"reel.mp4\",\n \"file_size\": 8421376,\n \"file_mime_type\": \"video/mp4\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"session_id": 501,
"upload_id": "2~abcDEF123ghiJKL456mnoPQR789stuVWX0",
"s3_key": "deal-folders/12/slot-1/v1/reel.mp4",
"parts": [
{
"part_number": 1,
"presigned_url": "https://mogl-prod.s3.amazonaws.com/deal-folders/12/slot-1/v1/reel.mp4?partNumber=1&uploadId=2~abc...&X-Amz-Signature=..."
}
]
}
}{
"message": "Unauthenticated."
}{
"status": "error",
"message": "Deal folder not found."
}{
"message": "The given data was invalid.",
"errors": {}
}Authorizations
JWT Bearer token authentication. Use the /api/login endpoint to obtain a token.
Path Parameters
Deal folder ID
Example:
12
Body
application/json
MilestonesAthleteRel ID this file belongs to.
Example:
88
Original file name (max 500 chars).
Example:
"reel.mp4"
File size in bytes. Max 250 MB (262144000 bytes).
Example:
8421376
MIME type of the file (max 255 chars).
Example:
"video/mp4"