How an API data source works
An API data source is a Base URL with one or more Links. A link adds an endpoint to the base URL, and the two together are the address VRA fetches. For the BBC World news feed,https://feeds.bbci.co.uk/news/world/rss.xml, the base URL is https://feeds.bbci.co.uk/news and the endpoint is /world/rss.xml. Add a second link, like /technology/rss.xml, to fetch another feed from the same site.
Each link fills its own station variable. You use that variable in the Visual Designer, like any other live data.
Add an API data source
Add an API data source in Settings → Outputs → Data sources.1
Add the data source
Click Add new. Enter the Base URL, like
https://feeds.bbci.co.uk/news, and pick the Data format of the feed: Rss for a news feed, Json for most APIs.2
Add a link
Under Links, click the link, or Add New Link for another one. In Edit link, enter the Endpoint, like
/world/rss.xml, and pick the Fetch type.3
Test the link
Click Test request. The Response preview shows the data the feed sends. When the data is in another format than the Data format you picked, VRA says so: click Use with the detected format to switch.
4
Create the variable
Turn on Auto-generate variable, then click Create new. VRA creates the data source and a station variable for the link. The variable is named after the data format, the base URL and the endpoint, so pick the Data format before you turn it on.
A saved link lists its variables under Variables. Click Auto-generate new variable to add one later.
Choose the fetch type of an API data source
The fetch type decides who fetches the link.- Cloud proxied - VRA Cloud fetches the data for you. Use it when the feed blocks requests from a browser.
- Browser direct - The browser that shows the visual fetches the data. Use it only when the feed allows requests from a browser.
Connect an API that needs a login
Fill in Authorization token with the token or API key of the service. For other login methods, add the header the API asks for under Headers, as JSON, like{"X-Api-Key": "your key"}.
Create a news ticker from an RSS feed
A news ticker is a Playlist layer that shows the items of a feed one after the other. Each item shows the headline for the Duration you set.- In the Visual Designer, click Add layer and pick Playlist.
- Under Playlist properties, set Mode to Data selector and turn on API data source.
- Under Select a variable, pick the variable of your feed. For an RSS feed, the playlist goes through the items of the feed and adds an item with a text layer that shows the title,
{{ item.title }}. - Click Data Selector to see the fields of each item, like
title,descriptionandpubDate. Change the text layer to another field the same way, like{{ item.description }}. - Set Duration, how long each headline stays on screen. The minimum is 0.5 s.