Skip to content

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

fix(demio): request participants from the report resource

Rudy Celekli6294c01ac264
diff --git a/tests/clis/demio-participant-route.test.cjs b/tests/clis/demio-participant-route.test.cjs
new file mode 100644
index 0000000..808e28b
--- /dev/null
+++ b/tests/clis/demio-participant-route.test.cjs
@@ -0,0 +1,36 @@
+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/demio.js')
+function run(args, network = false) {
+ const code = `global.fetch = async (url, options) => {
+ if (!${network}) throw new Error('Unexpected request');
+ const found = new URL(url).pathname === '/api/v1/report/1575/participants';
+ return {status: found ? 200 : 404, text: async () => JSON.stringify({url, method: options.method, headers: options.headers, status: found ? 200 : 404})};
+ }; process.argv = ['node', ${JSON.stringify(cli)}, ...${JSON.stringify(args)}]; require(${JSON.stringify(cli)});`
+ const r = spawnSync(process.execPath, ['-e', code], {encoding: 'utf8', timeout: 5000, env: {...process.env, DEMIO_API_KEY: 'test-key', DEMIO_API_SECRET: 'test-secret'}})
+ assert.equal(r.status, 0, r.stderr)
+ return JSON.parse(r.stdout)
+}
+test('participant lookup reaches the documented event-date report endpoint', () => {
+ const result = run(['participants', 'list', '--date-id', '1575'], true)
+ assert.equal(result.status, 200)
+ assert.equal(result.url, 'https://my.demio.com/api/v1/report/1575/participants')
+ assert.equal(result.method, 'GET')
+ assert.equal(result.headers['Api-Key'], 'test-key')
+ assert.equal(result.headers['Api-Secret'], 'test-secret')
+})
+test('participant preview uses the same report route and masks both credentials', () => {
+ const result = run(['participants', 'list', '--date-id', '1575', '--dry-run'])
+ assert.equal(result.url, 'https://my.demio.com/api/v1/report/1575/participants')
+ assert.equal(result.headers['Api-Key'], '***')
+ assert.equal(result.headers['Api-Secret'], '***')
+})
+test('a missing event-date identifier stops before making a request', () => {
+ assert.match(run(['participants', 'list']).error, /date-id required/)
+})
+test('event-date details retain their separate event resource route', () => {
+ const result = run(['events', 'date', '--event-id', '86', '--date-id', '1575', '--dry-run'])
+ assert.equal(result.url, 'https://my.demio.com/api/v1/event/86/date/1575')
+})
diff --git a/tools/clis/demio.js b/tools/clis/demio.js
index b82791a..01d350d 100755
--- a/tools/clis/demio.js
+++ b/tools/clis/demio.js
@@ -121,7 +121,7 @@ async function main() {
case 'list': {
const dateId = args['date-id']
if (!dateId) { result = { error: '--date-id required' }; break }
- result = await api('GET', `/date/${dateId}/participants`)
+ result = await api('GET', `/report/${dateId}/participants`)
break
}
default:
diff --git a/tools/integrations/demio.md b/tools/integrations/demio.md
index d71dd15..47beed4 100644
--- a/tools/integrations/demio.md
+++ b/tools/integrations/demio.md
@@ -108,7 +108,7 @@ Headers:
### Get participants for event date
```bash
-GET https://my.demio.com/api/v1/date/{date_id}/participants
+GET https://my.demio.com/api/v1/report/{date_id}/participants
Headers:
Api-Key: {API_KEY}
@@ -117,6 +117,10 @@ Headers:
## API Pattern
+Participant reports use the `/report/{date_id}/participants` resource;
+event-date details use `/event/{event_id}/date/{date_id}`. See the
+[public Demio API reference](https://api-docs.demio.com/).
+
Demio uses a straightforward REST API:
- All requests require both `Api-Key` and `Api-Secret` headers
- Responses are JSON objects