Documentation Index
Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
Use this file to discover all available pages before exploring further.
Olostepの/v1/monitorsエンドポイントを通じて、固定スケジュールで実行される永続的なモニターを作成し、ページの変更を検出し、メールまたはWebhookで通知を受け取ることができます。
query、url、またはその両方からモニターを作成
- 毎時、毎日、または毎週のチェックを実行
- アラートを
emailまたはwebhook_urlに配信
- モニターの一覧表示、検査、更新、削除
- プライベートスナップショットからモニタースナップショットイベントを読み取る
インストール
# pip install requests
import requests
モニターを作成する
POST /v1/monitorsでモニターを作成します。このエンドポイントは入力を検証し、モニターをプロビジョニングし、その内部スケジュールを作成し、アクティブなモニターオブジェクトを返します。
queryまたはurlの少なくとも一方が必要です。通知先はemailまたはwebhook_urlのいずれか一つが必要です。
リクエスト例
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
payload = {
"query": "製品の価格と在庫情報の変更を追跡",
"url": "https://example.com/products/widget-pro",
"frequency": "daily",
"email": "alerts@example.com",
"metadata": {
"product_id": "widget-pro",
"team": "growth"
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(f"{API_URL}/monitors", headers=headers, json=payload)
print(response.status_code)
print(json.dumps(response.json(), indent=2))
レスポンス
モニターの作成が成功すると、HTTP 202とモニターオブジェクトが返されます:
{
"id": "monitor_n8q2x4m1ak",
"object": "monitor",
"status": "active",
"schedule_id": "schedule_r4h9n2j7",
"query": "製品の価格と在庫情報の変更を追跡",
"url": "https://example.com/products/widget-pro",
"frequency": "daily",
"cron_expression": "0 0 * * ? *",
"notification_channel": "email",
"notification_target": "alerts@example.com",
"metadata": {
"product_id": "widget-pro",
"team": "growth"
},
"created": 1745673871,
"updated": 1745673871
}
通知チャネル
モニターはモニターごとに1つのチャネルをサポートします:
email: emailフィールドを設定
webhook: webhook_urlフィールドを設定
1つのリクエストで両方を設定することはできません。
Webhookの例
{
"query": "法的条件の変更を監視",
"url": "https://example.com/terms",
"frequency": "weekly",
"webhook_url": "https://hooks.example.com/olostep-monitor"
}
サポートされているモニターの頻度は以下の通りです:
APIは選択された頻度からスケジュールのcron式を自動的に導出します。
モニターを一覧表示
GET /v1/monitorsでチームのすべてのモニターを取得します。
デフォルトでは、削除されたモニターはフィルタリングされます。?include_deleted=trueを使用してそれらを含めます。
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.get(f"{API_URL}/monitors", headers=headers)
result = response.json()
print(f"Total monitors: {result['count']}")
print(json.dumps(result, indent=2))
モニターを取得
GET /v1/monitors/:monitor_idで単一のモニターを取得します。
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
MONITOR_ID = "monitor_n8q2x4m1ak"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.get(f"{API_URL}/monitors/{MONITOR_ID}", headers=headers)
print(json.dumps(response.json(), indent=2))
モニターイベントを一覧表示
GET /v1/monitors/:monitor_id/eventsを使用して、モニターのスナップショットイベントを一覧表示します。
このエンドポイントはページネーションをサポートします:
limit(デフォルトは25、最大は100)
cursor(前のレスポンスからの不透明なページネーショントークン)
イベントは最新のものから返されます。各アイテムには短期間有効な署名付きのsnapshot_urlが含まれており、プライベートスナップショットコンテンツを安全に取得できます。
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
MONITOR_ID = "monitor_n8q2x4m1ak"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.get(
f"{API_URL}/monitors/{MONITOR_ID}/events?limit=10",
headers=headers
)
print(json.dumps(response.json(), indent=2))
レスポンスの形
{
"data": [
{
"id": "run_v7k2p9m3",
"run_id": "run_v7k2p9m3",
"created": 1777960800,
"changed": true,
"summary": "価格が$49から$45に変更され、在庫が低可用性に移行しました。",
"snapshot_url": "https://olostep-monitor-snapshot.s3.amazonaws.com/private/key?...signature..."
}
],
"has_more": false,
"next_cursor": null
}
cursorが不正な場合、エンドポイントは以下を返します:
{
"error": "Invalid cursor."
}
モニターを更新する
POST /v1/monitors/:monitor_idでモニターを更新します。
サポートされている更新:
metadata(既存のメタデータとマージされます。空の文字列値を渡してキーを削除)
frequency(hourly、daily、weekly)
frequencyを更新すると、APIは内部的にモニタースケジュールを再作成します。
リクエスト例
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
MONITOR_ID = "monitor_n8q2x4m1ak"
payload = {
"frequency": "hourly",
"metadata": {
"owner": "ops-team",
"deprecated_field": ""
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
f"{API_URL}/monitors/{MONITOR_ID}",
headers=headers,
json=payload
)
print(json.dumps(response.json(), indent=2))
モニターを削除する
DELETE /v1/monitors/:monitor_idでモニターを削除します。
削除はモニターロウに対してソフトであり(statusはdeletedになります)、そのモニターに関連付けられた内部スケジューリング/シャドウエージェントリソースも削除されます。
import requests
import json
API_KEY = "<YOUR_API_KEY>"
API_URL = "https://api.olostep.com/v1"
MONITOR_ID = "monitor_n8q2x4m1ak"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
response = requests.delete(f"{API_URL}/monitors/{MONITOR_ID}", headers=headers)
print(json.dumps(response.json(), indent=2))
一般的な検証エラー
モニターエンドポイントは、一般的な無効なリクエストに対して明確な検証エラーを返します:
queryとurlの両方が欠落
frequencyが欠落している、またはサポートされていない頻度の値
emailとwebhook_urlの両方が欠落
emailとwebhook_urlの両方を提供
- 無効なメール形式
- 無効なWebhook URL(
httpまたはhttpsである必要があります)
- 無効な
monitor_id形式
エラーの例:
{
"error": "'frequency' must be one of: hourly, daily, weekly."
}