How to issue requests to HSDS Lambda?

Hi, thanks for trying out HSDS lambda functions!

For the lambda event, you’ll need to provide a JSON that will tell the code how to fetch the data. The structure is basically what’s documented here: https://github.com/HDFGroup/hdf-rest-api wrapped up in a json with keys: “method”, “path”, and “params”. (the example in the docs are using an out-dated format that had “request” instead of “path”).

method will be: “GET”, “POST”, “PUT”, or “DELETE”. (the standard http actions)
path: is just the http path (i.e. the part after the service endpoint)
params: are the query parameters for the request

Also you can have a “body” key (for POST requests), and a “headers” key for any http headers (typically you don’t need this).

In the AWS Management Console for Lambda, it’s convenient to setup some test events like this one:

  {
      "method": "GET",
      "path": "/datasets/d-d29fda32-85f3-11e7-bf89-0242ac110008/value",
      "params": {
        "domain": "/nrel/wtk-us.h5",
        "select": "[:5000,620,1401]",
        "bucket": "nrel-pds-hsds"
      }
    }

With these you should get an output equivalent to the following h5pyd code:

f = h5pyd.File("/nrel/wtk-us.h5", bucket="nrel-pds-hsds")
dset = f["windspeed_80m"]
data = dset[0:100,620,1401]
print(data)

Let me know if that works for you.

In your example, I’m guessing that lambda code isn’t able to find any relevant data. It should return a 404 (not found) or 403 (unauthorized), but instead is just returning the /about response. I’ll look into this.