Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The "Utilities - Get a Random String" operation in this n8n node allows you to generate a random string of a specified length using the Directus API. This is useful in scenarios where you need unique identifiers, temporary passwords, tokens, or any other use case that requires a random alphanumeric string.
Practical examples:
- Generating a temporary password for a new user.
- Creating a unique token for session management.
- Producing random strings for testing or data anonymization.
Properties
Name | Type | Meaning |
---|---|---|
Additional Fields | Object | A collection of optional parameters. |
└─ Length | Number | The desired length of the generated random string (minimum value: 1). |
Output
The output will be an object with a json
field containing the result. The structure is as follows:
{
"result": "<random_string>"
}
- result: The randomly generated string of the specified length.
If the API response is not an object (e.g., a plain string), it will still be wrapped in a result
property for consistency.
Dependencies
- Directus API: Requires access to a Directus instance with the appropriate credentials configured in n8n (
directusApi
credential). - API Key/Token: The node must be authenticated to the Directus API.
Troubleshooting
Common issues:
- Missing Credentials: If the required Directus API credentials are not set up, the node will fail to execute.
- Invalid Length: If the "Length" parameter is not provided or is less than 1, the API may return an error or a default-length string.
- API Connectivity: Network or authentication errors with the Directus API will cause execution failures.
Error messages and resolutions:
"Cannot read property 'length' of undefined"
: Ensure that the "Additional Fields" collection is properly filled out and that "Length" is specified if needed."401 Unauthorized"
or similar: Check your Directus API credentials in n8n."Network Error"
: Verify connectivity between n8n and your Directus instance.