Hi, I try to use vimeo API to upload video to Vimeo from my website to Vimeo without the video file touching my server. So I want to upload from the client to Vimeo server straight away. I am using this Vimeo documentation: https://developer.vimeo.com/api/upload/videos#form-based-approach-step-1
So basically I have to create a video "container " on Vimeo by sending a HTTP POST request to vimeo API. I using Guzzle as described in Laravel Doc. https://laravel.com/docs/8.x/http-client#introduction
After I sent the post request to the API I shlould get an upload form in the response, but unfortunatelly I dont get the form in the response.
My code:
$response = Http::withHeaders([
'Authorization' => 'bearer cca98blaaablaaaaaablaaaaaa',
'Content-Type' => 'application/json',
'Accept' => 'application/vnd.vimeo.*+json;version=3.4'
])->post('https://api.vimeo.com/me/videos',
[
"upload->approach" => "post",
"upload->redirect_url" => "http://127.0.0.1:8000/home",
]
);
dd($response);
the response:
Illuminate\Http\Client\Response {#1238 ▼
#response: GuzzleHttp\Psr7\Response {#1271 ▼
-reasonPhrase: "Created"
-statusCode: 201
-headers: array:20 [▼
"Connection" => array:1 [▶]
"Server" => array:1 [▶]
"Content-Type" => array:1 [▶]
"Cache-Control" => array:1 [▶]
"Strict-Transport-Security" => array:1 [▶]
"X-RateLimit-Limit" => array:1 [▶]
"X-RateLimit-Remaining" => array:1 [▶]
"X-RateLimit-Reset" => array:1 [▶]
"Request-Hash" => array:1 [▶]
"X-BApp-Server" => array:1 [▶]
"X-Vimeo-DC" => array:1 [▶]
"Accept-Ranges" => array:1 [▶]
"Via" => array:1 [▶]
"Date" => array:1 [▶]
"X-Served-By" => array:1 [▶]
"X-Cache" => array:1 [▶]
"X-Cache-Hits" => array:1 [▶]
"X-Timer" => array:1 [▶]
"Vary" => array:1 [▶]
"transfer-encoding" => array:1 [▶]
]
-headerNames: array:20 [▼
"connection" => "Connection"
"server" => "Server"
"content-type" => "Content-Type"
"cache-control" => "Cache-Control"
"strict-transport-security" => "Strict-Transport-Security"
"x-ratelimit-limit" => "X-RateLimit-Limit"
"x-ratelimit-remaining" => "X-RateLimit-Remaining"
"x-ratelimit-reset" => "X-RateLimit-Reset"
"request-hash" => "Request-Hash"
"x-bapp-server" => "X-BApp-Server"
"x-vimeo-dc" => "X-Vimeo-DC"
"accept-ranges" => "Accept-Ranges"
"via" => "Via"
"date" => "Date"
"x-served-by" => "X-Served-By"
"x-cache" => "X-Cache"
"x-cache-hits" => "X-Cache-Hits"
"x-timer" => "X-Timer"
"vary" => "Vary"
"transfer-encoding" => "transfer-encoding"
]
-protocol: "1.1"
-stream: GuzzleHttp\Psr7\Stream {#1272 ▼
-stream: stream resource @532 ▶}
-size: null
-seekable: true
-readable: true
-writable: true
-uri: "php://temp"
-customMetadata: []
}
}
#decoded: null
+"cookies": GuzzleHttp\Cookie\CookieJar {#1252 ▶}
+"transferStats": GuzzleHttp\TransferStats {#1273 ▶}
}
In the Vimeo API doc they says: set the upload.size parameter to length of the video file in bytes ... But at the time when I request the form from Vimeo I don't know what is the file size.
So I am not sure why I receive the response without the form..