Actions181
- Account Actions
- Get Account
- Create Account
- Update Email
- Update Name
- Update Password
- Update Phone
- Update Status
- Get Preferences
- Update Preferences
- List Sessions
- Delete Sessions
- Get Session
- Update Session
- Delete Session
- Create Anonymous Session
- Create Email/Password Session
- Create Magic URL Session
- Create OAuth2 Session
- Create Phone Session
- Create Session from Token
- Create JWT
- Create Magic URL
- Create Phone Token
- Create Email Verification
- Update Email Verification
- Create Phone Verification
- Update Phone Verification
- Create Password Recovery
- Update Password Recovery
- Create Recovery
- Update Recovery
- Update MFA
- Create MFA Authenticator
- Update MFA Authenticator
- Delete MFA Authenticator
- Create MFA Challenge
- Update MFA Challenge
- Attribute Actions
- Avatars Actions
- Collection Actions
- Database Actions
- Document Actions
- Functions Actions
- Index Actions
- Locale Actions
- Messaging Actions
- Sites Actions
- Storage Actions
- Teams Actions
- Users Actions
Attribute → Create String
AI-generatedOverview
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
- Creating a 'username' attribute in a user database with a maximum length of 50 characters and marking it as required.
- 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
- Appwrite String Attribute Documentation - Official documentation on creating string attributes in Appwrite databases.