The purpose of this document is to detail some common example of interacting with the REST API of a running Clowder application.

Prerequisites

Tooling

These instructions will use raw curl commands to test the Clowder API but you can use:

Exploring the REST API

You can use the Swagger UI to explore existing API endpoints on the system: https://clowder.ncsa.illinois.edu/swagger/

Parameters in the API endpoints will appear in {curly-braces}.

NOTE: It appears as if this list does not include all necessary endpoints. For example, there does not appear to be a way to authenticate without using Swagger's built-in "Authorize" function.

Authentication via REST API

Relevant endpoints:

Log In

Relevant endpoint:

Accepted provider values:


$ curl --insecure http://localhost:9000/authenticate/userpass -vvv -XPOST --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'username=YourUsername' --data-urlencode 'password=YourPassword'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> POST /authenticate/userpass HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 50
> 
* upload completely sent off: 50 out of 50 bytes
< HTTP/1.1 303 See Other
< Access-Control-Allow-Origin: *
< Location: /
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Set-Cookie: id=3656a7a78433b52522cc4cd3d1b42579e76ee46c688faa5e5c4259623dfe83531008669ad7769e600ba9d1d94b2d590710d9c9cc98f6b79728ec2cd6e043f97c6e69d5d21e0ba6f7ff0528fa310bf1f2d5002348e3c2b9957d47905ac030de57b2bd9deffd450b32ee452d4c87543f65476be709ccebb7be3b0773e8488bb496; Path=/; HTTPOnly
< Set-Cookie: PLAY_SESSION=; Expires=Mon, 06 Aug 2018 20:54:32 GMT; Path=/; HTTPOnly
< Content-Length: 0
< 
* Connection #0 to host localhost left intact

The important bit here is the Set-Cookie: id=###### line. You will need to save this response cookie value and pass it in with all subsequent requests. For example, see "Log Out" below.

NOTE: Notice that the POST body here is URL-encoded Form Data, and not JSON.

Log Out

Relevant endpoint:

$ curl --insecure http://localhost:9000/logout -vvv --cookie 'id=3656a7a78433b52522cc4cd3d1b42579e76ee46c688faa5e5c4259623dfe83531008669ad7769e600ba9d1d94b2d590710d9c9cc98f6b79728ec2cd6e043f97c6e69d5d21e0ba6f7ff0528fa310bf1f2d5002348e3c2b9957d47905ac030de57b2bd9deffd450b32ee452d4c87543f65476be709ccebb7be3b0773e8488bb496'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /logout HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=3656a7a78433b52522cc4cd3d1b42579e76ee46c688faa5e5c4259623dfe83531008669ad7769e600ba9d1d94b2d590710d9c9cc98f6b79728ec2cd6e043f97c6e69d5d21e0ba6f7ff0528fa310bf1f2d5002348e3c2b9957d47905ac030de57b2bd9deffd450b32ee452d4c87543f65476be709ccebb7be3b0773e8488bb496
> 
< HTTP/1.1 303 See Other
< Access-Control-Allow-Origin: *
< Location: /login
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Set-Cookie: id=; Expires=Mon, 06 Aug 2018 20:59:05 GMT; Path=/; HTTPOnly
< Set-Cookie: PLAY_SESSION=; Expires=Mon, 06 Aug 2018 20:59:04 GMT; Path=/; HTTPOnly
< Content-Length: 0
< 
* Connection #0 to host localhost left intact


Make sure to pass in the id cookie value that you received during the "Log In" step above.

NOTE: You will notice that now the Set-Cookie response is settings the id cookie to an empty string - this clears your auth cookie from the browser, so you may discard the cookie that you received above as it may no longer be valid.

User API Keys

For simplicity, you can manage your User API keys in the Clowder UI:

  1. Log into Clowder
  2. At the top-right expand the dropdown containing your user profile picture
  3. Select "View Profile" from the dropdown

This will take you to the /profile/viewProfile/{user-id} view that will list your existing API keys, as well as allowing you to create and delete them:

