GraphQL API
Engagement
Likes, comments, and follows — audience interaction via the GraphQL API. Comments use Relay connections for listing.
Build community features into your app. The engagement API lets users like content, follow channels, and post comments. All operations are idempotent — liking already-liked content or following an already-followed channel is safe to retry.
Comment lists use the same connection pattern as catalog lists. See Pagination.
Likes
Like/Unlike Content
# Like content by DID
mutation {
likeContent(id: "did:rad.live:content/feature/123") {
id
likes { count isLiked }
}
}
# Unlike content
mutation {
unlikeContent(id: "did:rad.live:content/feature/123") {
id
likes { count isLiked }
}
}ContentLikes Type
Every Likeable entity has a likes field:
| Field | Type | Description |
|---|---|---|
count | Int! | Total number of likes |
isLiked | Boolean! | Whether the current user has liked this |
likes is never null. When unauthenticated, it returns { count: 0, isLiked: false }.
Comments
List Comments
{
comments(contentId: "did:rad.live:content/feature/123", first: 20) {
totalCount
edges {
node {
id
body
author { id username }
createdAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}Create Comment
curl -X POST https://api.rad.live/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation { createComment(contentId: \"did:rad.live:content/feature/123\", body: \"Great video!\") { id body createdAt } }"
}'const response = await fetch('https://api.rad.live/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
query: `
mutation {
createComment(
contentId: "did:rad.live:content/feature/123"
body: "Great video!"
) {
id body createdAt
}
}
`,
}),
});response = requests.post(
"https://api.rad.live/graphql",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
},
json={
"query": """
mutation {
createComment(
contentId: "did:rad.live:content/feature/123"
body: "Great video!"
) {
id body createdAt
}
}
"""
},
)Inline Comments on Content
All Commentable entities support inline comment queries:
{
feature(id: "did:rad.live:content/feature/123") {
commentCount
isCommented
comments(first: 10) {
edges {
node {
id
body
author { username }
}
}
}
}
}Follows
Follow/Unfollow Channel
mutation {
followChannel(channel: "did:rad.live:channel/abc") {
ok
}
}
mutation {
unfollowChannel(channel: "did:rad.live:channel/abc") {
ok
}
}Check Follow Status
{
channel(id: "did:rad.live:channel/abc") {
followersCount
isFollowed
}
}List Followed Channels
{
me {
followedChannels {
id
metadata { name }
followersCount
}
}
}