The first thing you need to do is to authorize the usage of the API. The easiest way to do this is to first login into the CMS and select your site under the MANAGE VIDEOS option on the main left-hand menu. Once selected, click on the SETTINGS option right below your domain name and you should see the API section:
Click on the "Click here" link to create your authorization token.
Alternatively, you can use the PHP API to get an authorization token as described below.
You can do this by starting authorize.php on your server (found in our git repository as an example) but beforehand, edit the authorize.php file and enter the appropriate redirect URL for - $r_url = 'http://www.yourserver.com/bridapi/authorize.php'; to point to your server.
For sending any type of requests to the Brid API, you'll need to authorize via OAuth 2.0. When you fire the above URL, it will require you to login into the CMS to authorize API usage with a specific user account. Make sure to login into the CMS and authorize the API with a Brid account that has access to the sites you need to control.
Once this is done, the API will return an authorization token. It should look something like this - ca3f7b6843ae84b71da64b1d041c867f12b1aa0b
There are couple of ways to send/set access tokens to the BridApi class.
Using a construct and options argument:
Using the setAccessToken method:
$api = new BridApi(); $api->setAccessToken($token->access_token);
After receiving an Access/Refresh Token, store it in your database of choice. This is the recommended way to do it.
$accessToken = readFromMyDb->getBridToken(); new BridApi(array('oauth_token'=>$accessToken);
Hardcoding it into a constructor, even if it is the fastest way, this approach is not recommended. In some cases, when your access_token expires, you'll need to modify your code directly.
After Token values are received, you are able to access all Brid.tv API methods.