You can also use the REST API to generate a new API key, but you'll need to authenticate manually first.

These endpoints can be used to create a user-specific API key for interacting with the Clowder API.

Creating a Key via REST API

Relevant endpoints:

To create a new API key with the given name for the currently-logged-in user:

$ curl --insecure 'http://localhost:9000/api/users/keys?name=testkey' -XPOST --cookie 'id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13' -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> POST /api/users/keys?name=testkey HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 63
< 
* Connection #0 to host localhost left intact
{"name":"testkey","key":"839785b9-5e23-4a1b-92f7-259294a58aed"}

You can then attach this key as a query string parameter for all subsequent API requests, instead of needing to reauthenticate manually and attaching another cookie.

NOTE: One exception is that you cannot call the /api/users/keys endpoints using an API key, as this would cause too much security risk/confusion in case an API key were to be compromised.

For example, using a User API key to call the /api/datasets endpoint would look like this:

$ curl --insecure http://localhost:9000/api/datasets?key=839785b9-5e23-4a1b-92f7-259294a58aed -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets?key=839785b9-5e23-4a1b-92f7-259294a58aed HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 411
< 
* Connection #0 to host localhost left intact
[{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]},{"id":"5ad7b5b377c8a52d73b2ac5f","name":"test_dataset","description":"","created":"Wed Apr 18 16:16:35 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5ad7b4b777c8a52d73b2ac48"]}]

Retrieving Keys via REST API

Relevant endpoints:

To retrieve a list of all existing API keys for this user:

$ curl --insecure http://localhost:9000/api/users/keys --cookie 'id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13' -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/users/keys HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 137
< 
* Connection #0 to host localhost left intact
[{"name":"testkey","key":"22da6ca7-1c66-4612-bc4d-368f92ecf9bf","identityId":{"userId":"lambert8@illinois.edu","providerId":"userpass"}}]

To retrieve a specific API key by name:

$ curl --insecure http://localhost:9000/api/users/keys/testkey --cookie 'id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13' -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/users/keys/testkey HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 135
< 
* Connection #0 to host localhost left intact
{"name":"testkey","key":"22da6ca7-1c66-4612-bc4d-368f92ecf9bf","identityId":{"userId":"lambert8@illinois.edu","providerId":"userpass"}}

Deleting Keys via REST API

Relevant endpoints:

To delete an existing API key:

$ curl --insecure 'http://localhost:9000/api/users/keys/testkey' -XDELETE --cookie 'id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13' -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> DELETE /api/users/keys/testkey HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13
> 
< HTTP/1.1 204 No Content
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Credentials: true
< Content-Length: 0
< 
* Connection #0 to host localhost left intact


Spaces

Relevant endpoints:

To list all spaces that you can view:

$ curl --insecure http://localhost:9000/api/spaces -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/spaces HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 432
< 
* Connection #0 to host localhost left intact
[{"id":"5b6a0cf877c86409e0925d85","name":"a space","description":"","created":"Tue Aug 07 16:19:52 CDT 2018"},{"id":"5b21310077c8829cd73f8899","name":"test","description":"","created":"Wed Jun 13 09:58:08 CDT 2018"},{"id":"5b0724b277c85c0c70e371d8","name":"newspace","description":"","created":"Thu May 24 15:46:42 CDT 2018"},{"id":"5ad7b4b777c8a52d73b2ac48","name":"test","description":"","created":"Wed Apr 18 16:12:23 CDT 2018"}]

To list all datasets within a space:

$ curl --insecure http://localhost:9000/api/spaces/5b0724b277c85c0c70e371d8/datasets -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/spaces/5b0724b277c85c0c70e371d8/datasets HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 202
< 
* Connection #0 to host localhost left intact
[{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]}]

Datasets

Relevant endpoints:

Listing Datasets

Relevant endpoints:

To list all datasets that you can view:

