Files
directus/docs/reference/api/rest/utilities.md
2021-02-08 17:31:07 -05:00

1.6 KiB

pageClass
pageClass
page-reference

Utilities

Utilities are the various helper endpoints located within the API.

toc


Generate a Hash

Generate a hash for a given string.

Request Body

string Required
String to hash.

Returns

Hashed string.

POST /utils/hash/generate
// Request

{
	"string": "Hello World!"
}
// Response

{
	"data": "$arg...fEfM"
}

Verify a Hash

Verify a string with a hash.

Request Body

string Required
Source string.

hash Required
Hash you want to verify against.

Returns

Boolean.

POST /utils/hash/verify
// Request

{
	"string": "Hello World!",
	"hash": "$arg...fEfM"
}
// Response

{
	"data": true
}

Manually Sort Items in Collection

If a collection has a sort field, this util can be used to move items in that manual order.

Request Body

item Required
Primary key of the item you're moving in the collection.

to Required
Primary key of the item you're moving the source item too.

Returns

Empty body.

POST /utils/sort/:collection
// Request

{
	"item": 16,
	"to": 51
}
// Empty Response