Scripting
ActionXM CLI is designed to be scriptable with consistent exit codes and parseable output.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error (API error, not found, etc.) |
2 | Usage error (invalid arguments) |
Shell scripting examples
Check if authenticated
bash
if actionxm auth status > /dev/null 2>&1; then
echo "Authenticated"
else
echo "Not authenticated"
fiList sites and select by name
bash
# Select a site by name
actionxm sites select "Acme Store"Conditional login
bash
# Login only if not already authenticated
actionxm auth status > /dev/null 2>&1 || actionxm auth loginEnvironment-based configuration
bash
# Use a different API for staging
ACTIONXM_API_URL=https://staging.action-xm.com actionxm config set api_url https://staging.action-xm.com
actionxm auth login