Class NextDrupalPages

The NextDrupalPages class extends the NextDrupal class and provides methods for interacting with a Drupal backend in the context of Next.js pages.

Hierarchy (View Summary)

Constructors

  • Instantiates a new NextDrupalPages.

    const client = new NextDrupalPages(baseUrl)

    Parameters

    • baseUrl: string

      The baseUrl of your Drupal site. Do not add the /jsonapi suffix.

    • options: DrupalClientOptions = {}

      Options for the client. See Experiment_DrupalClientOptions.

    Returns NextDrupalPages

Properties

accessToken?: AccessToken
baseUrl: string
cache?: DataCache
deserializer: JsonDeserializer
fetcher?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

Type declaration

    • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
    • Parameters

      • input: RequestInfo | URL
      • Optionalinit: RequestInit

      Returns Promise<Response>

frontPage: string
getPathsFromContext: (
    types: string | string[],
    context: GetStaticPathsContext,
    options?: { params?: JsonApiParams; pathPrefix?: string } & JsonApiWithAuthOption,
) => Promise<(string | { locale?: string; params: { slug: string[] } })[]> = ...

Type declaration

    • (
          types: string | string[],
          context: GetStaticPathsContext,
          options?: { params?: JsonApiParams; pathPrefix?: string } & JsonApiWithAuthOption,
      ): Promise<(string | { locale?: string; params: { slug: string[] } })[]>
    • Gets static paths from the context.

      Parameters

      • types: string | string[]

        The resource types. Example: node--article or ["taxonomy_term--tags", "user--user"].

      • context: GetStaticPathsContext

        The context from getStaticPaths.

      • Optionaloptions: { params?: JsonApiParams; pathPrefix?: string } & JsonApiWithAuthOption

        Options for the request.

      Returns Promise<(string | { locale?: string; params: { slug: string[] } })[]>

      The static paths.

      Return static paths for node--page resources

      export async function getStaticPaths(context) {
      return {
      paths: await drupal.getStaticPathsFromContext("node--page", context),
      fallback: "blocking",
      }
      }

      Return static paths for node--page and node--article resources

      export async function getStaticPaths(context) {
      return {
      paths: await drupal.getStaticPathsFromContext(
      ["node--page", "node--article"],
      context
      ),
      fallback: "blocking",
      }
      }
isDebugEnabled: boolean
logger: Logger
throwJsonApiErrors: boolean
useDefaultEndpoints: boolean
withAuth: boolean

Accessors

  • get apiPrefix(): string
  • Returns string

  • set apiPrefix(apiPrefix: string): void
  • Parameters

    • apiPrefix: string

    Returns void

  • get auth(): NextDrupalAuth
  • Returns NextDrupalAuth

  • set auth(auth: NextDrupalAuth): void
  • Parameters

    Returns void

  • get headers(): HeadersInit
  • Returns HeadersInit

  • set headers(headers: HeadersInit): void
  • Parameters

    • headers: HeadersInit

    Returns void

  • get token(): AccessToken
  • Returns AccessToken

  • set token(token: AccessToken): void
  • Parameters

    Returns void

