Cancelling Jobs via Jobs API
Details on how to cancel a job using the Jobs REST API
This page guides you through the process of cancelling a job using the Jobs API.
Jobs execute asynchronously, so any work already in progress won't be cancelled. As a result, you may still receive data after cancellation.
Required Parameters
Before using the Jobs API, ensure you have the following:
- Job ID: The ID of the specific job you want to query.
- Pipeline ID: The ID of the pipeline for which you want to list jobs.
- Component ID: The ID of the component within the pipeline.
Cancel Job
To cancel a specific job
curl --request PATCH --location 'https://api.platform.datastreamer.io/api/pipelines/:PipelineId/components/:ComponentId/jobs/:JobId/state/cancelled' \
--header 'apikey: API_KEY'
Example
Here is an example of how the curl command might look after replacing the placeholders:
curl --location 'https://api.platform.datastreamer.io/api/pipelines/12345/components/67890/jobs/job123/state/cancelled' \
--header 'apikey: abcdef123456'
The API will return a JSON response containing details of the job after cancellation.
{
"organization_id": "129706a7-0af1-4dc5-8eae-06404a89c3ca",
"pipeline_id": "twitter-keywords-1",
"step_id": "docsin0",
"job_id": "a4a7f219-1eaf-42ff-bfb4-5a637d80fc44",
"job_name": "test_twitter_keywords",
"work_item_id": "c08aa1ab-3f7b-465b-9a68-f9cbb01d3697",
"data_source": "twitter_keywords",
"job_type": "oneTime",
"job_state": "cancelled",
"label": null,
"tags": null,
"created": "2024-05-01T22:17:05.653031Z",
"updated": "2024-05-01T22:17:05.653031Z",
"preferred_start_time": "2024-05-02T16:08:22.335522Z",
"query_from": "2024-01-01T00:00:00Z",
"query_to": "2024-02-01T00:00:00Z",
"query": "raspberry pi",
"max_documents": 0,
"work_time_offset": 0,
"start_time_offset": 0
}
Updated 1 day ago