How to use cURL to trigger an Axiom.ai automation
Learn how to get started with cURL to trigger your Axiom.ai automations. This can be useful for triggering your automations from the command line on Windows, macOS or Linux.
# Getting started
To get started, you will need the following from the Axiom.ai Chrome extension:
- API key - The API key is found on the dashboard.
- Automation name - Get the name of the automation you wish to trigger.
- Endpoint - The current endpoint is
https://lar.axiom.ai/api/v3/trigger.
# Trigger an Axiom.ai automation using cURL
Open your command line to get started, and use the following command to trigger your automation. You'll need the information from the getting started section of this guide.
curl -X POST https://lar.axiom.ai/api/v3/trigger -H "Content-Type: application/json" -d "{\"key\": \"<API_KEY>\", \"name\": \"<AUTOMATION_NAME>\", \"data\": []"}"
Let's break down this command:
curl- the application we are triggering.-X POST- the HTTP method to use.-h "Content-Type: application/json"- the headers to pass along with the request.-d "{\"key\": \"<API_KEY>\", \"name\": \"<AUTOMATION_NAME>\", \"data\": []"}- the data to send in the request, formatted as per our trigger guide.
# Examples
# Reporting system available memory
Determining the memory available on the computer your automations are running can be useful to use when running multiple instances of Axiom, here's an example using a .bat file.
@echo off
rem Get the free memory value
for /f "tokens=2 delims=:" %%f in ('systeminfo ^| findstr /C:"Available Physical Memory"') do set freememory=%%f
rem Remove any commas or extra spaces
set freememory=%freememory:,=%
set freememory=%freememory: =%
rem Send free memory to the webhook using curl
curl -X POST "https://lar.axiom.ai/api/v3/trigger" -H "Content-Type: application/json" -d "{\"key\": \"<API_KEY>\", \"name\": \"<AUTOMATION_NAME>\", \"data\": [[\"%freememory%\"]]}"
pause
You'll need to add a receive data from another app step into your Axiom.ai automation to be able to use the data within your automation.
# Testing your workflow
To test your workflow, hit ENTER on your command. If successful, you will receive a link to open the automation run in your browser, for example
{"OPEN LINK IN BROWSER":"https:\/\/vnc.axiom.ai\/vnc_lite.html?host=c-0027-v4-proxy.axiom.ai&port=443&autoconnect=true&password=xxxxxxxx&scale=local"}
If there are errors returned, follow the error to determine if there is an issue with the command. If the automation has errors, you can find there in the run reports of your account.
Note: the correct format of the data, and the escaping of the quotation marks in your command are important, you may experience errors if you miss these steps.
# Wrapping up
cURL commands can be a good way of triggering your automations, they can be included in batch files to include them in a much larger workflow.