Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Attribute → Create String

AI-generated

Overview

This node interacts with the Appwrite API to create a string attribute within a specified database collection. It is useful for defining schema attributes that store string data with configurable properties such as maximum length, whether the attribute is required, default values, and if the attribute should be an array. Practical applications include setting up database schemas for user profiles, product descriptions, or any other data requiring string attributes.

Use Case Examples

  1. Creating a 'username' attribute in a user database with a maximum length of 50 characters and marking it as required.
  2. Defining a 'tags' attribute as an array of strings to categorize documents in a collection.

Properties

Name Meaning
Database ID The ID of the database where the attribute will be created.
Collection ID The ID of the collection within the database where the attribute will be created.
Attribute Key The key or name of the attribute to be created.
Size The maximum length of the string attribute value.
Required Indicates whether the attribute is mandatory.
Default Value The default value assigned to the attribute if no value is provided.
Array Specifies if the attribute should hold an array of string values instead of a single string.

Output

JSON

  • attributeId - The unique identifier of the created attribute.
  • key - The key or name of the created attribute.
  • type - The data type of the attribute, which is string in this case.
  • size - The maximum length allowed for the string attribute.
  • required - Indicates if the attribute is required.
  • defaultValue - The default value set for the attribute.
  • array - Indicates whether the attribute is an array of strings.

Dependencies

  • Appwrite API key credential for authentication

Troubleshooting

  • Ensure the provided Database ID and Collection ID are correct and exist in the Appwrite project.
  • Verify that the API key has sufficient permissions to create attributes in the specified database and collection.
  • Check that the 'Size' property is a positive number and within allowed limits by Appwrite.
  • If the node throws an 'Unknown resource' error, confirm that the resource parameter is set to 'attribute' and the operation to 'createString'.
  • Network or authentication errors may occur if the endpoint, project ID, or API key are incorrect or expired.

Links

Discussion