mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
* Add Quickstart Guide * Update installation * Remove unused files * Update support/backing * Tweaks in concepts * Setup file structure for API reference 2.0 * Setup page layout for reference * Add clean-urls plugin * getting started updates * Finish authentication rest * getting started updates * Render stylus in 2 spaces * Various * Various * Finish activity docs * Add collections reference * Add extension reference * concepts updates * Fields/tweaks * Add files doc * Add revisions * concepts docs * More api reference * Finish rest api reference (finally) * initial concepts * More things * Add assets api ref * Move sections from file to assets * Add environment variables * contributing docs * Add field transforms page * Left align table headers * concept links * Add API config * Fix mobile nav * Add migrating a project * doc link fixes Co-authored-by: Ben Haynes <ben@rngr.org>
163 lines
1.6 KiB
Markdown
163 lines
1.6 KiB
Markdown
---
|
|
pageClass: page-reference
|
|
---
|
|
|
|
# Utilities
|
|
|
|
<div class="two-up">
|
|
<div class="left">
|
|
|
|
Various utilities.
|
|
|
|
</div>
|
|
<div class="right">
|
|
|
|
[[toc]]
|
|
|
|
</div>
|
|
</div>
|
|
|
|
---
|
|
|
|
## Generate a Hash
|
|
|
|
Generate a hash for a given string.
|
|
|
|
<div class="two-up">
|
|
<div class="left">
|
|
|
|
### Request Body
|
|
|
|
<div class="definitions">
|
|
|
|
`string` **Required**\
|
|
String to hash.
|
|
|
|
</div>
|
|
|
|
### Returns
|
|
|
|
Hashed string.
|
|
|
|
</div>
|
|
<div class="right">
|
|
|
|
### `POST /utils/hash/generate`
|
|
|
|
```json
|
|
// Request
|
|
|
|
{
|
|
"string": "Hello World!"
|
|
}
|
|
```
|
|
|
|
```json
|
|
// Response
|
|
|
|
{
|
|
"data": "$arg...fEfM"
|
|
}
|
|
```
|
|
|
|
</div>
|
|
</div>
|
|
|
|
---
|
|
|
|
## Verify a Hash
|
|
|
|
Verify a string with a hash.
|
|
|
|
<div class="two-up">
|
|
<div class="left">
|
|
|
|
### Request Body
|
|
|
|
<div class="definitions">
|
|
|
|
`string` **Required**\
|
|
Source string.
|
|
|
|
`hash` **Required**\
|
|
Hash you want to verify against.
|
|
|
|
</div>
|
|
|
|
### Returns
|
|
|
|
Boolean.
|
|
|
|
</div>
|
|
<div class="right">
|
|
|
|
### `POST /utils/hash/verify`
|
|
|
|
```json
|
|
// Request
|
|
|
|
{
|
|
"string": "Hello World!",
|
|
"hash": "$arg...fEfM"
|
|
}
|
|
```
|
|
|
|
```json
|
|
// Response
|
|
|
|
{
|
|
"data": true
|
|
}
|
|
```
|
|
|
|
</div>
|
|
</div>
|
|
|
|
---
|
|
|
|
## Manually Sort Items in Collection
|
|
|
|
If a collection has a sort field, this util can be used to move items in that manual order.
|
|
|
|
<div class="two-up">
|
|
<div class="left">
|
|
|
|
### Request Body
|
|
|
|
<div class="definitions">
|
|
|
|
`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.
|
|
|
|
</div>
|
|
|
|
### Returns
|
|
|
|
Empty body.
|
|
|
|
</div>
|
|
<div class="right">
|
|
|
|
### `POST /utils/sort/:collection`
|
|
|
|
```json
|
|
// Request
|
|
|
|
{
|
|
"item": 16,
|
|
"to": 51
|
|
}
|
|
```
|
|
|
|
```json
|
|
// Empty Response
|
|
```
|
|
|
|
</div>
|
|
</div>
|
|
|
|
---
|