Files
directus/docs/reference/system/extensions.md
Pascal Jufer 2d3da357db Fix SnippetToggler group definitions (#20388)
* Fix SnippetToggler group definitions

* Ignore md files for linting
2023-11-10 19:54:49 +01:00

4.1 KiB

description, readTime, pageClass
description readTime pageClass
REST and GraphQL API documentation on the Extensions collection in Directus. 1 min read page-reference

Extensions

The extensions endpoints are used by the Admin App to retrieve what extensions to install. Learn more about Extensions.

The Extension Object

bundle string | null
Name of the bundle the extension is in.

name string
Unique name of the extension.

Meta

Directus metadata for the extension. Where the configuration for the extension in the current project is stored.

enabled boolean
Whether or not the extension is enabled.

Schema

Information about the installed extension. Can't be changed.

type string
Type of the extension. One of 'interface', 'display', 'layout', 'module', 'panel', 'hook', 'endpoint', 'operation', 'bundle'.

local boolean
Whether the extension exists in the local extensions folder or is loaded from node_modules.

{
  "name": "my-bundle-operation",
  "bundle": "directus-extension-my-bundle",
  "schema": {
    "type": "operation",
    "local": true
  },
  "meta": {
    "enabled": true
  }
}

List Extensions

List the installed extensions and their configuration in the project.

Request

GET /extensions/

POST /graphql/system

type Query {
	extensions: [extension]
}
import { createDirectus, rest, readExtensions } from '@directus/sdk';

const client = createDirectus('directus_project_url').with(rest());

const result = await client.request(readExtensions());

Query Parameters

This endpoint doesn't currently support any query parameters.

Response

An array of interface extension keys.

Example

GET /extensions/

POST /graphql/system

query {
	extensions {
		name
		type
	}
}
import { createDirectus, rest, readExtensions } from '@directus/sdk';

const client = createDirectus('https://directus.example.com').with(rest());

const result = await client.request(readExtensions());

Update an Extension

Update an existing extension.

Request

PATCH /extension/:bundleOrName/:name?

Provide a partial extension object as the body of your request.

POST /graphql/system

type Mutation {
	update_extensions_item(bundle: String, name: String!, data: update_directus_extensions_input!): directus_extensions
}
import { createDirectus, rest, updateExtension } from '@directus/sdk';

const client = createDirectus('directus_project_url').with(rest());

const result = await client.request(updateExtension(bundle, name, partial_extension_object));

Query Parameters

Doesn't support any query parameters.

Request Body

A partial extension object.

Response

Returns the extension object for the updated extension.

Example

PATCH /extensions/my-bundle/draw-interface

{
	"meta": {
		"enabled": false
	}
}

POST /graphql/system

mutation {
	update_extensions_item(bundle: null, name: "my-custom-display", data: { meta: { enabled: true } }) {
		name
		type
	}
}
import { createDirectus, rest, updateExtension } from '@directus/sdk';

const client = createDirectus('https://directus.example.com').with(rest());

const result = await client.request(
	updateExtension('directus-extension-bundle', 'stock-display', {
		meta: {
			enabled: false
		},
	})
);