LogoLogo
  • Rad TV Creator and Streaming Docs
  • Getting Started - Creators, Studios, Publishers
    • Create Your Rad TV Channel
    • Upload and Monetize Videos
    • Sell Individual Videos
    • Sell Subscription Video
    • Create Content Playlists
    • Create a FAST Channel
    • Publish RSS From Outside Server
    • Get Verified
    • Get Approved for Subscription Payments
    • Pricing Onchain Art
    • Maximize Your Earnings
    • VR and Portrait Content FAQ
  • Getting Started - Subscribers, Viewers
    • Premium and Free On-Demand Video, and Free TV
    • Rad TV for Web
    • Rad TV for PS5 / PS VR2
      • Sideloading
      • DLNA/UPnP
      • RSS Feeds
      • Video Encoding
      • File Naming Conventions
      • Controls for VR Version
      • Changelog for VR Version
    • Rad TV for PS4 / PS VR
      • Sideloading
    • Rad TV for iOS / Apple TV
    • Rad TV for Android / Android TV / Chromecast
    • Rad TV for Meta Quest
      • Sideloading
    • Local Media Servers and DLNA/UPnP
    • Adding External RSS Feeds to Your Library
  • Getting Started - Developer API
    • Authentication
    • GraphQL Basics
    • Managing Content
    • Managing Playlists
    • Managing Channels
  • Premium Subscriptions
    • Unlock Rad TV Premium with a Stream Pass NFT
  • Earn Free Premium Benefits via Referrals
  • Rad TV Partnerships for Businesses
  • Rad TV Blockchain Integrations
  • Rad TV Technical Support
Powered by GitBook
On this page
  • GraphQL Basics
  • What is GraphQL?
  • GraphQL Operations
  • Best Practices for Queries
  1. Getting Started - Developer API

GraphQL Basics

PreviousAuthenticationNextManaging Content

Last updated 4 months ago

Check out our custom Rad TV Developer API . (free or premium OpenAI account required)

GraphQL Basics

The Rad TV Developer API uses GraphQL, a query language for APIs that allows clients to request only the data they need. This section introduces GraphQL fundamentals and provides examples to help you make your first query.

What is GraphQL?

GraphQL is a flexible and efficient way to interact with APIs. Instead of multiple endpoints for different data, GraphQL provides a single endpoint where you specify the data structure you need.

Key Features of GraphQL:

  • Single Endpoint: All operations (queries, mutations, subscriptions) are handled at the same endpoint.

  • Customizable Queries: Request only the fields you need, reducing unnecessary data transfer.

  • Strongly Typed Schema: The API provides a schema that describes all the available operations and data types.

GraphQL Operations

Queries

Queries are used to fetch data. You specify the exact fields and structures required.

Example Query: Fetching the Current User

GraphQL Query:

query {
  me {
    id
    username
    email
    channel {
      id
      metadata {
        name
        summary
      }
    }
  }
}

Expected Response:

{
  "data": {
    "me": {
      "id": "did:rad:user/1234-abcd",
      "username": "raduser",
      "email": "raduser@example.com",
      "channel": {
        "id": "did:rad:channel/5678-wxyz",
        "metadata": {
          "name": "Rad Channel",
          "summary": "A personal channel for my uploads"
        }
      }
    }
  }
}

Mutations

Mutations are used to modify data, such as creating content, updating playlists, or uploading assets.

Example Mutation: Creating Content

GraphQL Mutation:

mutation {
  createContent(
    channel: "did:rad:channel/5678-wxyz",
    input: {
      metadata: {
        name: "My New Content",
        summary: "An exciting new video"
      }
    }
  ) {
    id
    metadata {
      name
      summary
    }
  }
}

Expected Response:

{
  "data": {
    "createContent": {
      "id": "did:rad:content/abcd-1234",
      "metadata": {
        "name": "My New Content",
        "summary": "An exciting new video"
      }
    }
  }
}

Best Practices for Queries

  • Fetch Only Required Fields: Avoid over-fetching to improve performance.

  • Use Descriptive Queries: Name your queries/mutations clearly to make debugging easier.

  • Error Handling: Always handle errors gracefully in your application.

chatbot here