Poll a REST API endpoint, loop through results, and log data to New Relic.
Importante
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:
- Trigger via schedule (e.g., every 5 minutes) or manual run
- HTTP Request Step:
- Method: GET
- URL: https://pokeapi.co/api/v2/pokemon
- Save response body to variable (e.g.,
{{.http_response}})
- Log/Create Event Step:
- Send entire
{{.http_response.body}}as payload - No selectors needed—pass through raw JSON
- Send entire
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: endREST 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
- Advanced workflows: Complex automation patterns
- Loops: Learn more about loop patterns