Skip to content
On this page

Directus Cloud

Everything you need to start building. Provisioned in 90 seconds. Starting at $15/month.

Get Started

This is an auto-generated document to support extension builders understand the internal packages they can utilize. To find our written guides, tutorials, and API/SDK reference, check out our main docs .

Directus / @directus/sdk / rest / readPreset

Function: readPreset() ​

readPreset<Schema, TQuery>(key, query?): RestCommand<IfAny<Schema, Record<string, any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { bookmark: (...) | (...); collection: (...) | (...); color: (...) | (...); filter: (...) | (...); icon: (...) | (...); id: number; layout: (...) | (...); layout_options: (...) | (...); layout_query: (...) | (...); refresh_interval: (...) | (...); role: (...) | (...) | (...); search: (...) | (...); user: (...) | (...) | (...) }, "directus_presets" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { bookmark: (...) | (...); collection: (...) | (...); color: (...) | (...); filter: (...) | (...); icon: (...) | (...); id: number; layout: (...) | (...); layout_options: (...) | (...); layout_query: (...) | (...); refresh_interval: (...) | (...); role: (...) | (...) | (...); search: (...) | (...); user: (...) | (...) | (...) }, "directus_presets" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }, (...) extends (...) ? (...) : (...)>>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof UnpackList<IfAny<(...), (...), (...)>> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema>

Defined in: rest/commands/read/presets.ts:35

List an existing preset by primary key.

Type Parameters ​

• Schema

• TQuery extends Query<Schema, DirectusPreset<Schema>>

Parameters ​

key ​

DirectusPreset<Schema>["id"]

The primary key of the dashboard

query? ​

TQuery

The query parameters

Returns ​

RestCommand<IfAny<Schema, Record<string, any>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, UnpackList<IfAny<Schema, { bookmark: (...) | (...); collection: (...) | (...); color: (...) | (...); filter: (...) | (...); icon: (...) | (...); id: number; layout: (...) | (...); layout_options: (...) | (...); layout_query: (...) | (...); refresh_interval: (...) | (...); role: (...) | (...) | (...); search: (...) | (...); user: (...) | (...) | (...) }, "directus_presets" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }>>> extends FF ? MapFlatFields<UnpackList<IfAny<Schema, { bookmark: (...) | (...); collection: (...) | (...); color: (...) | (...); filter: (...) | (...); icon: (...) | (...); id: number; layout: (...) | (...); layout_options: (...) | (...); layout_query: (...) | (...); refresh_interval: (...) | (...); role: (...) | (...) | (...); search: (...) | (...); user: (...) | (...) | (...) }, "directus_presets" extends keyof (...) ? (...) extends (...) ? (...) : (...) : { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }>>, FieldsWildcard<UnpackList<IfAny<Schema, { bookmark: ...; collection: ...; color: ...; filter: ...; icon: ...; id: ...; layout: ...; layout_options: ...; layout_query: ...; refresh_interval: ...; role: ...; search: ...; user: ... }, (...) extends (...) ? (...) : (...)>>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof UnpackList<IfAny<(...), (...), (...)>> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema>

Returns a Preset object if a valid primary key was provided.

Throws ​

Will throw if key is empty