• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

英語版と翻訳版に矛盾がある場合は、英語版が優先されます。詳細については、このページを参照してください。

問題を作成する

HTTP GETとPOST

で HTTP requests送信して、REST API や外部サービスとやり取りする方法を学びます。

要件:

  • 目標APIエンドポイントURL
  • 必要な認証資格情報 (APIキー、ブラウスなど)
  • APIリクエスト/レスポンス形式の理解

データの取得と処理

REST APIエンドポイントからデータを取得します。 ヘッダーと URL は文字列化された JSON である必要があります。

このワークフローの機能:

  • HTTP GET呼び出しを実行してAPIエンドポイントからデータを取得します
  • セレクタを使用してステータスコードとレスポンスデータを抽出する
  • New RelicへのAPI応答ステータス
name: http_get_example
workflowInputs:
apiUrl:
type: String
defaultValue: 'https://api.example.com/data'
steps:
- name: fetchData
type: action
action: http.get
version: 1
inputs:
url: ${{ .workflowInputs.apiUrl }}
headers: '{"Authorization": "Bearer ${{ :secrets:api_token }}"}'
urlParams: '{"filter": "active", "limit": "10"}'
selectors:
- name: status
expression: .statusCode
- name: data
expression: .responseBody | fromjson
- name: logResponse
type: action
action: newrelic.ingest.sendLogs
version: 1
inputs:
logs:
- message: 'API returned status: ${{ .steps.fetchData.outputs.status }}'
attributes:
responseData: ${{ .steps.fetchData.outputs.data }}

キーアクション: http.getnewrelic.ingest.sendLogs

外部システムにデータを送信する

Webhook、API、または通知サービスにデータを送信します。ヘッダーは文字列化された JSON である必要があり、本文は文字列である必要があります。

このワークフローの機能:

  • HTTP POST呼び出しを実行してAPIエンドポイントにデータを送信します
  • セレクタを使用してHTTPステータスとレスポンスを抽出する
  • New Relicへの Webhook 応答ステータスをログに記録します
name: http_post_example
workflowInputs:
webhookUrl:
type: String
alertMessage:
type: String
steps:
- name: sendNotification
type: action
action: http.post
version: 1
inputs:
url: ${{ .workflowInputs.webhookUrl }}
headers: '{"Content-Type": "application/json"}'
body: '{"event": "alert_triggered", "message": "${{ .workflowInputs.alertMessage }}", "severity": "high"}'
selectors:
- name: httpStatus
expression: .statusCode
- name: response
expression: .responseBody
- name: logResult
type: action
action: newrelic.ingest.sendLogs
version: 1
inputs:
logs:
- message: 'Webhook returned status: ${{ .steps.sendNotification.outputs.httpStatus }}'

一般的な使用例:

  • CI/CD Webhook 経由でデプロイメントをトリガーする
  • チケットシステム(Jira、ServiceNow)にデータを送信する
  • カスタム通知サービスに投稿する
  • サードパーティAPIとの統合

キーアクション: http.postnewrelic.ingest.sendLogs

次のステップ

Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.