$ curl --insecure http://localhost:9000/api/datasets --cookie 'id=3656a7a78433b52522cc4cd3d1b42579e76ee46c688faa5e5c4259623dfe83531008669ad7769e600ba9d1d94b2d590710d9c9cc98f6b79728ec2cd6e043f97c6e69d5d21e0ba6f7ff0528fa310bf1f2d5002348e3c2b9957d47905ac030de57b2bd9deffd450b32ee452d4c87543f65476be709ccebb7be3b0773e8488bb496' -vvv
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=3656a7a78433b52522cc4cd3d1b42579e76ee46c688faa5e5c4259623dfe83531008669ad7769e600ba9d1d94b2d590710d9c9cc98f6b79728ec2cd6e043f97c6e69d5d21e0ba6f7ff0528fa310bf1f2d5002348e3c2b9957d47905ac030de57b2bd9deffd450b32ee452d4c87543f65476be709ccebb7be3b0773e8488bb496
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 411
< 
* Connection #0 to host localhost left intact
[{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]},{"id":"5ad7b5b377c8a52d73b2ac5f","name":"test_dataset","description":"","created":"Wed Apr 18 16:16:35 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5ad7b4b777c8a52d73b2ac48"]}]

To list all datasets that you can edit:

$ curl --insecure http://localhost:9000/api/datasets/canEdit -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets/canEdit HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 411
< 
* Connection #0 to host localhost left intact
[{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]},{"id":"5ad7b5b377c8a52d73b2ac5f","name":"test_dataset","description":"","created":"Wed Apr 18 16:16:35 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5ad7b4b777c8a52d73b2ac48"]}]

Querying Dataset Metadata

Relevant endpoints:

To retrieve a single dataset:

$ curl --insecure http://localhost:9000/api/datasets/5b4e510577c8fff0a479786c -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets/5b4e510577c8fff0a479786c HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 200
< 
* Connection #0 to host localhost left intact
{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]}

To retrieve user-defined metadata for this dataset:

