# Datasets ## List all datasets **get** `/api/v1/datasets` List all datasets ### Returns - `DatasetList = object { datasets }` - `datasets: array of Dataset` - `id: string` Dataset ID - `inserted_at: string` Creation timestamp - `name: string` Dataset name - `slug: string` URL-friendly slug - `updated_at: string` Last update timestamp - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL ### Example ```http curl https://plaza.fyi/api/v1/datasets \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` #### Response ```json { "datasets": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "source_url" } ] } ``` ## Create a new dataset (admin only) **post** `/api/v1/datasets` Create a new dataset (admin only) ### Body Parameters - `name: string` Dataset name - `slug: string` URL-friendly slug - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL ### Returns - `Dataset = object { id, inserted_at, name, 6 more }` - `id: string` Dataset ID - `inserted_at: string` Creation timestamp - `name: string` Dataset name - `slug: string` URL-friendly slug - `updated_at: string` Last update timestamp - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL ### Example ```http curl https://plaza.fyi/api/v1/datasets \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $PLAZA_API_KEY" \ -d '{ "name": "name", "slug": "slug" }' ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "source_url" } ``` ## Get dataset by ID **get** `/api/v1/datasets/{id}` Get dataset by ID ### Path Parameters - `id: string` ### Returns - `Dataset = object { id, inserted_at, name, 6 more }` - `id: string` Dataset ID - `inserted_at: string` Creation timestamp - `name: string` Dataset name - `slug: string` URL-friendly slug - `updated_at: string` Last update timestamp - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL ### Example ```http curl https://plaza.fyi/api/v1/datasets/$ID \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` #### Response ```json { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "inserted_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "updated_at": "2019-12-27T18:11:19.117Z", "attribution": "attribution", "description": "description", "license": "license", "source_url": "source_url" } ``` ## Delete a dataset **delete** `/api/v1/datasets/{id}` Delete a dataset ### Path Parameters - `id: string` ### Example ```http curl https://plaza.fyi/api/v1/datasets/$ID \ -X DELETE \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` ## Query features in a dataset **get** `/api/v1/datasets/{id}/features` Query features in a dataset ### Path Parameters - `id: string` ### Query Parameters - `cursor: optional string` Cursor for pagination - `limit: optional number` Maximum results ### Returns - `FeatureCollection = object { features, type }` Bare GeoJSON FeatureCollection. Pagination metadata is returned in HTTP headers (X-Limit, X-Has-More, X-Next-Cursor, X-Next-Offset, Link). - `features: array of GeoJsonFeature` - `geometry: GeoJsonGeometry` - `coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number` GeoJSON coordinates array (nesting depth varies by geometry type) - `array of number` - `array of array of number` - `array of array of array of number` - `array of array of array of array of number` - `type: "Point" or "LineString" or "Polygon" or 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: map[unknown]` - `type: "Feature"` - `"Feature"` - `id: optional string` Feature identifier (type/osm_id) - `osm_id: optional number` OpenStreetMap ID - `type: "FeatureCollection"` - `"FeatureCollection"` ### Example ```http curl https://plaza.fyi/api/v1/datasets/$ID/features \ -H "Authorization: Bearer $PLAZA_API_KEY" ``` ## Domain Types ### Dataset - `Dataset = object { id, inserted_at, name, 6 more }` - `id: string` Dataset ID - `inserted_at: string` Creation timestamp - `name: string` Dataset name - `slug: string` URL-friendly slug - `updated_at: string` Last update timestamp - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL ### Dataset List - `DatasetList = object { datasets }` - `datasets: array of Dataset` - `id: string` Dataset ID - `inserted_at: string` Creation timestamp - `name: string` Dataset name - `slug: string` URL-friendly slug - `updated_at: string` Last update timestamp - `attribution: optional string` Attribution text - `description: optional string` Dataset description - `license: optional string` License identifier - `source_url: optional string` Source data URL