Cancel the job based on the job ID and update the job status in the database
curl --request POST \
--url https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "This is sample cancellation message."
}
'import requests
url = "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}"
payload = { "message": "This is sample cancellation message." }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: 'This is sample cancellation message.'})
};
fetch('https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'This is sample cancellation message.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}"
payload := strings.NewReader("{\n \"message\": \"This is sample cancellation message.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"This is sample cancellation message.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"This is sample cancellation message.\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"message\": \"This is sample cancellation message.\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": \"This is sample cancellation message.\"\n}");
CURLcode ret = curl_easy_perform(hnd);Cancel the job based on the job ID and update the job status in the database
POST
/
v2
/
tsa
/
jobs
/
cancel
/
{job_id}
Cancel the job based on the job ID and update the job status in the database
curl --request POST \
--url https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "This is sample cancellation message."
}
'import requests
url = "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}"
payload = { "message": "This is sample cancellation message." }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({message: 'This is sample cancellation message.'})
};
fetch('https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'This is sample cancellation message.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}"
payload := strings.NewReader("{\n \"message\": \"This is sample cancellation message.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"This is sample cancellation message.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"This is sample cancellation message.\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"message\": \"This is sample cancellation message.\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://{host}/api/tsa/v2/tsa/jobs/cancel/{job_id}");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"message\": \"This is sample cancellation message.\"\n}");
CURLcode ret = curl_easy_perform(hnd);Body
application/json
Response
"Success. A message will appear to confirm cancellation. {"status": "cancelling", "message": "Job cancellation started"}
Was this page helpful?