Create a schedule
import requests
url = "https://{FUSION_HOST}/api/scheduler/schedules"
payload = {
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"repeatUnit": "DAY",
"interval": 1,
"active": True,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST"
}
}
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/scheduler/schedules")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: '1',
creatorType: 'human',
creatorId: 'admin1',
repeatUnit: 'DAY',
interval: 1,
active: true,
callParams: {uri: 'service://connectors/jobs/LocalDocs2', method: 'POST'}
})
};
fetch('https://{FUSION_HOST}/api/scheduler/schedules', 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/scheduler/schedules")
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 \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/scheduler/schedules"
payload := strings.NewReader("{\n \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\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/scheduler/schedules",
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([
'id' => '1',
'creatorType' => 'human',
'creatorId' => 'admin1',
'repeatUnit' => 'DAY',
'interval' => 1,
'active' => true,
'callParams' => [
'uri' => 'service://connectors/jobs/LocalDocs2',
'method' => 'POST'
]
]),
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/scheduler/schedules \
--header 'Content-Type: application/json' \
--data '
{
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"repeatUnit": "DAY",
"interval": 1,
"active": true,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST"
}
}
'{
"id": "1",
"trigger": "1_1400007488512_-9223372036854775808",
"schedule": {
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"createTime": "2014-05-13T18:58:08.512Z",
"startTime": "2014-05-13T18:58:08.512Z",
"endTime": null,
"repeatUnit": "DAY",
"interval": 1,
"active": true,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST",
"queryParams": {},
"headers": {},
"entity": null
}
}
}Create a schedule
Create a new schedule.
POST
/
scheduler
/
schedules
Create a schedule
import requests
url = "https://{FUSION_HOST}/api/scheduler/schedules"
payload = {
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"repeatUnit": "DAY",
"interval": 1,
"active": True,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST"
}
}
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/scheduler/schedules")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\n }\n}")
.asString();const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: '1',
creatorType: 'human',
creatorId: 'admin1',
repeatUnit: 'DAY',
interval: 1,
active: true,
callParams: {uri: 'service://connectors/jobs/LocalDocs2', method: 'POST'}
})
};
fetch('https://{FUSION_HOST}/api/scheduler/schedules', 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/scheduler/schedules")
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 \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\n }\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{FUSION_HOST}/api/scheduler/schedules"
payload := strings.NewReader("{\n \"id\": \"1\",\n \"creatorType\": \"human\",\n \"creatorId\": \"admin1\",\n \"repeatUnit\": \"DAY\",\n \"interval\": 1,\n \"active\": true,\n \"callParams\": {\n \"uri\": \"service://connectors/jobs/LocalDocs2\",\n \"method\": \"POST\"\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/scheduler/schedules",
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([
'id' => '1',
'creatorType' => 'human',
'creatorId' => 'admin1',
'repeatUnit' => 'DAY',
'interval' => 1,
'active' => true,
'callParams' => [
'uri' => 'service://connectors/jobs/LocalDocs2',
'method' => 'POST'
]
]),
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/scheduler/schedules \
--header 'Content-Type: application/json' \
--data '
{
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"repeatUnit": "DAY",
"interval": 1,
"active": true,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST"
}
}
'{
"id": "1",
"trigger": "1_1400007488512_-9223372036854775808",
"schedule": {
"id": "1",
"creatorType": "human",
"creatorId": "admin1",
"createTime": "2014-05-13T18:58:08.512Z",
"startTime": "2014-05-13T18:58:08.512Z",
"endTime": null,
"repeatUnit": "DAY",
"interval": 1,
"active": true,
"callParams": {
"uri": "service://connectors/jobs/LocalDocs2",
"method": "POST",
"queryParams": {},
"headers": {},
"entity": null
}
}
}Body
application/json
JSON-formatted schedule configuration values.
A unit of time that when combined with the interval property defines how often the schedule will run. Allowed values are:
● millisecond or ms
● second or sec
● minute or min
● hour or hr
● day
● week
● month These time units are not case-sensitive.
Available options:
MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH Response
200 - application/json
successful operation
The response is of type object.
Was this page helpful?