Using Your Authentication Key
UPDATED Thursday July 15, 10:08 PM PST
To authorize, replace the $WATTPRICER_KEY
in the command below with the api your and/or your organization were given when signing up for WattPricer.
cURL command
# In a shell, you should pass the correct header with each requestcurl "https://wprice.io/api/v1/present/load/fiveMinTotalLoad?zone_key=US-MISO" \ -H "x-api-key: $WATTPRICER_KEY"
Make sure to set the value of $WATTPRICER_KEY
to your account"s personal API key.
The API key should be included as a header in all requests:
API token placeholder
x-api-key: $WATTPRICER_KEY
API Key as a header instead of a query parameter
WattPricer passes along your API key as a header instead of a query parameter. This is so your all-important API key is not exposed in the URL.
If using a shell script, one can use
Setting your API token as an environment variable with bash or zsh
WATTPRICER_KEY=Th1sI5NoT4R3AlK3YuS3Y0UrOwN; export WATTPRICER_KEYcurl "https://wprice.io/api/v1/present/load/fiveMinTotalLoad?zone_key=US-MISO" \ -H "x-api-key: $WATTPRICER_KEY"
or
Setting your API token as an environment variable with fish
WATTPRICER_KEY=Th1sI5NoT4R3AlK3YuS3Y0UrOwN; bass export WATTPRICER_KEYcurl "https://wprice.io/api/v1/present/load/fiveMinTotalLoad?zone_key=US-MISO" \ -H "x-api-key: $WATTPRICER_KEY"
Take care
To avoid extraneous charges, or the exhaustion of your quota, store the key as an environment variable. Make sure to not store it unencrypted on public repos.