Type
Video
What is the error number?
[code] => 10005
What is the error message?
Array ( [result] => [success] => [errors] => Array ( [0] => Array ( [code] => 10005 [message] => Bad Request: The request was invalid. Additional details might be available in messages. ) ) [messages] => )
What is the issue you’re encountering
i m not getting the upload url , please help me out and let me know what i am missing here.
What steps have you taken to resolve the issue?
i have written the code in PHP but only i am getting error as above.
What are the steps to reproduce the issue?
i have change parameter to get error resolved but on luck i have written code in PHP as below
<?php $account_id = 'account_id'; $api_token = 'api_token'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.cloudflare.com/client/v4/accounts/$account_id/stream/direct_upload"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ "maxDurationSeconds" => 3600, "expiry" => 3600, "requireSignedURLs" => true ])); $headers = [ 'Authorization: Bearer ' . $api_token, 'Content-Type: application/json' ]; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); $response_data = json_decode($response, true); if ($response_data && isset($response_data['result']['uploadURL'])) { $upload_url = $response_data['result']['uploadURL']; echo 'Upload URL: ' . $upload_url; } else { echo 'Error: '; print_r($response_data); } ?>