Update task cron configuration
PATCH
/api/v1/tasks/{taskType}/cron
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");curl_easy_setopt(hnd, CURLOPT_URL, "http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"cronExpression\": \"example\", \"enabled\": true }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Patch, RequestUri = new Uri("http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron"), Content = new StringContent("{ \"cronExpression\": \"example\", \"enabled\": true }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron"
payload := strings.NewReader("{ \"cronExpression\": \"example\", \"enabled\": true }")
req, _ := http.NewRequest("PATCH", 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(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron")) .header("Content-Type", "application/json") .method("PATCH", HttpRequest.BodyPublishers.ofString("{ \"cronExpression\": \"example\", \"enabled\": true }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"cronExpression\": \"example\", \"enabled\": true }");Request request = new Request.Builder() .url("http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron") .patch(body) .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'PATCH', url: 'http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron', headers: {'Content-Type': 'application/json'}, data: {cronExpression: 'example', enabled: true}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron';const options = { method: 'PATCH', headers: {'Content-Type': 'application/json'}, body: '{"cronExpression":"example","enabled":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"cronExpression\": \"example\", \"enabled\": true }")val request = Request.Builder() .url("http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron") .patch(body) .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use std::str::FromStr;use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron";
let payload = json!({ "cronExpression": "example", "enabled": true });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request PATCH \ --url http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cron \ --header 'Content-Type: application/json' \ --data '{ "cronExpression": "example", "enabled": true }'wget --quiet \ --method PATCH \ --header 'Content-Type: application/json' \ --body-data '{ "cronExpression": "example", "enabled": true }' \ --output-document \ - http://127.0.0.1:58259/api/v1/tasks/REFRESH_LIBRARY_METADATA/cronPatch cron schedule configuration for a task type and reschedule execution.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” taskType
required
string
Request Body required
Section titled “Request Body required ” Media type application/json
object
cronExpression
string
enabled
boolean
Example generated
{ "cronExpression": "example", "enabled": true}Responses
Section titled “ Responses ”OK
Media type */*
object
id
integer format: int64
taskType
string
cronExpression
string
enabled
boolean
createdAt
string format: date-time
updatedAt
string format: date-time