ASDinCloudDocs

The snippet object

View as Markdown

Snippets save reusable text under a short, unique shortcut.

Attributes

idinteger
Identifier assigned by the API.
namestring
Name of the snippet, up to 191 characters.
shortcutstring
Unique shortcut, up to 64 characters. Use lowercase letters, digits, periods, underscores, or hyphens.
bodystring
Reusable text content.

List snippets

View as Markdown
GET/api/v1/snippets

Lists snippet records in the workspace.

Permissions

Send your API key in X-API-Key. Required permissions are Snippets → Read.

Query parameters

qstring
Search name, shortcut, or body.
lengthinteger
Number of records to return.
startinteger
Zero-based offset.
drawstring
Optional request marker echoed in the response.
sortstring
Sort by id, name, shortcut, tsc, or tsu. Prefix the field name with a minus sign for descending order.
orderstring
Direction for unprefixed sort fields. Use asc or desc.

Returns

Returns items in data, counts before and after text search, and the optional draw marker.

Errors

401
The API key is missing or invalid.
403
The API key lacks the required permission.

Retrieve a snippet

View as Markdown
GET/api/v1/snippets/{id}

Returns one snippet by ID.

Permissions

Send your API key in X-API-Key. Required permissions are Snippets → Read.

Path parameters

idintegerRequired
ID of the snippet.

Returns

The snippet is returned in data.

Errors

401
The API key is missing or invalid.
403
The API key lacks the required permission.
404
The requested record was not found.

Create a snippet

View as Markdown
POST/api/v1/snippets

Creates a snippet.

Permissions

Send your API key in X-API-Key. Required permissions are Snippets → Write.

Body parameters

namestringRequired
Name of the snippet, up to 191 characters.
shortcutstringRequired
Unique shortcut, up to 64 characters. Use lowercase letters, digits, periods, underscores, or hyphens.
bodystringRequired
Reusable text content.

Returns

The created snippet is returned in data.

Errors

401
The API key is missing or invalid.
403
The API key lacks the required permission.
400
The payload is invalid.
422
One or more fields failed validation.

Update a snippet

View as Markdown
PATCH / PUT / POST/api/v1/snippets/{id}

Updates a snippet by ID.

Permissions

Send your API key in X-API-Key. Required permissions are Snippets → Write.

Path parameters

idintegerRequired
ID of the snippet.

Body parameters

namestring
Name of the snippet, up to 191 characters.
shortcutstring
Unique shortcut, up to 64 characters. Use lowercase letters, digits, periods, underscores, or hyphens.
bodystring
Reusable text content.

An unchanged payload returns the message key entities.snippet.messages.no_changes.

Returns

Returns a successful update response.

Errors

401
The API key is missing or invalid.
403
The API key lacks the required permission.
404
The requested record was not found.
400
The payload is invalid.
422
One or more fields failed validation.

Delete a snippet

View as Markdown
DELETE/api/v1/snippets/{id}
POST/api/v1/snippets/{id}/delete

Deletes a snippet.

Permissions

Send your API key in X-API-Key. Required permissions are Snippets → Write.

Path parameters

idintegerRequired
ID of the snippet.

Returns

Returns a successful removal response.

Errors

401
The API key is missing or invalid.
403
The API key lacks the required permission.
404
The requested record was not found.
400
The record is in use or could not be removed.