Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 1.79 KB

README.md

File metadata and controls

63 lines (48 loc) · 1.79 KB

DataStream Logo
DataStream.sh

DataStream.org API helper. See API documentation for query string values and structure.

Install (MacOS)

curl -o /usr/local/bin/datastreamsh https://raw.githubusercontent.com/datastreamapp/datastreamsh/main/datastream.sh
chmod +x /usr/local/bin/datastreamsh

Use

This package has been tested on MacOS.

datastreamsh command [options...]

Commands

  • setup: Prompts for API key, will be save to ~/.datastream in plain text. Not setting up will prompt for x-api-key on ever command.
  • metadata: Wraps /v1/odata/v4/Metadata API endpoint
  • locations: Wraps /v1/odata/v4/Locations API endpoint
  • observations: Wraps /v1/odata/v4/Observations API endpoint
  • records: Wraps /v1/odata/v4/Records API endpoint

Options

  • --select: What parameters to be returned
  • --filter: What you want to , in OData format
  • --format: Print output in alternative format (Allowed: JSONSTREAM, CSV; Default: JSONSTREAM)
  • --top: Number of results to return per request (Default: 10000)
  • --domain: Use to point at testing environments

Example: Setup

# datastreamsh setup
$ datastreamsh setup
x-api-key: # copy and paste API key here and press enter

Example: Basic

# datastreamsh command [options...]
$ datastreamsh locations --select "..." --filter "..."

Example: save as CSV to file

# datastreamsh command --format CSV --select <select> [options...]
$ datastreamsh records --format CSV --select "..." --filter "..." > file.csv