Broadcast.Radio platform Public API

Modified on Tue, 24 Sep at 12:55 PM

broadcast.radio users can take advantage of the public API, for example, to embed song information directly onto a website. This page is provided as a reference.

You can find your numeric "station ID" in the address bar from any broadcast.radio page. Within this article, wherever you see {stationId} then you should use the number - for example in this article we are using station 8:

mceclip0.png

Public API

All API endpoints use the JSON format with optional support for JSONP. You can access the API from both a server-side script, and from JavaScript in the web browser.

API Server URL

The API is available via https only via the URL:

https://api.broadcast.radio

API methods:

GET /api/nowplaying/{stationId}

Returns the now playing information, and any schedule information.

By default, only a few hours of scheduling information are provided. Set the scheduleLength query parameter to true to access the full weekly schedule.

For example:

https://api.broadcast.radio/api/nowplaying/8
Might return:
{
  "success": true,
  "body": {
    "now_playing": {
      "stationId": 8,
      "title": "Non Stop Tunes",
      "artist": "",
      "artworkUrl": "/api/image/ae06e77a-6f38-4f91-bf4a-f6705ff70084.png?g=center&w=400&h=400&c=true",
      "mediaItemId": 51,
      "mediaItemType": 2,
      "startDate": "2022-09-06T10:01:39.000Z",
      "default": true
    },
    "schedule": [
      {
        "start_tza": 1663160400000,
        "end_tza": 1663182000000,
        "contentId": 642927816,
        "assignmentId": 7,
        "entryId": 8072,
        "override": false,
        "stationId": 8,
        "start_tza_string": "2022-09-14T13:00:00.000Z",
        "end_tza_string": "2022-09-14T19:00:00.000Z",
        "start_time_in_station_tz": 1663156800000,
        "end_time_in_station_tz": 1663178400000,
        "start_time_local_tza": "2022-09-14T12:00:00.000Z",
        "end_time_local_tza": "2022-09-14T18:00:00.000Z",
        "content": [
          {
            "revision": 120381,
            "contentId": 642927816,
            "contentType": {
              "id": 8,
              "display_name": "Show",
              "slug": "show",
              "slug_plural": "shows",
              "has_slug": true
            },
            "contentTypeId": 8,
            "authorId": 3,
            "display_title": "Non Stop Tunes",
            "parentContentId": null,
            "status": 1,
            "excerpt": null,
            "body": "\n

All the best tunes, all the time!

\n", "href": "/show/automation/non-stop-tunes", "permalink": "non-stop-tunes", "createdAt": "2021-10-06T13:38:23.000Z", "updatedAt": "2021-10-08T11:12:18.000Z", "meta": null }, { "revision": 180, "contentId": 642927816, "contentType": { "id": 7, "display_name": "Featured Image", "slug": "featuredImage", "slug_plural": "featuredImages", "has_slug": false }, "contentTypeId": 7, "authorId": 1, "display_title": "icon.png", "parentContentId": 769695645, "status": 1, "excerpt": "", "body": "cms-blob_image/png:ae06e77a-6f38-4f91-bf4a-f6705ff70084:center", "href": null, "permalink": null, "createdAt": "2020-08-11T21:23:14.000Z", "updatedAt": "2022-04-21T20:04:03.000Z", "meta": null } ], "current": true } ], "recently_played": [ { "stationId": 8, "title": "Love Shy", "artist": "Kristine Blond", "artworkUrl": "/api/art/image/20171116/images/discogs/158337/1247482237.jpeg.jpg?w=400&h=400&g=center&c=true", "mediaItemId": 13810, "mediaItemType": 7, "startDate": "2022-09-06T09:56:42.000Z" }, { "stationId": 8, "title": "Crash", "artist": "The Primitives", "artworkUrl": "/api/art/image/20171116/images/discogs/1682282/1482914423-5859.jpeg.jpg?w=400&h=400&g=center&c=true", "mediaItemId": 10776, "mediaItemType": 7, "startDate": "2022-09-06T09:54:23.000Z" }, { "stationId": 8, "title": "I Don't Care", "artist": "Fall Out Boy", "artworkUrl": "/api/art/image/20171116/images/discogs/14150249/1568765126-5789.jpeg.jpg?w=400&h=400&g=center&c=true", "mediaItemId": 16540, "mediaItemType": 7, "startDate": "2022-09-06T09:50:55.000Z" } ] } }

 

GET /api/player/{stationId}

Returns the configuration information as used by the Broadcast Radio Player.

For example:

https://api.broadcast.radio/api/player/8
Might return:
{
  "success": true,
  "body": {
    "options": {
      "style.theme": "default",
      "style.logo": "cms-blob_image/png:be759809-7bcf-4871-876b-d79ff952792f:center",
      "site.title": "Purgatory FM",
      "site.tagline": "It's a Hell Of A Station",
      "site.contact_email": true,
      "style.tint_colour": "#ffa600",
      "app.background_colour": "#000000",
      "app.secondary_colour": "#ffffff",
      "app.border_button_colour": "#ffc400",
      "app.border_icon_colour": "#FFF",
      "app.logo_url": null,
      "style.app-icon": "cms-blob_image/png:ae06e77a-6f38-4f91-bf4a-f6705ff70084:center:500:500",
      "app.social_icon_colour": "#FFFFFF",
      "app.main_background_colour": "#000000",
      "app.now_playing_background_colour": "#121212",
      "app.now_playing_text_colour": "#ffffff",
      "app.show_contact_button": null,
      "player.enable": true,
      "player.artwork.enable": true,
      "player.nowplaying.enable": true,
      "player.contact.enable": true,
      "player.mixcloud.enable": true,
      "player.logo_override": "cms-blob_image/png:04ec838c-e1f1-45d4-9231-dcb6bc69e40e:center",
      "social.facebook": "purgatoryfm",
      "social.twitter": "purgatoryfm",
      "social.instagram": "purgatory.fm",
      "player.history.enable": true,
      "player.background_image": null,
      "player.schedule.enable": true,
      "player.schedule.mode": "now-next",
      "social.mixcloud": "PurgatoryFM",
      "app.hero_image": "cms-blob_image/png:ecbb9073-5ace-4d7d-b4a0-254652788365:center",
      "player.defaults.mode": "embed",
      "player.defaults.size": [
        400,
        730,
        0
      ],
      "player.defaults.autoplay": true,
      "player.menu_text_colour": "#FFFFFF",
      "player.menu_background_colour": "#000000",
      "player.history.length": 3,
      "player.background_colour": "#1f1f1f",
      "player.secondary_colour": "#FFF",
      "player.tint_colour": "#ffbb00",
      "app.custom_social": null
    },
    "streams": [
      {
        "id": 10,
        "stationId": 8,
        "url": "https://mp3streaming.broadcastradio.com:9112/PG96AAC",
        "priority": 1,
        "name": "96k AAC",
        "app_enabled": false,
        "player_enabled": true
      }
    ],
    "station": {
      "id": 8,
      "customerId": 3,
      "parentStationId": null,
      "name": "Purgatory FM",
      "tagline": "It's a Hell of a station",
      "timezone": "Europe/London",
      "domain": "purgatory.broadcast.radio",
      "website_enabled": false,
      "voice_enabled": true,
      "app_enabled": true,
      "player_enabled": true,
      "max_live_rooms": 0,
      "live_room_user_limit": 2,
      "podcast_quota": 1024,
      "parent": null,
      "children": [
        {
          "id": 216,
          "customerId": 3,
          "parentStationId": 8,
          "name": "Purgatory 80s",
          "tagline": null,
          "timezone": null,
          "domain": "purgatory80s.broadcast.radio",
          "website_enabled": false,
          "voice_enabled": false,
          "app_enabled": true,
          "player_enabled": true,
          "max_live_rooms": 0,
          "live_room_user_limit": 2,
          "podcast_quota": null
        }
      ]
    }
  }
}

 

Displaying Images

Image URLs are encoded in a special format. As un-friendly as they may look, these links are straightforward to programatically interpret and convert into a real link.

An example of a broadcast.radio Image URL is:

cms-blob_image/png:ae06e77a-6f38-4f91-bf4a-f6705ff70084:center:500:500

When split by a colon, it can be described as

cms-blob_image/png:image-unique-identifier:alignment:width[:height]

If a height is provided, the image will be cropped to the specified dimensions.

The example above can be translated into this URL:

https://brusercontent.broadcast.radio/api/image/ae06e77a-6f38-4f91-bf4a-f6705ff70084.png?g=center&w=500&h=500&c=true

 

 

Attachments (1)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article