json-url-stdout

Sequence that pulls data from JSON url every x seconds and writes it to Instance stdout endpoint.

Description

  • Name: @scramjet/json-url-stdout
  • Version: 0.23.0
  • Language: javascript
  • Author: a-tylenda
  • Tags: easy,API,data collection,Big Data/BI,Data Producer

This is a Sequence similar to json-url-output. It also pulls the data from JSON url every x seconds, but data is written to Instance stdout endpoint. Also one more argument is added → jsonPath.

The Sequence takes three arguments:

Running

❗ Remember to setup transform-hub locally or use the platform's environment for the sequence deployment.

Sequence is ready to use, id doesn't use any external modules so no dependencies need to be installed.

Open the terminal and run the following commands:

# go to 'javascript' directory cd javascript # deploy 'json-url-output' Sequence si seq deploy json-url-stdout --args [\"https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita\",10000,\"drinks[0].strDrink\"] # see the Instance stdout si inst stdout -

Read Instance stdout

The result of called sequence's function is a value of key "strDrink" (in this case thi value is "Margarita"). It is printed out in the console using console.log(), it means that the Sequence writes it to stdout instance endpoint. Result:

$ si inst stdout - Margarita Margarita

The request is sent to API every 10 seconds, so the result will be printed out after every request until the Instance is stopped.