batchUpdateJobs()
Signature
client.batchUpdateJobs(payload: JobBatchUpdatePayload, includeHttpDetails?: boolean): Promise<JobBatchUpdateResponse>Parameters#
| Param | Type | Description |
|---|---|---|
jobs | (JobUpdatePayload & { id: string })[] | Array of job objects with IDs to update (max 100) |
includeHttpDetails | boolean (optional) | Include HTTP headers and body from latest job run |
Usage#
ts
import { VeloraClient } from '@rimora/velora'
import fetch from 'node-fetch'
const client = new VeloraClient({
apiKey: process.env.VELORA_API_KEY,
fetch: fetch as any
})
const result = await client.batchUpdateJobs({
jobs: [
{
id: '9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c',
name: 'Updated Name',
schedule_cron: '0 8 * * *'
},
{
id: 'a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p',
target_url: 'https://example.com/new-hook'
}
]
})
console.log(`Updated ${result.updated} jobs, failed ${result.failed}`)
// The endpoint is: PATCH /api/v1/jobs/batchResponse#
JobBatchUpdateResponse
{
"jobs": [
{ "id": "9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c", "msg": "Job updated" },
{ "id": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p", "msg": "Job updated" }
],
"total": 2,
"updated": 2,
"failed": 0
}The
webhook_signature_enabled field is always included in job responses. It is set to true when the job has a webhook_secret configured, indicating that Velora will sign outgoing requests with the X-Hub-Signature-256 header.When includeHttpDetails=true, each job will include an http_details field with headers, body, status_code, and timestamp from the latest job run.
Maximum 100 jobs per request. Each job object must include an
id field. Jobs that don't exist or fail validation will be skipped and included in the 'failed' count. Only provided fields will be updated; missing fields remain unchanged.Required scope#
Requires: jobs:write (or jobs:update, admin, *)
Common errors#
| Status | error | Cause |
|---|---|---|
400 | validation_error | jobs is required and must be an array |
400 | validation_error | Maximum 100 jobs per request |
400 | validation_error | Each job must include an id field |
404 | not_found | One or more jobs not found |
401 | invalid_api_key | Missing or revoked API key |
403 | insufficient_scope | Key lacks jobs:write scope |