Query

User:

DLive user type has username and displayname which are both unique. username refers to the blockchain username and displayname refers to the displayname used everywhere in DLive. Users could change their displayname once a month but username could never be changed. Treat username as user ID.

There are two entry point queries for User: user(username:) and userByDisplayName(displayname:)

Sample

Sample GraphQL query which returns some basic info:

query{
    userByDisplayName(displayname:"Potato") {
        username
        displayname
        avatar
        partnerStatus
        followers {
            totalCount
        }
    }
}

Your could use a GraphQL client library to send the request or it could be translated to a plain curl request:

curl 'https://graphigo.prd.dlive.tv/' --data-binary '{"query":"query{userByDisplayName(displayname: \"Potato\") {username displayname avatar partnerStatus followers{totalCount}}}"}'

The response would be in the following format:

{
  "data": {
    "userByDisplayName": {
      "username": "dbl-lee",
      "displayname": "Potato",
      "avatar": "https://images.prd.dlivecdn.com/avatar/56dfd12a-4998-11e9-97f0-0eb3a818c822",
      "partnerStatus": "NONE",
      "followers": {
        "totalCount": 170
      }
    }
  }
}

Variable

You may want to reuse the query with different inputs:

query sampleQuery($displayname: String!){
    userByDisplayName(displayname:$displayname) {
        username
        displayname
        avatar
        partnerStatus
        followers {
            totalCount
        }
    }
}

which translates to curl request:

curl 'https://graphigo.prd.dlive.tv/' --data-binary '{"operationName":"sampleQuery","variables":{"displayname":"Potato"},"query":"query sampleQuery($displayname: String!) {userByDisplayName(displayname: $displayname) {username displayname avatar partnerStatus followers{totalCount}}}"}'

Nested query

If a field is of type User like list field in followers subfield, you could query information of the users in one query:

query{
    userByDisplayName(displayname:"Potato") {
        username
        displayname
        avatar
        partnerStatus
        followers(first: 5) {
            totalCount
            list {
                username
                displayname
                avatar
            }
        }
    }
}

which returns data:

{
  "data": {
    "userByDisplayName": {
      "username": "dbl-lee",
      "displayname": "Potato",
      "avatar": "https://images.prd.dlivecdn.com/avatar/56dfd12a-4998-11e9-97f0-0eb3a818c822",
      "partnerStatus": "NONE",
      "followers": {
        "totalCount": 170,
        "list": [
          {
            "username": "dlive-45601904",
            "displayname": "SweetCakes",
            "avatar": "https://images.prd.dlivecdn.com/avatar/6f5bb99c-824a-11e9-a9d7-9a767b854a09"
          },
          {
            "username": "greatkris",
            "displayname": "greatkris",
            "avatar": "https://images.prd.dlivecdn.com/avatar/e943de8c-f59f-11e8-aa1d-d22472f442c9"
          },
          {
            "username": "dlive-23624498",
            "displayname": "CaptainJackedPickle",
            "avatar": "https://images.prd.dlivecdn.com/avatar/8440ac7a-82f3-11e9-a9d7-9a767b854a09"
          },
          {
            "username": "bama256",
            "displayname": "BAMA256",
            "avatar": "https://images.prd.dlivecdn.com/avatar/a02c2bab-84aa-11e9-a9d7-9a767b854a09"
          },
          {
            "username": "cjrodriguez",
            "displayname": "THEONE2187",
            "avatar": "https://images.prd.dlivecdn.com/thumbnail/ab9d883e-30aa-11e9-9f23-8ec705f1dd1b"
          }
        ]
      }
    }
  }
}

But note that, we do have a limit on complexity of the query and a too complex query would receive an HTTP error with code 422.

Me

To obtain user information from an access token. Use me query with user access token in authorization header. Note that some private info need specific scope and if you don't have required scope an error will be returned.

Sample:

query {
    me {
        username
        displayname
        private {
            email // which requires email:read scope
            phone // which requires phone:read scope
        }
    }
}

Livestream

livestream field in user type indicates whether the user is streaming and corresponding livestream info. null means the user is offline.

Last updated