Create a task
import requests
url = "https://{FUSION HOST}/api/tasks"
payload = {
"type": "rest-call",
"id": "test-task-created",
"callParams": {
"uri": "solr://system_jobs_history/update",
"method": "post",
"queryParams": { "wt": "json" },
"headers": {},
"entity": "<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION HOST}/api/tasks")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'rest-call',
id: 'test-task-created',
callParams: {
uri: 'solr://system_jobs_history/update',
method: 'post',
queryParams: {wt: 'json'},
headers: {},
entity: '<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>'
}
})
};
fetch('https://{FUSION HOST}/api/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION HOST}/api/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION HOST}/api/tasks"
payload := strings.NewReader("{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION HOST}/api/tasks",
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([
'type' => 'rest-call',
'id' => 'test-task-created',
'callParams' => [
'uri' => 'solr://system_jobs_history/update',
'method' => 'post',
'queryParams' => [
'wt' => 'json'
],
'headers' => [
],
'entity' => '<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION HOST}/api/tasks \
--header 'Content-Type: application/json' \
--data '
{
"type": "rest-call",
"id": "test-task-created",
"callParams": {
"uri": "solr://system_jobs_history/update",
"method": "post",
"queryParams": {
"wt": "json"
},
"headers": {},
"entity": "<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>"
}
}
'{
"id": "<string>",
"type": "<string>"
}Create a new task.
POST
/
tasks
Create a task
import requests
url = "https://{FUSION HOST}/api/tasks"
payload = {
"type": "rest-call",
"id": "test-task-created",
"callParams": {
"uri": "solr://system_jobs_history/update",
"method": "post",
"queryParams": { "wt": "json" },
"headers": {},
"entity": "<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://{FUSION HOST}/api/tasks")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'rest-call',
id: 'test-task-created',
callParams: {
uri: 'solr://system_jobs_history/update',
method: 'post',
queryParams: {wt: 'json'},
headers: {},
entity: '<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>'
}
})
};
fetch('https://{FUSION HOST}/api/tasks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://{FUSION HOST}/api/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION HOST}/api/tasks"
payload := strings.NewReader("{\n \"type\": \"rest-call\",\n \"id\": \"test-task-created\",\n \"callParams\": {\n \"uri\": \"solr://system_jobs_history/update\",\n \"method\": \"post\",\n \"queryParams\": {\n \"wt\": \"json\"\n },\n \"headers\": {},\n \"entity\": \"<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{FUSION HOST}/api/tasks",
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([
'type' => 'rest-call',
'id' => 'test-task-created',
'callParams' => [
'uri' => 'solr://system_jobs_history/update',
'method' => 'post',
'queryParams' => [
'wt' => 'json'
],
'headers' => [
],
'entity' => '<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://{FUSION HOST}/api/tasks \
--header 'Content-Type: application/json' \
--data '
{
"type": "rest-call",
"id": "test-task-created",
"callParams": {
"uri": "solr://system_jobs_history/update",
"method": "post",
"queryParams": {
"wt": "json"
},
"headers": {},
"entity": "<root><delete><query>timestamp_dt:[* TO NOW-30DAYS] AND type_s:history</query></delete><commit /></root>"
}
}
'{
"id": "<string>",
"type": "<string>"
}Was this page helpful?
⌘I