Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Attribute → Create Integer

AI-generated

Overview

This node interacts with the Appwrite API to create an integer attribute within a specified database and collection. It is useful for defining schema attributes that store integer values, with options to set constraints like minimum and maximum values, default values, and whether the attribute is required or an array. Practical applications include setting up structured data models in Appwrite databases for applications that require integer data fields, such as user age, product quantity, or rating scores.

Use Case Examples

  1. Creating an integer attribute 'age' in a user database collection to store user ages with a minimum value of 0 and a maximum of 120.
  2. Defining a required integer attribute 'quantity' in an inventory collection with a default value of 1.
  3. Setting up an integer array attribute 'scores' to store multiple integer values for game scores.

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.
Required Indicates whether the attribute is mandatory.
Default Value The default integer value assigned to the attribute if no value is provided.
Array Specifies if the attribute is an array of integers rather than a single integer.
Min The minimum allowed value for the integer attribute.
Max The maximum allowed value for the integer attribute.

Output

JSON

  • id - 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 integer in this case.
  • required - Indicates if the attribute is required.
  • defaultValue - The default value set for the attribute.
  • array - Indicates if the attribute is an array.
  • min - The minimum value constraint for the attribute.
  • max - The maximum value constraint for the attribute.

Dependencies

  • Appwrite API key credential

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 'min' and 'max' values are valid numbers and that 'min' is not greater than 'max'.
  • If the node throws an error about unknown resource or operation, confirm that the resource is set to 'Attribute' and operation to 'Create Integer'.
  • Network or authentication errors may occur if the Appwrite endpoint, project ID, or API key are incorrect or expired.

Links

Discussion