• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

REST API polling and logging

Poll a REST API endpoint, loop through results, and log data to New Relic.

Important

Selectors are optional for full payloads. Most workflow tools support direct response object references.

Simple GET and log

Basic API polling and full response logging:

What this workflow does:

REST API with loops and selectors

Fetch all results from REST API, loop through items, make individual calls, and log extracted data.

Requirements: API access and log ingest permissions.

What this workflow does:

  • Fetch all results from REST API endpoint
  • Loop through each response result
  • Make individual API calls per item using loop data
  • Extract specific fields using selectors
  • Log extracted data to New Relic with custom attributes

Key actions: http.get, newrelic.ingest.sendLogs

name: pokemon_workflow
description: ''
steps:
- name: get_all_pokemons
type: action
action: http.get
version: '1'
inputs:
url: https://pokeapi.co/api/v2/pokemon
selectors:
- name: pokemons
expression: .responseBody | fromjson.results
- name: pokemon_loop
type: loop
for:
in: ${{ .steps.get_all_pokemons.outputs.pokemons }}
steps:
- name: get_individual_pokemon
type: action
action: http.get
version: '1'
inputs:
url: ${{ .steps.pokemon_loop.loop.element.url }}
selectors:
- name: pokemon_name
expression: .responseBody | fromjson.name
- name: pokemon_id
expression: .responseBody | fromjson.id
- name: pokemon_stats
expression: .responseBody | fromjson.stats
- name: log_pokemon_info
type: action
action: newrelic.ingest.sendLogs
version: '1'
inputs:
logs:
- message: >-
Pokemon name is: ${{
.steps.get_individual_pokemon.outputs.pokemon_name}}, Id: ${{
.steps.get_individual_pokemon.outputs.pokemon_id}}
attributes:
pokemon_stats: ${{ .steps.get_individual_pokemon.outputs.pokemon_stats}}
next: continue
next: end

REST API to CSV conversion

Fetch API data, convert JSON to CSV, log to New Relic, and share via Slack.

Requirements: API access and Slack token in secrets.

What this workflow does:

  • Fetch time data from World Time API by timezone
  • Convert JSON response to CSV
  • Log CSV to New Relic
  • Post CSV to Slack channel

Key actions: http.get, utils.transform.toCSV, newrelic.ingest.sendLogs, slack.chat.postMessage

name: jsontocsv
workflowInputs:
timezone:
type: String
defaultValue: 'America/Los_Angeles'
steps:
- name: getCurrentTime
type: action
action: http.get
version: 1
inputs:
url: 'https://worldtimeapi.org/api/timezone/${{ .workflowInputs.timezone }}'
- name: csv1
type: action
action: utils.transform.toCSV
version: 1
inputs:
json: ${{ .steps.getCurrentTime.outputs.responseBody }}
- name: logOutput
type: action
action: newrelic.ingest.sendLogs
version: 1
inputs:
logs:
- message: 'CSV: ${{ .steps.csv1.outputs.csv }}'
- name: postCsv
type: action
action: slack.chat.postMessage
version: 1
inputs:
channel: test-channel-workflow
text: "Current Date details"
attachment:
filename: 'file.csv'
content: ${{ .steps.csv1.outputs.csv }}
token: ${{ :secrets:dn_staging_slack_token }}

What's next

Droits d'auteur © 2026 New Relic Inc.

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