-
-
Notifications
You must be signed in to change notification settings - Fork 188
JavaScript Client
Akram El Assas edited this page Jul 12, 2025
·
6 revisions
Here is a sample JavaScript client:
const username = 'admin'
const password = 'wexflow2018'
const workflowId = 1
async function sha256(input) {
const encoder = new TextEncoder()
const data = encoder.encode(input)
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
const hashArray = Array.from(new Uint8Array(hashBuffer))
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('')
return hashHex
}
async function getAuthHeader(user, pass) {
const hashedPassword = await sha256(pass)
return `Basic ${btoa(`${user}:${hashedPassword}`)}`
}
try {
const autHeader = await getAuthHeader(username, password)
const res = await fetch(`https://localhost:8000/api/v1/start?w=${workflowId}`, {
method: 'POST',
headers: { 'Authorization': autHeader }
})
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
- Migration Guide to v10.0
- 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