Fetch a resource by id.

const resource = await drupal.getResource<T = JsonApiResource>(
options?: {
): Promise<T>
  • type: string
    • Required
    • The resource type. Example: node--article, taxonomy_term--tags, or block_content--basic.
  • uuid: string
    • Required
    • The id of the resource. Example: 15486935-24bf-4be7-b858-a5b2de78d09d.
  • options
    • Optional
    • params: JsonApiParams: JSON:API params such as filter, fields, include or sort.
    • withAuth: boolean | DrupalClientAuth:
      • Set the authentication method to use. See the authentication docs.
      • Set to true to use the authentication method configured on the client.
    • deserialize: boolean: Set to false to return the raw JSON:API response.
    • locale: string: The locale to fetch the resource in.
    • defaultLocale: string: The default locale of the site.
    • withCache: boolean: Set withCache if you want to store and retrieve the resource from cache.
    • cacheKey: string: The cache key to use.


  • Get a page by uuid.
const node = await drupal.getResource(
  • Get the es translation for a page by uuid.
const node = await drupal.getResource(
locale: "es",
defaultLocale: "en",
  • Get the raw JSON:API response.
const { data, meta, links } = await drupal.getResource(
deserialize: false,
  • Get a node--article resource using cache.
const id = "07464e9f-9221-4a4f-b7f2-01389408e6c8"
const menu = await drupal.getResource("node--article", id, {
withCache: true,
cacheKey: `node--article:${id}`,


  • Using DrupalNode for a node entity type.
import { DrupalNode } from "next-drupal"
const node = await drupal.getResource<DrupalNode>(
  • Using DrupalTaxonomyTerm for a taxonomy term entity type.
import { DrupalTaxonomyTerm } from "next-drupal"
const term = await drupal.getResource<DrupalTaxonomyTerm>(

See the TypeScript docs for more built-in types.