Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Utilities → Generate Hash

AI-generated

Overview

The "Generate Hash" operation under the "Utilities" resource in this custom n8n node allows you to generate a cryptographic hash from a given input string using the Directus API. This is useful for scenarios where you need to securely store, compare, or verify sensitive data such as passwords, tokens, or any other information that should not be stored in plain text.

Practical examples:

  • Storing user passwords as hashes instead of plain text.
  • Generating unique identifiers or checksums for files or data.
  • Verifying data integrity by comparing hashes.

Properties

Name Type Meaning
String String The input string to be hashed. This is the value that will be sent to the Directus API to generate its hash.

Output

The output will be an object with a json field containing the result of the hash generation. The structure is as follows:

{
  "result": "<generated_hash_string>"
}
  • If the response from the API is a simple string, number, or boolean, it will be wrapped in a result property.
  • In case of errors (and if "Continue On Fail" is enabled), the output will contain an error property with the error message.

Dependencies

  • Directus API: Requires access to a running Directus instance with the appropriate endpoint enabled.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Missing or invalid credentials: Ensure your Directus API credentials are correctly set up in n8n.
  • Empty or invalid input string: The "String" property is required; leaving it empty will cause an error.
  • API connectivity issues: Network problems or incorrect API URLs can prevent successful requests.

Error messages and resolutions:

  • "Cannot read property 'message' of undefined": Likely due to missing or malformed input. Double-check the "String" property.
  • "401 Unauthorized": Check your API credentials.
  • "404 Not Found": The Directus instance may not have the hashing utility enabled or the endpoint URL is incorrect.

Links and References

Discussion