Example requests - Ruby

See the below 2 examples on how to use the Brid backend API using Ruby without implementing our SDK.

GET request example

require "uri"
require "net/http"

url = URI("https://api.brid.tv/apiv2/players/list/<SITE_ID>/PAGINATION.json")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <YOUR_AUTH_TOKEN>"
request["User-Agent"] = "Api | BridVideo"
request["X-Site"] = "<YOUR_DOMAIN>"

response = https.request(request)
puts response.read_body

POST request example

require "uri"
require "net/http"

url = URI("https://api.brid.tv/apiv2/videos/add/.json")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <YOUR_AUTH_TOKEN>"
request["User-Agent"] = "Api | BridVideo"
request["X-Site"] = "<YOUR_DOMAIN>"
request["Content-Type"] = "application/x-www-form-urlencoded"
request.body = "partner_id=%3CSITE_ID%3E&name=Postman&channel_id=%3CCHANNEL_ID%3E&mp4=%3CMP4_URL%3E"

response = https.request(request)
puts response.read_body

Both of the examples above use Net:http library for making HTTP requests.