Methods

  • Adds a locale prefix to the given path.

    Parameters

    • path: string

      The path.

    • options: { defaultLocale?: string; locale?: string } = {}

      The options for adding the locale prefix.

      • OptionaldefaultLocale?: string

        The default locale.

      • Optionallocale?: string

        The locale.

    Returns string

    The path with the locale prefix.

  • Builds an endpoint URL for the specified parameters.

    Parameters

    • params: { locale?: string; path?: string; searchParams?: EndpointSearchParams } & {
          resourceType?: string;
      } = {}

      The parameters for the endpoint.

    Returns Promise<string>

    The built endpoint URL.

  • Parameters

    Returns DrupalMenuTree

  • Builds static paths from resources.

    Parameters

    • resources: { path: DrupalPathAlias }[]

      The resources.

    • Optionaloptions: { locale?: string; pathPrefix?: string }

      Options for the request.

    Returns { params: { slug: string[] } }[]

    The built static paths.

  • Builds static paths parameters from paths.

    Parameters

    • paths: string[]

      The paths.

    • Optionaloptions: { locale?: string; pathPrefix?: string }

      Options for the request.

    Returns { params: { slug: string[] } }[]

    The built static paths parameters.

  • Builds a URL with the given path and search parameters.

    Parameters

    • path: string

      The path for the url. Example: "/example"

    • OptionalsearchParams: EndpointSearchParams

      Optional query parameters.

    Returns URL

    The constructed URL.

    const drupal = new DrupalClient("https://example.com")

    // https://drupal.org
    drupal.buildUrl("https://drupal.org").toString()

    // https://example.com/foo
    drupal.buildUrl("/foo").toString()

    // https://example.com/foo?bar=baz
    client.buildUrl("/foo", { bar: "baz" }).toString()

    Build a URL from DrupalJsonApiParams

    const params = {
    getQueryObject: () => ({
    sort: "-created",
    "fields[node--article]": "title,path",
    }),
    }

    // https://example.com/jsonapi/node/article?sort=-created&fields%5Bnode--article%5D=title%2Cpath
    drupal.buildUrl("/jsonapi/node/article", params).toString()
  • Constructs a path from the given segment and options.

    Parameters

    • segment: string | string[]

      The path segment.

    • options: { defaultLocale?: string; locale?: string; pathPrefix?: string } = {}

      The options for constructing the path.

      • OptionaldefaultLocale?: string

        The default locale.

      • Optionallocale?: string

        The locale.

      • OptionalpathPrefix?: string

        The path prefix.

    Returns string

    The constructed path.

  • Creates a new file resource for the specified media type.

    Type Parameters

    Parameters

    • type: string

      The type of the resource. In most cases this is file--file.

    • body: JsonApiCreateFileResourceBody

      The body payload with data.

      • type: The resource type of the host entity. Example: media--image
      • field: The name of the file field on the host entity. Example: field_media_image
      • filename: The name of the file with extension. Example: avatar.jpg
      • file: The file as a Buffer
    • Optionaloptions: JsonApiOptions & JsonApiWithNextFetchOptions

      Options for the request.

    Returns Promise<T>

    The created file resource.

    Create a file resource for a media--image entity

    const file = await drupal.createFileResource("file--file", {
    data: {
    attributes: {
    type: "media--image", // The type of the parent resource
    field: "field_media_image", // The name of the field on the parent resource
    filename: "filename.jpg",
    file: await fs.readFile("/path/to/file.jpg"),
    },
    },
    })

    You can then use this to create a new media--image with a relationship to the file:

    const media = await drupal.createResource<DrupalMedia>("media--image", {
    data: {
    attributes: {
    name: "Name for the media",
    },
    relationships: {
    field_media_image: {
    data: {
    type: "file--file",
    id: file.id,
    },
    },
    },
    },
    })
  • Creates a new resource of the specified type.

    Type Parameters

    Parameters

    Returns Promise<T>

    The created resource.

    Create a node--page resource

    const page = await drupal.createResource("node--page", {
    data: {
    attributes: {
    title: "Page Title",
    body: {
    value: "<p>Content of body field</p>",
    format: "full_html",
    },
    },
    },
    })

    Create a node--article with a taxonomy term

    const article = await drupal.createResource("node--article", {
    data: {
    attributes: {
    title: "Title of Article",
    body: {
    value: "<p>Content of body field</p>",
    format: "full_html",
    },
    },
    relationships: {
    field_category: {
    data: {
    type: "taxonomy_term--category",
    id: "28ab9f26-927d-4e33-9510-b59a7ccdafe6",
    },
    },
    },
    },
    })

    Using filters

    const page = await drupal.createResource(
    "node--page",
    {
    data: {
    attributes: {
    title: "Page Title",
    body: {
    value: "<p>Content of body field</p>",
    format: "full_html",
    },
    },
    },
    },
    {
    params: {
    "fields[node--page]": "title,path",
    },
    }
    )

    Using TypeScript with DrupalNode

    import { DrupalNode } from "next-drupal"
    const page = await drupal.createResource<DrupalNode>("node--page", {
    data: {
    attributes: {
    title: "Page Title",
    body: {
    value: "<p>Content of body field</p>",
    format: "full_html",
    },
    },
    },
    })
  • Logs a debug message if debug mode is enabled.

    Parameters

    • message: any

      The debug message.

    Returns void

  • Deletes an existing resource of the specified type.

    Parameters

    • type: string

      The type of the resource. Example: node--article, taxonomy_term--tags, or block_content--basic.

    • uuid: string

      The resource id. Example: a50ffee7-ba94-46c9-9705-f9f8f440db94.

    • Optionaloptions: JsonApiOptions & JsonApiWithNextFetchOptions

      Options for the request.

    Returns Promise<boolean>

    True if the resource was deleted, false otherwise.

    Delete a node--page resource

    const isDeleted = await drupal.deleteResource(
    "node--page",
    "a50ffee7-ba94-46c9-9705-f9f8f440db94"
    )
  • Deserializes the response body.

    Parameters

    • body: any

      The response body.

    • Optionaloptions: any

      Options for deserialization.

    Returns TJsonaModel | TJsonaModel[]

    The deserialized response body.

    To provide your own custom deserializer, see the serializer docs.

    const url = drupal.buildUrl("/jsonapi/node/article", {
    sort: "-created",
    "fields[node--article]": "title,path",
    })

    const response = await drupal.fetch(url.toString())
    const json = await response.json()

    const resource = drupal.deserialize(json)
  • Fetches a resource from the given input URL or path.

    Parameters

    • input: RequestInfo

      The url to fetch from.

    • init: FetchOptions = {}

      The fetch options with withAuth. If withAuth is set, fetch will fetch an Authorization header before making the request.

    Returns Promise<Response>

    The fetch response.

    To provide your own custom fetcher, see the fetcher docs.

    const url = drupal.buildUrl("/jsonapi/node/article", {
    sort: "-created",
    "fields[node--article]": "title,path",
    })

    const response = await drupal.fetch(url.toString())
  • Fetches the endpoint URL for the specified resource type.

    Parameters

    • type: string

      The type of the resource.

    • Optionallocale: string

      The locale for the request.

    Returns Promise<URL>

    The fetched endpoint URL.

  • Retrieve an access token.

    Parameters

    Returns Promise<AccessToken>

    The access token.

    If options is not provided, DrupalClient will use the clientId and clientSecret configured in auth.

    const accessToken = await drupal.getAccessToken({
    clientId: "7034f4db-7151-466f-a711-8384bddb9e60",
    clientSecret: "d92Fm^ds",
    })
  • Gets the authentication configuration from the context and options.

    Parameters

    • context: GetStaticPropsContext

      The static props context.

    • options: JsonApiWithAuthOption

      Options for the request.

    Returns boolean | NextDrupalAuth

    The authentication configuration.

  • Gets the authorization header value based on the provided auth configuration.

    Parameters

    Returns Promise<string>

    The authorization header value.

  • Get the JSON:API entry for a resource type.

    Parameters

    • resourceType: string

      The resource type. Example: node--article.

    • Optionallocale: string

      Optional. The locale to fetch the index. Example: es or fr.

    Returns Promise<string>

    The entry point URL.

    By default, when retrieving resources in getResource or getResourceCollection, the DrupalClient make a request to Drupal to fetch the JSON:API resource entry.

    Example: if you provide node--article, DrupalClient will make a request to http://example.com/jsonapi/node/article.

    If you would like to infer the entry from the resource type, use the useDefaultResourceTypeEntry option:

    const drupal = new DrupalClient(process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, {
    useDefaultResourceTypeEntry: true,
    })
    // https://example.com/jsonapi/node/article
    const url = await drupal.getEntryForResourceType(`node--article`)
  • Extracts errors from the fetch response.

    Parameters

    • response: Response

      The fetch response.

    Returns Promise<string | JsonApiError[]>

    The extracted errors.

  • Fetches a menu by its name.

    Type Parameters

    Parameters

    Returns Promise<{ items: T[]; tree: T[] }>

    The fetched menu.

    • items: An array of DrupalMenuLinkContent
    • tree: An array of DrupalMenuLinkContent with children nested to match the hierarchy from Drupal

    JSON:API Menu Items module

    Get the main menu

    const { menu, items } = await drupal.getMenu("main")
    

    Get the main menu using cache

    const menu = await drupal.getMenu("main", {
    withCache: true,
    cacheKey: "menu--main",
    })
  • Return the path (slug) from getStaticProps or getServerSideProps context.

    Parameters

    • context: GetStaticPropsContext

      The context from getStaticProps or getServerSideProps.

    • Optionaloptions: { pathPrefix?: string }

      Options for the request.

    Returns string

    The constructed path.

    Get the path (slug) from getStaticProps context

    export async function getStaticProps(context) {
    const slug = await drupal.getPathFromContext(context)
    }
  • Fetches a resource of the specified type by its UUID.

    Type Parameters

    Parameters

    Returns Promise<T>

    The fetched resource.

    Get a page by uuid.

    const node = await drupal.getResource(
    "node--page",
    "07464e9f-9221-4a4f-b7f2-01389408e6c8"
    )

    Get the es translation for a page by uuid.

    const node = await drupal.getResource(
    "node--page",
    "07464e9f-9221-4a4f-b7f2-01389408e6c8",
    {
    locale: "es",
    defaultLocale: "en",
    }
    )

    Get the raw JSON:API response.

    const { data, meta, links } = await drupal.getResource(
    "node--page",
    "07464e9f-9221-4a4f-b7f2-01389408e6c8",
    {
    deserialize: false,
    }
    )

    Get a node--article resource using cache.

    const id = "07464e9f-9221-4a4f-b7f2-01389408e6c8"

    const article = await drupal.getResource("node--article", id, {
    withCache: true,
    cacheKey: `node--article:${id}`,
    })

    Get a page resource with time-based revalidation.

    const node = await drupal.getResource(
    "node--page",
    "07464e9f-9221-4a4f-b7f2-01389408e6c8",
    { next: { revalidate: 3600 } }
    )

    Get a page resource with tag-based revalidation.

    const {slug} = params;
    const path = drupal.translatePath(slug)

    const type = path.jsonapi.resourceName
    const tag = `${path.entity.type}:${path.entity.id}`

    const node = await drupal.getResource(path, path.entity.uuid, {
    params: params.getQueryObject(),
    tags: [tag]
    })

    Using DrupalNode for a node entity type.

    import { DrupalNode } from "next-drupal"

    const node = await drupal.getResource<DrupalNode>(
    "node--page",
    "07464e9f-9221-4a4f-b7f2-01389408e6c8"
    )

    Using DrupalTaxonomyTerm for a taxonomy term entity type.

    import { DrupalTaxonomyTerm } from "next-drupal"

    const term = await drupal.getResource<DrupalTaxonomyTerm>(
    "taxonomy_term--tags",
    "7b47d7cc-9b1b-4867-a909-75dc1d61dfd3"
    )
  • Fetches a resource of the specified type by its path.

    Type Parameters

    Parameters

    • path: string

      The path of the resource. Example: /blog/slug-for-article.

    • Optionaloptions: { isVersionable?: boolean } & (JsonApiOptions & JsonApiWithNextFetchOptions)

      Options for the request.

      • isVersionable: Set to true if you're fetching the revision for a resource. Automatically set to true for node entity types

    Returns Promise<T>

    The fetched resource.

    Decoupled Router module

    Get a page by path

    const node = await drupal.getResourceByPath("/blog/slug-for-article")
    

    Get the raw JSON:API response

    const { data, meta, links } = await drupal.getResourceByPath(
    "/blog/slug-for-article",
    {
    deserialize: false,
    }
    )

    Using DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"
    const node = await drupal.getResourceByPath<DrupalNode>(
    "/blog/slug-for-article"
    )
  • Fetches a collection of resources of the specified type.

    Type Parameters

    Parameters

    • type: string

      The type of the resources. Example: node--article or user--user.

    • Optionaloptions: { deserialize?: boolean } & (JsonApiOptions & JsonApiWithNextFetchOptions)

      Options for the request.

      • deserialize: Set to false to return the raw JSON:API response

    Returns Promise<T>

    The fetched collection of resources.

    Get all articles

    const articles = await drupal.getResourceCollection("node--article")
    

    Using filters

    const publishedArticles = await drupal.getResourceCollection("node--article", {
    params: {
    "filter[status]": "1",
    },
    })

    Get the raw JSON:API response

    const { data, meta, links } = await drupal.getResourceCollection("node--page", {
    deserialize: false,
    })

    Using TypeScript with DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"
    const nodes = await drupal.getResourceCollection<DrupalNode[]>("node--article")
  • Gets a collection of resources from the context.

    Type Parameters

    Parameters

    • type: string

      The type of the resources. Example: node--article or user--user.

    • context: GetStaticPropsContext

      The static props context from getStaticProps or getServerSideProps.

    • Optionaloptions: { deserialize?: boolean } & JsonApiOptions

      Options for the request.

      • deserialize: Set to false to return the raw JSON:API response

    Returns Promise<T>

    The fetched collection of resources.

    The localized resources will be fetched based on the locale and defaultLocale values from context.

    Get all articles from context

    export async function getStaticProps(context) {
    const articles = await drupal.getResourceCollectionFromContext(
    "node--article",
    context
    )

    return {
    props: {
    articles,
    },
    }
    }

    Using TypeScript with DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"
    const nodes = await drupal.getResourceCollectionFromContext<DrupalNode[]>(
    "node--article",
    context
    )
  • Fetches path segments for a collection of resources of the specified types.

    Parameters

    • types: string | string[]

      The types of the resources.

    • Optionaloptions: { params?: JsonApiParams; pathPrefix?: string } & JsonApiWithAuthOption & (
          JsonApiWithNextFetchOptions & ({ locales: string[]; defaultLocale: string; } | { locales?: undefined; defaultLocale?: never; })
      )

      Options for the request.

    Returns Promise<{ locale: string; path: string; segments: string[]; type: string }[]>

    The fetched path segments.

  • Gets a resource from the context.

    Type Parameters

    Parameters

    • input: string | DrupalTranslatedPath

      Either a resource type (e.g. "node--article") or a translated path from translatePath().

    • context: GetStaticPropsContext

      The Next.js context from getStaticProps.

    • Optionaloptions: { isVersionable?: boolean; pathPrefix?: string } & JsonApiOptions

      Options for the request.

      • OptionalisVersionable?: boolean

        Whether the resource is versionable (defaults to false for all entity types except nodes).

      • OptionalpathPrefix?: string

        The path prefix to use for the request (defaults to "/").

    Returns Promise<T>

    The fetched resource.

    The localized resource will be fetched based on the locale and defaultLocale values from context.

    If you pass in a DrupalTranslatedPath for input, getResourceFromContext will take the type and id from the path and make a getResource call to Drupal:

    export async function getStaticProps(context) {
    const path = await drupal.translatePathFromContext(context)

    const node = await drupal.getResourceFromContext(path, context)

    return {
    props: {
    node,
    },
    }
    }

    If you pass in a string input, such as node--article, getResourceFromContext will make a subrequest call to Drupal to translate the path and then fetch the resource. You will need both the Subrequests and Decoupled Router modules:

    export async function getStaticProps(context) {
    const node = await drupal.getResourceFromContext("node--article", context)

    return {
    props: {
    node,
    },
    }
    }

    Fetch a resource from context.

    export async function getStaticProps(context) {
    const node = await drupal.getResourceFromContext("node--page", context)

    return {
    props: {
    node,
    },
    }
    }

    Fetch a resource from context in a sub directory.

    export async function getStaticProps(context) {
    const node = await drupal.getResourceFromContext("node--page", context, {
    pathPrefix: "/articles",
    })

    return {
    props: {
    node,
    },
    }
    }

    Using DrupalNode type:

    import { DrupalNode } from "next-drupal"

    const node = await drupal.getResourceFromContext<DrupalNode>(
    "node--page",
    context
    )

    Using DrupalTaxonomyTerm type:

    import { DrupalTaxonomyTerm } from "next-drupal"

    const term = await drupal.getResourceFromContext<DrupalTaxonomyTerm>(
    "taxonomy_term--tags",
    context
    )

    https://next-drupal.org/docs/typescript for more built-in types.

  • Fetches a search index by its name.

    Type Parameters

    Parameters

    Returns Promise<T>

    The fetched search index.

    JSON:API Search API module

    Get search results from an index named articles

    const results = await drupal.getSearchIndex("articles")
    

    Using TypeScript with DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"

    const results = await drupal.getSearchIndex<DrupalNode>("articles")
  • Gets a search index from the context.

    Type Parameters

    Parameters

    • name: string

      The name of the search index.

    • context: GetStaticPropsContext

      The static props context.

    • Optionaloptions: JsonApiOptions

      Options for the request.

    Returns Promise<T>

    The fetched search index.

  • Gets static paths from the context.

    Parameters

    • types: string | string[]

      The resource types. Example: node--article or ["taxonomy_term--tags", "user--user"].

    • context: GetStaticPathsContext

      The context from getStaticPaths.

    • Optionaloptions: { params?: JsonApiParams; pathPrefix?: string } & JsonApiWithAuthOption

      Options for the request.

    Returns Promise<(string | { locale?: string; params: { slug: string[] } })[]>

    The static paths.

    Return static paths for node--page resources

    export async function getStaticPaths(context) {
    return {
    paths: await drupal.getStaticPathsFromContext("node--page", context),
    fallback: "blocking",
    }
    }

    Return static paths for node--page and node--article resources

    export async function getStaticPaths(context) {
    return {
    paths: await drupal.getStaticPathsFromContext(
    ["node--page", "node--article"],
    context
    ),
    fallback: "blocking",
    }
    }
  • Fetches a view by its name.

    Type Parameters

    Parameters

    Returns Promise<DrupalView<T>>

    The fetched view.

    JSON:API Views module

    Get a view named articles and display id promoted

    const view = await drupal.getView("articles--promoted")
    

    Using sparse fieldsets to only fetch the title and body fields

    const view = await drupal.getView("articles--promoted", {
    params: {
    fields: {
    "node--article": "title,body",
    },
    },
    })

    Using TypeScript with DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"

    const view = await drupal.getView<DrupalNode>("articles--promoted")
  • Logs or throws an error based on the throwJsonApiErrors flag.

    Parameters

    • error: Error

      The error to log or throw.

    Returns void

  • Handle preview mode for resources.

    Parameters

    • request: NextApiRequest

      The request from an API route.

    • response: NextApiResponse

      The response from an API route.

    • Optionaloptions: { enable: boolean }

      Options for the request.

    Returns Promise<void | NextApiResponse>

    The preview method should be called in an API route. Remember to set a previewSecret on the client.

    // lib/drupal.ts
    export const drupal = new DrupalClient(
    process.env.NEXT_PUBLIC_DRUPAL_BASE_URL,
    {
    previewSecret: process.env.DRUPAL_PREVIEW_SECRET,
    }
    )
    // pages/api/preview.ts
    import { drupal } from "lib/drupal"

    export default async function handler(req, res) {
    return await drupal.preview(req, res)
    }
  • Disables preview mode.

    Parameters

    • request: NextApiRequest

      The API request.

    • response: NextApiResponse

      The API response.

    Returns Promise<void>

  • Throws an error if the response contains JSON:API errors.

    Parameters

    • response: Response

      The fetch response.

    • messagePrefix: string = ""

      The error message prefix.

    Returns Promise<void>

    The JSON:API errors.

  • Translates a path from the context.

    Parameters

    • context: GetStaticPropsContext

      The context from getStaticProps or getServerSideProps.

    • Optionaloptions: { pathPrefix?: string } & JsonApiWithAuthOption

      Options for the request.

    Returns Promise<DrupalTranslatedPath>

    The translated path.

    Decoupled Router module

    Get info about a path from getStaticProps context

    export async function getStaticProps(context) {
    const path = await drupal.translatePathFromContext(context)
    }
  • Updates an existing resource of the specified type.

    Type Parameters

    Parameters

    Returns Promise<T>

    The updated resource.

    Update a node--page resource

    const page = await drupal.updateResource(
    "node--page",
    "a50ffee7-ba94-46c9-9705-f9f8f440db94",
    {
    data: {
    attributes: {
    title: "Updated Title",
    },
    },
    }
    )

    Using TypeScript with DrupalNode for a node entity type

    import { DrupalNode } from "next-drupal"

    const page = await drupal.updateResource<DrupalNode>(
    "node--page",
    "a50ffee7-ba94-46c9-9705-f9f8f440db94",
    {
    data: {
    attributes: {
    title: "Updated Title",
    },
    },
    }
    )
  • Validates the draft URL using the provided search parameters.

    Parameters

    • searchParams: URLSearchParams

      The search parameters.

    Returns Promise<Response>

    The validation response.