Wowza Community

Wowza Rest api using curl in php always return key not send in header

I’m trying to consume wowza rest api using php with curl following is my code

$url = 'https://api-sandbox.cloud.wowza.com/api/v1.3/live_streams';

$headers = array(
"wsc-access-key:myaccessKy;
wsc-api-key:myapikey");
$cr = curl_init($url);
     
      curl_setopt($cr,CURLOPT_POST,1);
      curl_setopt($cr, CURLOPT_HTTPHEADER,$headers);
      $res = curl_exec($cr);
      curl_close($cr);
      dd($res);

when i dd the response i get this

{“meta”:{“status”:401,“code”:“ERR-401-NoApiKey”,“title”:“No Api Key Error”,“message”:“No API key sent in header.”,“description”:""}}

What could be the reason,

Thanks.

Have you competed this step already?


You will need to request API access via your cloud account and then you will see the API keys in your account.

https://www.wowza.com/docs/how-to-use-the-wowza-streaming-cloud-rest-api#requesting-access-to-the-api

Yes

i got my api and access key and send it in the header is shown in the code above but here i removed my actual key.

but still it return the above response ?

Each key in your header array needs to be in quotes.

$headers = array("wsc-access-key:myaccessKy";"wsc-api-key:myapikey");