curl --request POST \
--url https://api.olostep.com/v1/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "<string>",
"payload": {},
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.olostep.com/v1/schedules"
payload = {
"endpoint": "<string>",
"payload": {},
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"text": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
endpoint: '<string>',
payload: {},
cron_expression: '<string>',
execute_at: '2023-11-07T05:31:56Z',
expression_timezone: '<string>',
text: '<string>'
})
};
fetch('https://api.olostep.com/v1/schedules', 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://api.olostep.com/v1/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([
'endpoint' => '<string>',
'payload' => [
],
'cron_expression' => '<string>',
'execute_at' => '2023-11-07T05:31:56Z',
'expression_timezone' => '<string>',
'text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.olostep.com/v1/schedules"
payload := strings.NewReader("{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.olostep.com/v1/schedules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/schedules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "recurring",
"method": "GET",
"endpoint": "<string>",
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"created": "2023-11-07T05:31:56Z"
}创建计划
创建一个新的计划以在指定时间执行API调用。支持使用cron表达式的一次性执行和重复计划。你还可以使用自然语言文本自动生成cron表达式。
curl --request POST \
--url https://api.olostep.com/v1/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "<string>",
"payload": {},
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.olostep.com/v1/schedules"
payload = {
"endpoint": "<string>",
"payload": {},
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"text": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
endpoint: '<string>',
payload: {},
cron_expression: '<string>',
execute_at: '2023-11-07T05:31:56Z',
expression_timezone: '<string>',
text: '<string>'
})
};
fetch('https://api.olostep.com/v1/schedules', 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://api.olostep.com/v1/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([
'endpoint' => '<string>',
'payload' => [
],
'cron_expression' => '<string>',
'execute_at' => '2023-11-07T05:31:56Z',
'expression_timezone' => '<string>',
'text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.olostep.com/v1/schedules"
payload := strings.NewReader("{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.olostep.com/v1/schedules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.olostep.com/v1/schedules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"endpoint\": \"<string>\",\n \"payload\": {},\n \"cron_expression\": \"<string>\",\n \"execute_at\": \"2023-11-07T05:31:56Z\",\n \"expression_timezone\": \"<string>\",\n \"text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "recurring",
"method": "GET",
"endpoint": "<string>",
"cron_expression": "<string>",
"execute_at": "2023-11-07T05:31:56Z",
"expression_timezone": "<string>",
"created": "2023-11-07T05:31:56Z"
}授权
Bearer认证头格式为Bearer ,其中是你的认证令牌。
请求体
调度 API 调用的 HTTP 方法。必须是 GET 或 POST。
GET, POST 调度执行时要调用的端点 URL。对于带有 Olostep 端点的 POST 请求,你可以使用简短形式(例如,'v1/scrapes', 'v1/batches', 'v1/crawls', 'v1/maps', 'v1/answers'),它们会自动加上 'https://api.olostep.com/' 前缀。对于其他端点,请提供完整的 URL。
随 API 调用发送的有效负载。可以包含你需要的任何 JSON 结构。对于 GET 请求,这通常是空的。对于 POST 请求,这应该包含你想发送到端点的数据。
用于重复调度的 6 个字段格式的 cron 表达式(分钟 小时 天 月 星期几 年)。重复调度必需。与 execute_at 和 text 互斥。
用于一次性调度执行的 ISO 8601 日期时间字符串。必须是有效的未来日期时间。一次性调度必需。与 cron_expression 互斥。
调度的 IANA 时区标识符(例如,'UTC', 'America/New_York', 'Europe/London')。重复调度必需,一次性调度可选。使用自然语言文本时,默认为 'UTC'。
用于自动生成 cron 表达式的自然语言文本。系统会将你的文本转换为有效的 cron 表达式。示例:'every 3 minutes', 'every day at 10am', 'every Monday at 9am'。与 cron_expression 和 execute_at 互斥。使用时,expression_timezone 默认为 'UTC'。
响应
调度创建成功。
唯一的调度标识符
调度类型:'recurring' 表示基于 cron 的调度,'onetime' 表示单次执行调度
recurring, onetime 调度调用的 HTTP 方法
GET, POST 将被调用的端点 URL
Cron 表达式(仅在重复调度中存在)
执行日期时间(仅在一次性调度中存在)
调度的时区
调度创建时的 ISO 8601 日期时间
此页面对您有帮助吗?