What is GraphQL?

GraphQL is an open-source data query language for APIs, and a runtime for fulfilling queries with your existing data. The primary difference between GraphQL and REST is how data is sent to the client. In a REST architecture, the client makes an HTTP request and data is sent as an HTTP response. In GraphQL architecture, the client requests data with queries. For more information see, https://graphql.org/.

How to use GraphQL

The url entry point for the service is:

https://api.millicast.com/graphql

To perform requests to the api, you need to authenticate using the a bearer token which is the API token from the Dolby.io dashboard and pass it in the Authorization request header. The API token can be found in the settings tab in the Dolby.io dashboard.

Using the GraphQL API you can query feeds and stream views, and Dolby.io Real-time Streaming will aggregate the stats for each stream in 5 minute intervals. For more information, see the GraphQL API article.

How it works

The queries within the GraphQL API are the combination both a model and a resolver. For example "feedFindOne" is a query, feed is the model and FindOne is the resolver. There are five resolvers and four models with a total of 20 different queries.

{
    streamStatFindMany{
        accountId
        streamId
        from,
        to,
        active,
        numStarted,
        numEnded
    }
}  

Entities

You will be able to query the following entities:

  • Feeds: Information about a media source being published into a stream

  • StreamViews: Information about the viewers of a stream

This information will only be accessible during 30 days after publication/view is ended, and the number of records returned is limited.

Aggregated Stats

Dolby.io Real-time Streaming will aggregate the stats for each stream in 5 minutes intervals and provide the following

  • StreamStats: started views, ended views, active views, duration of the views

  • AccountStats: Aggregated stats for your account

The stats will be available within 1 year after being generated, so you can perform historical queries.

For example, to find the current active publications you can perform the following query:

{
 feedFindMany(filter: {active: true}) {
  started
  active
  ended
  streamId
 }
}