Skip to content

Commit

Permalink
Create Server.Enrichment.JsonLookup.yaml (#924)
Browse files Browse the repository at this point in the history
artifact that allows pulling in JSON lists from an external URL
  • Loading branch information
shortstack authored Nov 30, 2024
1 parent 53ba3bb commit 459a165
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions content/exchange/artifacts/Server.Enrichment.JsonLookup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Server.Enrichment.JsonLookup
description: Allows pulling in JSON lists from an external URL to perform lookups against
author: Whitney Champion (@shortxstack)
type: SERVER

parameters:
- name: LookupUrl
type: string
default:

sources:
- query: |
// Assumes JSON is formatted like this:
// {
// "list":
// [
// {"key":"value"},
// {"key":"value"}
// ]
// }
LET Data = SELECT parse_json(data=Content) AS Lookup
FROM http_client(url=LookupUrl, headers=dict(`Accept`="application/json"), method='GET')
SELECT
Lookup.list AS Lookup
FROM Data
//
// Notebook usage:
//
// LET List <= SELECT Lookup from Artifact.Custom.Server.Enrichment.JsonLookup(LookupUrl="https://")
// SELECT * FROM foreach(row=array(array=List.Lookup))
//

0 comments on commit 459a165

Please sign in to comment.