-
-
Notifications
You must be signed in to change notification settings - Fork 177
JavaScript Client
Akram El Assas edited this page Jul 16, 2025
·
6 revisions
Here is a sample JavaScript client:
const baseUrl = 'http://localhost:8000/api/v1'
const username = 'admin'
const password = 'wexflow2018'
const workflowId = 1
async function login(user, pass, stayConnected = false) {
const res = await fetch(`${baseUrl}/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: user, password: pass, stayConnected })
})
if (!res.ok) {
throw new Error(`HTTP ${res.status} - ${res.statusText}`)
}
const data = await res.json()
return data.access_token
}
try {
const token = await login(username, password)
const res = await fetch(`${baseUrl}/start?w=${workflowId}`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${token}` }
})
if (!res.ok) {
throw new Error(`HTTP ${res.status} - ${res.statusText}`)
}
const jobId = await res.json()
console.log(`Workflow ${workflowId} started successfully. Job ID:`, jobId)
} catch (err) {
console.error(`Failed to start workflow ${workflowId}:`, err)
}
Copyright © Akram El Assas. All rights reserved.
- Install Guide
- HTTPS/SSL
- Screenshots
- Docker
- Configuration Guide
- Persistence Providers
- Getting Started
- Android App
- Local Variables
- Global Variables
- REST Variables
- Functions
- Cron Scheduling
- Command Line Interface (CLI)
- REST API Reference
- Samples
- Logging
- Custom Tasks
-
Built-in Tasks
- File system tasks
- Encryption tasks
- Compression tasks
- Iso tasks
- Speech tasks
- Hashing tasks
- Process tasks
- Network tasks
- XML tasks
- SQL tasks
- WMI tasks
- Image tasks
- Audio and video tasks
- Email tasks
- Workflow tasks
- Social media tasks
- Waitable tasks
- Reporting tasks
- Web tasks
- Script tasks
- JSON and YAML tasks
- Entities tasks
- Flowchart tasks
- Approval tasks
- Notification tasks
- SMS tasks
- Run from Source
- Fork, Customize, and Sync