The Appwrite CLI can be used in a non-interactive and headless manner, without saving configuration or sessions. This is especially useful when you want to automate tasks on a continuous integration server. You can enable the non-interactive mode for the Appwrite CLI by setting the project ID, endpoint, and API Key:
appwrite client \ --endpoint https://cloud.appwrite.io/v1 \ --projectId [YOUR_PROJECT_ID] \ --key YOUR_API_KEY
When you set the global configuration parameters using the appwrite client command, they take precedence over the local configuration parameters in your appwrite.json thereby switching the CLI to non-interactive mode.
In this mode, the CLI can only interact with one project at a time.
In non-interactive mode, the CLI uses an API key to authenticate. Your API key must have sufficient permissions to execute the commands you plan to use. Learn more about API Keys.
Appwrite's deploy commands can also be executed in a non-interactive mode. This applies to both function and collection deployment.
You can deploy a function non-interactively by using the --yes option to skip all warnings and specifying which functions you want to deploy.
Deploy a single function by ID:
appwrite deploy function --functionId [FUNCTION ID] --yes
Deploy all functions:
appwrite deploy function --all --yes
You can deploy databases, collections, teams, and buckets non-interactively in a similar way by using the --all and --yes option.
Deploy all databases and collections:
appwrite deploy collection --all --yes
Deploy all teams:
appwrite deploy team --all --yes
Deploy all buckets:
appwrite deploy buckets --all --yes