HTTP/RESTコネクタ
HTTPコネクタは、REST APIおよびWebサービスとの通信を可能にします。
コネクタタイプ:
HttpReader- HTTPエンドポイントをポーリング(GETリクエスト)HttpWriter- HTTPエンドポイントにデータを送信(POST、PUT、DELETE)
HTTP Reader
Section titled “HTTP Reader”HTTPエンドポイントを定期的にポーリング:
{ "type": "HttpReader", "config": { "endpoint": "http://api.example.com/data", "pollingRate": 5000, "method": "GET", "headers": { "Authorization": "Bearer YOUR_TOKEN", "Accept": "application/json" } }}HTTP Writer(POST)
Section titled “HTTP Writer(POST)”POSTでデータを送信:
{ "type": "HttpWriter", "config": { "endpoint": "http://api.example.com/data", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Bearer YOUR_TOKEN" } }}HTTP Writer(PUT)
Section titled “HTTP Writer(PUT)”PUTでデータを更新:
{ "type": "HttpWriter", "config": { "endpoint": "http://api.example.com/data/123", "method": "PUT", "headers": { "Content-Type": "application/json" } }}設定パラメータ
Section titled “設定パラメータ”- endpoint: プロトコルを含む完全なURL
- method: HTTPメソッド(GET、POST、PUT、DELETE)
- pollingRate: (リーダーのみ)ミリ秒単位のポーリング間隔
- headers: カスタムHTTPヘッダー(オブジェクト)
- timeout: (オプション)ミリ秒単位のリクエストタイムアウト
一般的なヘッダー
Section titled “一般的なヘッダー”{ "headers": { "Content-Type": "application/json", "Authorization": "Bearer token", "Accept": "application/json", "User-Agent": "Meddle/1.0" }}ユースケース
Section titled “ユースケース”1. 天気API統合
Section titled “1. 天気API統合”{ "type": "HttpReader", "config": { "endpoint": "https://api.weather.com/v1/current?location=factory", "pollingRate": 300000, "method": "GET", "headers": { "API-Key": "your-api-key" } }}2. Webhook統合
Section titled “2. Webhook統合”{ "type": "HttpWriter", "config": { "endpoint": "https://hooks.example.com/webhook", "method": "POST", "headers": { "Content-Type": "application/json" } }}