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 Enum
AI-generatedOverview
This node operation creates an Enum attribute in a specified Appwrite database collection. It allows users to define an attribute with a key, specify if it is required, set a default value, and determine if the attribute is an array. The Enum elements are provided as a comma-separated string. This operation is useful for defining constrained sets of string values for attributes in Appwrite collections, such as status fields, categories, or predefined options.
Use Case Examples
- Creating an Enum attribute 'status' with elements 'pending,approved,rejected' in a collection to manage workflow states.
- Defining a 'priority' Enum attribute with elements 'low,medium,high' to categorize tasks.
Properties
| Name | Meaning |
|---|---|
| Database ID | The ID of the Appwrite database where the collection resides. |
| Collection ID | The ID of the collection within the database where the Enum attribute will be created. |
| Attribute Key | The key (name) of the attribute to create. |
| Required | Indicates whether the attribute is mandatory. |
| Default Value | The default value assigned to the attribute if none is provided. |
| Array | Specifies if the attribute is an array of values rather than a single value. |
| Elements | Comma-separated string listing the possible values for the Enum attribute. |
Output
JSON
attributeId- The unique identifier of the created Enum attribute.key- The key (name) of the created attribute.type- The type of the attribute, which is 'enum' in this operation.elements- The list of possible values for the Enum attribute.required- Indicates if the attribute is required.defaultValue- The default value of the attribute if set.array- Indicates if the attribute is an array.
Dependencies
- Appwrite API key credential for authentication and access to the Appwrite project and database.
Troubleshooting
- Ensure the provided Database ID and Collection ID are correct and exist in the Appwrite project.
- Verify that the API key credential has sufficient permissions to create attributes in the specified database and collection.
- Check that the 'Elements' string is properly formatted as a comma-separated list without trailing commas or invalid characters.
- If the node throws an 'Unknown resource' error, confirm that the resource parameter is set to 'attribute' and the operation to 'createEnum'.
- If the operation fails, review the error message for details such as missing required parameters or network issues.
Links
- Appwrite Enum Attribute Documentation - Official documentation on creating Enum attributes in Appwrite databases.