Jobs API Reference
POST /resources/jobs
Creates a new job
Body Parameters
reactorId | string ID of the reactor |
method | string The method of the reactor to invoke |
argument | any The argument to pass to the method |
scheduleAt | ISO-8641 timestamp Optional future timestamp of when to run the job. If timestamp is omitted, now or in the past, the job will run immediately. |
Request Sample
Request
POST https://<hantera-hostname>/resources/jobsAuthorization: Bearer <YOUR TOKEN>Content-Type: application/json
{ "reactorId": "myReactorComponent", "method": "myMethod", "argument": { "param1": "'a text value'" }, "scheduleAt": "2025-02-15T14:25Z"}
curl -i -X POST \ https://<hantera-hostname>/resources/jobs \ -H 'Authorization: Bearer <YOUR TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "reactorId": "myReactorComponent", "method": "myMethod", "argument": { "param1": "'a text value'" }, "scheduleAt": "2025-02-15T14:25Z"}'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/jobs" `-Method POST ` `-Headers @{Authorization="Bearer <YOUR TOKEN>"; 'Content-Type'="application/json"}-Body '{ "reactorId": "myReactorComponent", "method": "myMethod", "argument": { "param1": "'a text value'" }, "scheduleAt": "2025-02-15T14:25Z"}'
Response
The response contains the Job ID that can be use to fetch the Job status and result.
Status: 200Content-Type: application/json
"ec591982-6cd8-4a31-b53c-5ab62852bb68"
GET /resources/jobs/<jobId>
Gets the status and result (if available) of a Job.
URI Parameters
jobId | uuid |
Request Sample
Request
GET https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705Authorization: Bearer <YOUR TOKEN>
curl -i -X GET \ https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705 \ -H 'Authorization: Bearer <YOUR TOKEN>'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705" `-Method GET ` `-Headers @{Authorization="Bearer <YOUR TOKEN>"}
Response
Status: 200Content-Type: application/json
{ "jobId": "eaf3d619-0393-4229-b302-da5afb5fc705", "state": "pending", "scheduledAt": "2025-02-15T14:25Z", "startedAt": null, "finishedAt": null, "result": null}
DELETE /resources/jobs/<jobId>
Deletes a Job. Only Jobs that are not started or finished can be deleted. Attempting to delete a running Job will result in an error.
URI Parameters
jobId | uuid |
Request Sample
Request
DELETE https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705Authorization: Bearer <YOUR TOKEN>
curl -i -X DELETE \ https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705 \ -H 'Authorization: Bearer <YOUR TOKEN>'
Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/jobs/eaf3d619-0393-4229-b302-da5afb5fc705" `-Method DELETE ` `-Headers @{Authorization="Bearer <YOUR TOKEN>"}
Response
Status: 200