Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix(airops): align the CLI with public app and execution routes

Rudy Celeklif472824e9d6d
diff --git a/tests/clis/airops-public-api.test.cjs b/tests/clis/airops-public-api.test.cjs
new file mode 100644
index 0000000..db1f670
--- /dev/null
+++ b/tests/clis/airops-public-api.test.cjs
@@ -0,0 +1,22 @@
+const {test}=require('node:test')
+const assert=require('node:assert/strict')
+const {spawnSync}=require('node:child_process')
+const path=require('node:path')
+const cli=path.resolve(__dirname,'../../tools/clis/airops.js')
+function run(args,oracle="throw new Error('unexpected fetch')",workspace='legacy-workspace') {
+ const code=`global.fetch=async(url,options)=>{const assert=require('node:assert/strict');const u=new URL(url);const body=options.body?JSON.parse(options.body):undefined;assert.equal(options.headers.Authorization,'Bearer fixture-key');${oracle};return new Response(JSON.stringify({accepted:true}));};process.argv=['node',${JSON.stringify(cli)},...${JSON.stringify(args)}];require(${JSON.stringify(cli)});`
+ const r=spawnSync(process.execPath,['-e',code],{encoding:'utf8',timeout:10000,env:{...process.env,AIROPS_API_KEY:'fixture-key',AIROPS_WORKSPACE_ID:workspace}});assert.equal(r.status,0,r.stderr);return JSON.parse(r.stdout)
+}
+for (const group of ['flows','workflows']) {
+ test(`${group} list uses published app catalog`,()=>assert.equal(run([group,'list'],"assert.equal(u.href,'https://api.airops.com/public_api/airops_apps');assert.equal(options.method,'GET');").accepted,true))
+ test(`${group} execution uses the app UUID and inputs object`,()=>assert.equal(run([group,'execute','--id','app-uuid','--inputs','{"topic":"SEO"}'],"assert.equal(u.href,'https://api.airops.com/public_api/airops_apps/app-uuid/execute');assert.equal(options.method,'POST');assert.deepEqual(body,{inputs:{topic:'SEO'}});").accepted,true))
+}
+test('app detail uses the app UUID route',()=>assert.equal(run(['flows','get','--id','app-uuid'],"assert.equal(u.href,'https://api.airops.com/public_api/airops_apps/app-uuid');").accepted,true))
+test('run status uses the execution UUID route',()=>assert.equal(run(['flows','run-status','--run-id','run-uuid'],"assert.equal(u.href,'https://api.airops.com/public_api/airops_apps/executions/run-uuid');").accepted,true))
+test('run history uses numeric app ID and forwards paging',()=>assert.equal(run(['flows','runs','--id','123','--cursor','cursor+/=','--items','25'],"assert.equal(u.pathname,'/public_api/airops_apps/123/executions');assert.equal(u.searchParams.get('airops_app_id'),'123');assert.equal(u.searchParams.get('cursor'),'cursor+/=');assert.equal(u.searchParams.get('items'),'25');").accepted,true))
+test('public execution needs the API key but no workspace environment variable',()=>assert.equal(run(['flows','execute','--id','app-uuid'],"assert.deepEqual(body,{inputs:{}});",'').accepted,true))
+for (const inputs of ['{broken','null','[]']) {
+ test(`invalid input object ${inputs} never fetches`,()=>assert.match(run(['flows','execute','--id','app-uuid','--inputs',inputs]).error,/inputs/))
+}
+test('run history rejects UUID where a numeric app ID is required',()=>assert.match(run(['flows','runs','--id','app-uuid']).error,/numeric/))
+test('execution preview uses public route and stays offline',()=>{const p=run(['workflows','execute','--id','app-uuid','--dry-run']);assert.equal(p.url,'https://api.airops.com/public_api/airops_apps/app-uuid/execute');assert.equal(p.headers.Authorization,'Bearer ***')})
diff --git a/tools/clis/airops.js b/tools/clis/airops.js
index 3233370..1ee924f 100755
--- a/tools/clis/airops.js
+++ b/tools/clis/airops.js
@@ -2,19 +2,13 @@
const rawArgs = process.argv.slice(2)
const API_KEY = process.env.AIROPS_API_KEY
-const WORKSPACE_ID = process.env.AIROPS_WORKSPACE_ID
-const BASE_URL = 'https://api.airops.com/public_api/v1'
+const BASE_URL = 'https://api.airops.com/public_api'
if ((!API_KEY) && rawArgs.length > 0) {
console.error(JSON.stringify({ error: 'AIROPS_API_KEY environment variable required' }))
process.exit(1)
}
-if ((!WORKSPACE_ID) && rawArgs.length > 0) {
- console.error(JSON.stringify({ error: 'AIROPS_WORKSPACE_ID environment variable required' }))
- process.exit(1)
-}
-
async function api(method, path, body) {
const url = `${BASE_URL}${path}`
if (args['dry-run']) {
@@ -64,16 +58,17 @@ async function main() {
let result
switch (cmd) {
+ case 'workflows':
case 'flows':
switch (sub) {
case 'list': {
- result = await api('GET', `/workspaces/${WORKSPACE_ID}/flows`)
+ result = await api('GET', '/airops_apps')
break
}
case 'get': {
const id = args.id
if (!id) { result = { error: '--id required' }; break }
- result = await api('GET', `/workspaces/${WORKSPACE_ID}/flows/${id}`)
+ result = await api('GET', `/airops_apps/${encodeURIComponent(id)}`)
break
}
case 'execute': {
@@ -89,19 +84,24 @@ async function main() {
break
}
}
- result = await api('POST', `/workspaces/${WORKSPACE_ID}/flows/${id}/execute`, { inputs: parsedInputs })
+ if (!parsedInputs || typeof parsedInputs !== 'object' || Array.isArray(parsedInputs)) { result = { error: '--inputs must be a JSON object' }; break }
+ result = await api('POST', `/airops_apps/${encodeURIComponent(id)}/execute`, { inputs: parsedInputs })
break
}
case 'runs': {
const id = args.id
if (!id) { result = { error: '--id required' }; break }
- result = await api('GET', `/workspaces/${WORKSPACE_ID}/flows/${id}/runs`)
+ if (!/^\d+$/.test(id)) { result = { error: '--id must be the numeric app ID for run history (not the app UUID)' }; break }
+ const params = new URLSearchParams({ airops_app_id: id })
+ if (args.cursor) params.set('cursor', args.cursor)
+ if (args.items) params.set('items', args.items)
+ result = await api('GET', `/airops_apps/${id}/executions?${params}`)
break
}
case 'run-status': {
const runId = args['run-id']
if (!runId) { result = { error: '--run-id required' }; break }
- result = await api('GET', `/workspaces/${WORKSPACE_ID}/runs/${runId}`)
+ result = await api('GET', `/airops_apps/executions/${encodeURIComponent(runId)}`)
break
}
default:
@@ -109,47 +109,20 @@ async function main() {
}
break
- case 'workflows':
- switch (sub) {
- case 'list': {
- result = await api('GET', `/workspaces/${WORKSPACE_ID}/workflows`)
- break
- }
- case 'execute': {
- const id = args.id
- if (!id) { result = { error: '--id required' }; break }
- const inputs = args.inputs
- let parsedInputs = {}
- if (inputs) {
- try {
- parsedInputs = JSON.parse(inputs)
- } catch {
- result = { error: '--inputs must be valid JSON' }
- break
- }
- }
- result = await api('POST', `/workspaces/${WORKSPACE_ID}/workflows/${id}/execute`, { inputs: parsedInputs })
- break
- }
- default:
- result = { error: 'Unknown workflows subcommand. Use: list, execute' }
- }
- break
-
default:
result = {
error: 'Unknown command',
usage: {
flows: {
list: 'flows list',
- get: 'flows get --id <id>',
- execute: 'flows execute --id <id> --inputs <json>',
- runs: 'flows runs --id <id>',
+ get: 'flows get --id <app_uuid>',
+ execute: 'flows execute --id <app_uuid> --inputs <json>',
+ runs: 'flows runs --id <numeric_app_id> [--cursor <cursor>] [--items <1-100>]',
'run-status': 'flows run-status --run-id <id>',
},
workflows: {
list: 'workflows list',
- execute: 'workflows execute --id <id> --inputs <json>',
+ execute: 'workflows execute --id <app_uuid> --inputs <json>',
},
}
}
diff --git a/tools/integrations/airops.md b/tools/integrations/airops.md
index f003bc6..abaa126 100644
--- a/tools/integrations/airops.md
+++ b/tools/integrations/airops.md
@@ -13,9 +13,9 @@ AI content platform for crafting content that wins AI search. Build and execute
## Authentication
-- **Type**: API Key + Workspace ID
+- **Type**: Workspace API Key
- **Header**: `Authorization: Bearer {api_key}`
-- **Env vars**: `AIROPS_API_KEY`, `AIROPS_WORKSPACE_ID`
+- **Env vars**: `AIROPS_API_KEY` (no separate workspace ID is required by these public routes)
- **Get key**: Settings > API Keys at https://app.airops.com
## Common Agent Operations
@@ -23,19 +23,19 @@ AI content platform for crafting content that wins AI search. Build and execute
### List Flows
```bash
-GET https://api.airops.com/public_api/v1/workspaces/{workspace_id}/flows
+GET https://api.airops.com/public_api/airops_apps
```
### Get Flow Details
```bash
-GET https://api.airops.com/public_api/v1/workspaces/{workspace_id}/flows/{flow_id}
+GET https://api.airops.com/public_api/airops_apps/{app_uuid}
```
### Execute a Flow
```bash
-POST https://api.airops.com/public_api/v1/workspaces/{workspace_id}/flows/{flow_id}/execute
+POST https://api.airops.com/public_api/airops_apps/{app_uuid}/execute
{
"inputs": {
@@ -48,25 +48,25 @@ POST https://api.airops.com/public_api/v1/workspaces/{workspace_id}/flows/{flow_
### List Runs for a Flow
```bash
-GET https://api.airops.com/public_api/v1/workspaces/{workspace_id}/flows/{flow_id}/runs
+GET https://api.airops.com/public_api/airops_apps/{numeric_app_id}/executions?airops_app_id={numeric_app_id}
```
### Get Run Status
```bash
-GET https://api.airops.com/public_api/v1/workspaces/{workspace_id}/runs/{run_id}
+GET https://api.airops.com/public_api/airops_apps/executions/{execution_uuid}
```
### List Workflows
```bash
-GET https://api.airops.com/public_api/v1/workspaces/{workspace_id}/workflows
+GET https://api.airops.com/public_api/airops_apps
```
### Execute a Workflow
```bash
-POST https://api.airops.com/public_api/v1/workspaces/{workspace_id}/workflows/{workflow_id}/execute
+POST https://api.airops.com/public_api/airops_apps/{app_uuid}/execute
{
"inputs": {
@@ -89,7 +89,7 @@ POST https://api.airops.com/public_api/v1/workspaces/{workspace_id}/workflows/{w
### Run Data
- `id` - Run identifier
- `flow_id` - Parent flow ID
-- `status` - pending, running, completed, failed
+- `status` - pending, running, error, success, cancelled, review_needed
- `inputs` - Input parameters used
- `outputs` - Generated results
- `started_at` - Run start time
@@ -126,3 +126,18 @@ POST https://api.airops.com/public_api/v1/workspaces/{workspace_id}/workflows/{w
- content-strategy
- programmatic-seo
- copywriting
+
+## CLI identifiers and execution limits
+
+`flows` and `workflows` refer to the same public app catalog. Use the app UUID
+from Integrate for detail and execution operations, and the returned execution
+UUID for `run-status`. Run history uses the numeric app ID and accepts `--cursor`
+and `--items` (1–100). The list operation returns both app ID and UUID.
+
+Apps must be published before execution. The synchronous execution endpoint can
+fail when workspace capacity is exhausted or a run takes more than ten minutes;
+this CLI does not automatically retry or enqueue work. `--inputs` must contain a
+JSON object. The provider also documents async execution for longer workflows.
+
+Contracts: [Apps](https://docs.airops.com/api-reference/api-reference/apps) and
+[Executions](https://docs.airops.com/api-reference/api-reference/executions).