Skip to content

GetOptions

Defined in: packages/json-api-client/src/types.ts:64

Options for customizing the get request.

optional cacheKey?: string;

Defined in: packages/json-api-client/src/types.ts:58

The cache key to use for the request. If not set, the default cache key of {lang}-{locale}--{entity}--{bundle}--{sha256 hash of query string if exists} will be used.

RequestBaseOptions.cacheKey


optional disableAuthentication?: boolean;

Defined in: packages/json-api-client/src/types.ts:53

Whether to disable the authentication for the request.

RequestBaseOptions.disableAuthentication


optional disableCache?: boolean;

Defined in: packages/json-api-client/src/types.ts:48

Whether to disable the cache for the request.

RequestBaseOptions.disableCache


optional includeFallback?: boolean;

Defined in: packages/json-api-client/src/types.ts:77

Defer a read whose locale translation does not exist to the site’s language fallback chain instead of failing strictly. Sent as includeFallback=1 alongside langCode; requires a backend with the jsonapi_multilingual module and a locale on the request (without a locale it is not sent). An individual read then always resolves for an existing entity, and a collection includes every item, each in its best available language. Without it, a backend with the module answers a missing translation strictly: 404 for an individual read (see getAvailableTranslations), exclusion and a meta.omitted report for collection items.


optional locale?: string;

Defined in: packages/json-api-client/src/types.ts:38

The locale to use for the request, targeting exactly one translation. Sent as the /{locale}/ URL path prefix (see JsonApiClientOptions.languagePathPrefix) and as the langCode query parameter, the jsonapi_multilingual module’s language selector. If not set, the default locale will be used. If no default locale is set, no locale will be used.

RequestBaseOptions.locale


optional queryString?: string;

Defined in: packages/json-api-client/src/types.ts:89

A URL encoded query string to append to the request. See https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module/fetching-resources-get for some examples of valid query strings.

To help generate a valid query string, use a library like drupal-jsonapi-params https://www.npmjs.com/package/drupal-jsonapi-params and the toQueryString method.

const options = {
queryString: "filter[title][value]=My%20recipe",
};

optional rawResponse?: boolean;

Defined in: packages/json-api-client/src/types.ts:43

Indicates whether the raw HTTP response should be returned. When set to true, the response will not be parsed or processed, providing the raw, unaltered response from the server.

RequestBaseOptions.rawResponse