Clear the Internal Cache

Resets the data cache of Directus. Optionally, can also clear system cache. This endpoint is only available to admin users.

Query Parameters

system
boolean

Clear the system cache as well

Responses

Successful request
POST/utils/cache/clear
import { createDirectus, rest, clearCache } from '@directus/sdk';

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

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

Export Data to a File

Export a larger data set to a file in the file library.

Query Parameters

collection
string

Collection identifier

Request Body

[undefined]

Responses

Successful request
POST/utils/export/{collection}
import { createDirectus, rest, utilsExport } from '@directus/sdk';

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

const result = await client.request(
	utilsExport(
		'collection_name',
		'file_format',
		{
			query_type: {
				field: {
					query_operation: 'value',
				},
			},
		},
		{
			file: {
				file_field: 'value',
			},
		}
	)
);

Generate a Hash.

Generate a hash for a given string.

Request Body

[undefined]

Responses

Successful request
data
string
POST/utils/hash/generate
import { createDirectus, rest, generateHash } from '@directus/sdk';

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

const result = await client.request(generateHash(string_to_hash));
Response Example
{
  "data": "$argon2i$v=19$m=4096,t=3,p=1$pOyIa/zmRAjCVLb2f7kOyg$DasoO6LzMM+6iKfzCDq6JbsYsZWLSm33p7i9NxL9mDc"
}

Verify a Hash.

Verify a string with a hash.

Request Body

[undefined]

Responses

Successful request
data
boolean
POST/utils/hash/verify
import { createDirectus, rest, verifyHash } from '@directus/sdk';

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

const result = await client.request(verifyHash(string_to_verify, hash));
Response Example
{
  "data": true
}

Import Data from File

Import multiple records from a JSON or CSV file into a collection.

Query Parameters

collection
string

Collection identifier

Responses

Successful request
POST/utils/import/{collection}
import { createDirectus, rest, utilsImport } from '@directus/sdk';

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

const formData = new FormData();
formData.append('file', raw_file);

const result = await client.request(utilsImport(formData));

Get a Random String

Returns a random string of given length.

Query Parameters

length
integer

Length of the random string.

Responses

Successful request
data
string
GET/utils/random/string
import { createDirectus, rest, randomString } from '@directus/sdk';

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

const result = await client.request(randomString(length));
Response Example
{
  "data": "1>M3+4oh.S"
}

Manually Sort Items in Collection

Re-sort items in collection based on start and to value of item.

Query Parameters

collection
string

Collection identifier

Request Body

[undefined]

Responses

Successful request
POST/utils/sort/{collection}
import { createDirectus, rest, utilitySort } from '@directus/sdk';

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

const result = await client.request(utilitySort(collection_name, id_item_to_move, id_item_moving_to));