List Objects

Introduction

Getting lists of objects is handled by the list<Object Name> mutation. For example: listEpisode.

Get Object List

Getting a list of objects using the list<Object Name> query takes the following input:

InputDescription
languageThe language of the object to be returned
limitThe number of objects to be returned
next_tokenPage token
ignore_availabilityComing soon

And the response has the following fields:

Response FieldDescription
countThe number of objects in the result
next_tokenThe token for the next page of results. See pagination.
objectsThe response objects

The objects field in the list response allows you to specify the return fields of objects in the response.

List Request

query listEpisode {
  listEpisode {
    count
    objects {
      uid
      title
      synopsis
    }
  }
}

Response:

{
  "data": {
    "listEpisode": {
      "count": 5,
      "objects": [
        ...
        {
          "uid": "3f3687dc-268d-4dcc-9a22-51db7b41cc99",
          "title": "The Mandolorian - Episode 1",
          "synopsis": "An armored bounty hunter takes on a well-paying yet cryptic assignment."
        }
        ...
      ]
    }
  }
}

Get Next Paginated Data Page

Responses from the list endpoint are subject to pagination.

If a further page of objects is available a next_token can be included in the response. This next_token can then be supplied to the next request for the next page of results.

If a further page is not available, the next_token will be returned as null.

Initial request:

query listEpisode {
  listEpisode {
    next_token
    objects {
      uid
      title
      synopsis
    }
  }
}

Initial response:

{
  "data": {
    "listEpisode": {
      "next_token": "<next token>",
      "count": 10,
      "objects": [
        ...
        {
          "uid": "3f3687dc-268d-4dcc-9a22-51db7b41cc99",
          "title": "The Mandolorian - Episode 1",
          "synopsis": "An armored bounty hunter takes on a well-paying yet cryptic assignment."
        }
        ...
      ]
    }
  }
}

Subsequent request:

query listEpisode {
  listEpisode(next_token: "<next token from first request>") {
    objects {
      uid
      title
      synopsis
    }
    next_token
  }
}

Response:

{
  "data": {
    "listEpisode": {
      "next_token": null,
      "count": 8,
      "objects": [
        ...
        {
          "uid": "8c3705f4-6a6f-45ef-aa80-a53ec0d8b38b",
          "title": "The Mandolorian - Episode 2",
          "synopsis": "The adventure continues in this next chapter of this sweeping space saga"
        }
        ...
      ]
    }
  }
}

Limit response size

All responses from the list<Object Name> response are limited on the number of results that are returned.

The default limit for a single page of objects is 10, and the default maximum is 50.

The user can change the limit to return more or less objects in a page, but attempted to get more than the maximum number of objects will just limit to that maximum.

Request:

query listEpisode {
  listEpisode(limit: 5) {
    objects {
      uid
      title
      synopsis
    }
  }
}

Response:

{
  "data": {
    "listEpisode": {
      "count": 5,
      "objects": [
        ...
        {
          "uid": "3f3687dc-268d-4dcc-9a22-51db7b41cc99",
          "title": "The Mandolorian - Episode 1",
          "synopsis": "An armored bounty hunter takes on a well-paying yet cryptic assignment."
        }
        ...
      ]
    }
  }
}