6.1.1 Listing Available Datasets
The following request lists all the datasets available to the user who is “embedded” inside the access token:
HTTP GET Request
curl -k https://localhost:4040/spatialstudio/oauth/v1/datasets \
--header "Authorization: Bearer <MY_TOKEN>”
The preceding request will return a JSON document containing all the
datasets that are owned or created by the token owner, as well as any dataset that
was marked as public (by its owner) which are accessible to any other application
user. The JSON response includes a JSON object that describes every aspect of the
dataset, such as id
, name
, type
,
source
table name (if applicable), as well as its columns and a
host of other metadata.
Note that the access token used in the preceding request must be a
general-purpose one (either read-only
or
read-write
, depending on your specific use case), as opposed to
a dataset streaming-only token. This is because a stream-only
access token cannot be used to query any metadata from the Spatial Studio server. As
a result, if you pass in a stream-only token in the preceding request, you will not
get the desired response.
Alternatively, you can also provide an additional query parameter,
fields, to filter the data that is returned for each dataset. For
instance, if you prefer only the unique id
and
name
of all the available datasets in the response, then the
request is as follows:
Request with Query Parameter:
curl -k https://localhost:4040/spatialstudio/oauth/v1/datasets?fields=id,name \
--header "Authorization: Bearer <MY_TOKEN>”
Response:
{"items":[
{
"id" : "3ee71ae5ba84cc5afd0728643e878f29",
"name" : "LANDSAT5_IMAGES"
},
{
"id" : "d06d0b711e10997c1c886b731b1c45b8",
"name" : "AIRPORT_POINT"
},
{
"id" : "fd6f55d0773dcda639e07b00e5ba431a",
"name" : "INTERSTATES"
},
{
"id" : "5b68bd621ee6f58af0bd0cb20f600a38",
"name" : "NY_INDIAN_TERRITORIES"
}]
}
- Each dataset is represented as an element in the items array.
- Each item (dataset) contains both the
id
and thename
of a dataset. Theid
returned in the response is the unique ID of the dataset. Note that Spatial Studio assigns a globally uniqueid
to all the objects you create, such as datasets, projects, connections or data sources, and even columns inside a dataset. In most cases, the REST API uses only these uniqueid
s when referencing a user created object such as a dataset or connection.
Related Topics
Parent topic: Using cURL with Spatial Studio REST APIs