$ curl --insecure http://localhost:9000/api/datasets/5b4e510577c8fff0a479786c/metadata -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets/5b4e510577c8fff0a479786c/metadata HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 6331
< 
[{"id":"5b0724b277c85c0c70e371dd","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Alternative Title","uri":"http://purl.org/dc/terms/alternative","type":"string"}},{"id":"5b21425beff884a87ef11887","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Alternative Title","uri":"http://purl.org/dc/terms/alternative","type":"string"}},{"id":"5b21425beff884a87ef11888","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Audience","uri":"http://purl.org/dc/terms/audience","type":"string"}},{"id":"5b0724b277c85c0c70e371de","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Audience","uri":"http://purl.org/dc/terms/audience","type":"string"}},{"id":"5b21425beff884a87ef1188b","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"CSDMS Standard Name","uri":"http://csdms.colorado.edu/wiki/CSN_Searchable_List","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/CSN"}},{"id":"5b0724b277c85c0c70e371df","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"CSDMS Standard Name","uri":"http://csdms.colorado.edu/wiki/CSN_Searchable_List","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/CSN"}},{"id":"5b0724b277c85c0c70e371e0","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Date and Time","uri":"http://purl.org/dc/terms/date","type":"datetime"}},{"id":"5b21425beff884a87ef1188a","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Date and Time","uri":"http://purl.org/dc/terms/date","type":"datetime"}},{"id":"5b0724b277c85c0c70e371e1","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Funding Institution","uri":"http://sead-data.net/terms/FundingInstitution","type":"string"}},{"id":"5b21425beff884a87ef11891","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Funding Institution","uri":"http://sead-data.net/terms/FundingInstitution","type":"string"}},{"id":"5b0724b277c85c0c70e371e2","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"GeoJSON","uri":"http://geojson.org/geojson-spec.html","type":"wkt"}},{"id":"5b21425beff884a87ef11896","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"GeoJSON","uri":"http://geojson.org/geojson-spec.html","type":"wkt"}},{"id":"5b0724b277c85c0c70e371e3","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Grant Number","uri":"http://sead-data.net/terms/GrantNumber","type":"string"}},{"id":"5b21425beff884a87ef11892","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Grant Number","uri":"http://sead-data.net/terms/GrantNumber","type":"string"}},{"id":"5b0724b277c85c0c70e371e4","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"ODM2 Variable Name","uri":"http://vocabulary.odm2.org/variablename","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/sn/odm2"}},{"id":"5b21425beff884a87ef1188c","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"ODM2 Variable Name","uri":"http://vocabulary.odm2.org/variablename","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/sn/odm2"}},{"id":"5b0724b277c85c0c70e371e5","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Primary/Initial Publication","uri":"http://sead-data.net/terms/PrimaryPublication","type":"string"}},{"id":"5b21425beff884a87ef11895","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Primary/Initial Publication","uri":"http://sead-data.net/terms/PrimaryPublication","type":"string"}},{"id":"5b21425beff884a87ef11890","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Principal Investigator(s)","uri":"http://sead-data.net/terms/PrincipalInvestigator","type":"string"}},{"id":"5b0724b277c85c0c70e371e6","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Principal Investigator(s)","uri":"http://sead-data.net/terms/PrincipalInvestigator","type":"string"}},{"id":"5b0724b277c85c0c70e371e7","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"References","uri":"http://purl.org/dc/terms/references","type":"string"}},{"id":"5b21425beff884a87ef11889","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"References","uri":"http://purl.org/dc/terms/references","type":"string"}},{"id":"5b0724b277c85c0c70e371e8","spaceId":"5b0724b277c85c0c70e371d8","json":{"labe* Connection #0 to host localhost left intact
l":"Related Publications","uri":"http://sead-data.net/terms/RelatedPublications","type":"string"}},{"id":"5b21425beff884a87ef11893","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Related Publications","uri":"http://sead-data.net/terms/RelatedPublications","type":"string"}},{"id":"5b0724b277c85c0c70e371e9","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"SAS Spatial Geocode","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/geocode","type":"listgeocode","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/geocode","query_parameter":"loc"}},{"id":"5b21425beff884a87ef1188e","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"SAS Spatial Geocode","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/geocode","type":"listgeocode","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/geocode","query_parameter":"loc"}},{"id":"5b0724b277c85c0c70e371ea","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"SAS Variable Name","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/vars","type":"scientific_variable","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/vars/unit/udunits2","query_parameter":"term"}},{"id":"5b21425beff884a87ef1188d","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"SAS Variable Name","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/vars","type":"scientific_variable","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/vars/unit/udunits2","query_parameter":"term"}},{"id":"5b0724b277c85c0c70e371eb","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Time Periods","uri":"http://purl.org/dc/terms/PeriodOfTime","type":"string"}},{"id":"5b21425beff884a87ef11894","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Time Periods","uri":"http://purl.org/dc/terms/PeriodOfTime","type":"string"}},{"id":"5b21425beff884a87ef1188f","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Unit","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2"}},{"id":"5b0724b277c85c0c70e371ec","spaceId":"5b0724b277c85c0c70e371d8","json":{"label":"Unit","uri":"http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2","type":"list","definitions_url":"http://ecgs.ncsa.illinois.edu/gsis/sas/unit/udunits2"}}]

Download a Dataset

Relevant endpoints:

To download an entire dataset as a .zip file:

$ curl --insecure http://localhost:9000/api/datasets/5b4e510577c8fff0a479786c/download -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f' --silent
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets/5b4e510577c8fff0a479786c/download HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Transfer-Encoding: chunked
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/zip
< Content-Disposition: attachment; filename*=UTF-8''asdf.zip
< 
E?Mdata//_info.jsonE??n?0
                         ??<??3?ZԐ??&8 4.?/gX
                                             	??m???%?8???[??
                                                               AV?B?;?m#?2?s?ѝڨ~m??O
... ... ... ... ... ... ... ... ... ... ... ... etc etc etc ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

NOTE: The response here is the raw bytes of a ZIP file, so it will seem like nonsense is being returned from curl.

Files

Relevant endpoints:

Listing Files

Relevant endpoints:

To list all files within a dataset:

$ curl --insecure http://localhost:9000/api/datasets/5b4e510577c8fff0a479786c/listFiles -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/datasets/5b4e510577c8fff0a479786c/listFiles HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 2369
< 
* Connection #0 to host localhost left intact
[{"size":"70561","date-created":"Tue Jul 17 15:26:54 CDT 2018","id":"5b4e510e77c8fff0a4797871","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 15:27:27 CDT 2018","id":"5b4e512f77c8fff0a4797879","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 15:54:14 CDT 2018","id":"5b4e577677c8fff0a47978a4","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 15:58:57 CDT 2018","id":"5b4e589177c8fff0a47978d7","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 15:59:23 CDT 2018","id":"5b4e58ab77c8fff0a4797900","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 15:59:52 CDT 2018","id":"5b4e58c877c8fff0a479792a","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:10:54 CDT 2018","id":"5b4e5b5e77c8fff0a4797970","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:12:24 CDT 2018","id":"5b4e5bb877c8fff0a479799a","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:14:56 CDT 2018","id":"5b4e5c5077c8fff0a47979cc","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:15:53 CDT 2018","id":"5b4e5c8977c8fff0a47979e1","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:15:57 CDT 2018","id":"5b4e5c8d77c8fff0a47979e7","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:16:16 CDT 2018","id":"5b4e5ca077c8fff0a47979ed","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:16:41 CDT 2018","id":"5b4e5cb977c8fff0a47979fa","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:16:57 CDT 2018","id":"5b4e5cc977c8fff0a4797a0b","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:17:14 CDT 2018","id":"5b4e5cda77c8fff0a4797a1c","contentType":"image/png","filename":"244599644.png"},{"size":"70561","date-created":"Tue Jul 17 16:35:30 CDT 2018","id":"5b4e612277c8fff0a4797a36","contentType":"image/png","filename":"244599644.png"}]

Querying File Metadata

Relevant endpoints:

To list off static metadata for a file (e.g. file name, type, size, creation date):

$ curl --insecure http://localhost:9000/api/files/5b4e577677c8fff0a47978a4/metadata -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/files/5b4e577677c8fff0a47978a4/metadata HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 228
< 
* Connection #0 to host localhost left intact
{"size":"70561","date-created":"Tue Jul 17 15:54:14 CDT 2018","id":"5b4e577677c8fff0a47978a4","authorId":"5ad76e39693ea57ec7f8648a","content-type":"image/png","filename":"244599644.png","status":"PROCESSED","filedescription":""}

To list off dynamic metadata for a file (e.g. extracted or community-added metadata):

$ curl --insecure http://localhost:9000/api/files/5b4e5cb977c8fff0a47979fa/technicalmetadatajson -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/files/5b4e5cb977c8fff0a47979fa/technicalmetadatajson HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: application/json; charset=utf-8
< Content-Length: 2417
< 
* Connection #0 to host localhost left intact
[{"Border color":"srgba(223,223,223,1)","Compression":"Zip","Elapsed time":"0:01.009","Artifacts":{"verbose":true,"filename":"/tmp/tmp7ecihP.png"},"height":341,"Interlace":"None","Compose":"Over","Tainted":false,"Filesize":"70.6KB","Pixels per second":"12.58MB","Chromaticity":{"red primary":"(0.64,0.33)","green primary":"(0.3,0.6)","blue primary":"(0.15,0.06)","white point":"(0.3127,0.329)"},"Type":"TrueColorAlpha","Print size":"5.125x4.73611","Channel depth":{"blue":"8-bit","alpha":"1-bit","green":"8-bit","red":"8-bit"},"Background color":"white","Transparent color":"none","Mime type":"image/png","Format":"PNG (Portable Network Graphics)","Image statistics":{"Overall":{"skewness":2.67042,"min":"0 (0)","max":"255 (1)","standard deviation":"40.5176 (0.158893)","kurtosis":10.2121,"mean":"59.7823 (0.23444)"}},"Number pixels":"126K","width":369,"Channel statistics":{"Blue":{"skewness":1.15542,"min":"33 (0.129412)","max":"255 (1)","standard deviation":"45.9088 (0.180035)","kurtosis":0.797616,"mean":"101.427 (0.397754)"},"Alpha":{"skewness":0,"min":"255 (1)","max":"255 (1)","standard deviation":"0 (0)","kurtosis":0,"mean":"255 (1)"},"Green":{"skewness":1.33268,"min":"35 (0.137255)","max":"255 (1)","standard deviation":"46.7538 (0.183348)","kurtosis":1.12144,"mean":"82.284 (0.322682)"},"Pixels":125829,"Red":{"skewness":1.9517,"min":"0 (0)","max":"255 (1)","standard deviation":"47.6777 (0.186972)","kurtosis":3.54331,"mean":"55.418 (0.217325)"}},"Class":"DirectClass","Matte color":"grey74","Page geometry":"369x341+0+0","Geometry":"369x341+0+0","Colorspace":"sRGB","Depth":"8-bit","User time":"0.010u","Rendering intent":"Perceptual","Resolution":"72x72","Gamma":0.45455,"Image":"/tmp/tmp7ecihP.png","Properties":{"date":{"create":"2018-07-17T21:16:58+00:00","modify":"2018-07-17T21:16:58+00:00"},"png":{"bKGD":"chunk was found (see Background color, above)","IHDR":{"color-type-orig":6,"color_type":"6 (RGBA)","bit_depth":8,"width,height":"369, 341","bit-depth-orig":8,"interlace_method":"0 (Not interlaced)"},"pHYs":"x_res=72, y_res=72, units=0","text":"2 tEXt/zTXt/iTXt chunks were found","sRGB":"intent=0 (Perceptual Intent)","gAMA":"gamma=0.45455 (See Gamma, above)","cHRM":"chunk was found (see Chromaticity, above)"},"signature":"d63ba6d42ca061b2103c98d480e72d26d704eb259eda0cda3797eb26dfbfe1fd"},"Version":"ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org","Iterations":0}]

Download a File

Relevant endpoints:

To download a particular file:

$ curl --insecure http://localhost:9000/api/files/5b4e5cb977c8fff0a47979fa -vvv --cookie 'id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9000 (#0)
> GET /api/files/5b4e5cb977c8fff0a47979fa HTTP/1.1
> Host: localhost:9000
> User-Agent: curl/7.54.0
> Accept: */*
> Cookie: id=9fc6734ca6f963af97327d668ac57455b06080277b38c50109955df81fd5e6159a2143d221381a11d99e4c727e00c72f59b65dae99999a956a63690ad53261bcd4c5515e28a0efe2d9a449397cf6f80226989db49ee8ddf6fba1e8fa4d1497bac4dbddfc00274e128bc5b224901fdaf9f31bff020b684a7bbceaf3197921a77f
> 
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: 
< Transfer-Encoding: chunked
< Access-Control-Allow-Methods: *
< Access-Control-Allow-Credentials: true
< Content-Type: image/png
< Content-Disposition: attachment; filename*=UTF-8''244599644.png
< 
?PNG

IHDRq?߄gAMA??
             ?asRGB??? cHRMz&?????u0?`:?p??Q<bKGD???????	pHYsHHF?k>?IDATx???W?\i??	??v?=????ԥUWuU??,?i?6?????ٷ???}??݇??????ؘ??&??a7??-??U]??R?3?:Z?G?VW??uwD ?L $2??o@??????|???p?w?.t?A|&!>?t?Atppt?xt??g!?At?FG?w?A|?!??뺸.???㸸???? ?(????㸀? ??????n?q??]??q??W?5:A???At?9Ɓ??뺤Q?0?ט?'????CFz(?*\??@O:???QDA???
... ... ... ... ... ... ... ... ... ... ... ... etc etc etc ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

NOTE: The response here is the raw bytes of a ZIP file, so it will seem like nonsense is being returned from curl.