From 459a165ae6893e946a7d6ed5483d23e28cd2a1b1 Mon Sep 17 00:00:00 2001 From: Whitney Champion Date: Sat, 30 Nov 2024 17:30:09 -0500 Subject: [PATCH] Create Server.Enrichment.JsonLookup.yaml (#924) artifact that allows pulling in JSON lists from an external URL --- .../Server.Enrichment.JsonLookup.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 content/exchange/artifacts/Server.Enrichment.JsonLookup.yaml diff --git a/content/exchange/artifacts/Server.Enrichment.JsonLookup.yaml b/content/exchange/artifacts/Server.Enrichment.JsonLookup.yaml new file mode 100644 index 00000000000..64fb7e9cc71 --- /dev/null +++ b/content/exchange/artifacts/Server.Enrichment.JsonLookup.yaml @@ -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)) + // +