POST /datasets
Description
Create a new dataset and define the dataset schema.
The schema provided should be an exact representation of the dataset you are loading. All schema properties must be present in the dataset file you are loading.
This API call should be made before loading a new dataset to the Dataset Exchange API. The API call will return the ID of your newly defined dataset, which you will need for subsequent API calls.
Parameters
| Parameter | Type | Description | Note |
|---|---|---|---|
name | string | Name of dataset | Required |
description | string | Short description of dataset | Optional |
schema | object | Must indicate a primary key and include schema properties. | Required |
primaryKey | array | An array of schema property names that will act as the primary key of each dataset record. Must have, at minimum, one value. The value (or composite of values, if multiple properties are specified) for each record must be unique as datasets are deduplicated based on the specified primary key when data is loaded. | Required - A minimum of one value |
properties | array | An array of objects with name, required and type properties. Valid type values are: string, boolean and integer. See example below. | Required |
tagIds | array | Array of IDs to indicate a permission tag for accessing the dataset. Available IDs can be found at GET /datasets/tags as movementAppId | Optional |
URL Structure
https://app.movementinfrastructure.org/api/v1/datasets
Example Request Body
{
"name": "October Door Knocking",
"description": "All of the doors for knocking",
"schema": {
"primaryKey": ["van_id"],
"properties": [
{
"name": "van_id",
"required": true,
"type": "string"
},
{
"name": "first_name",
"required": true,
"type": "string"
},
{
"name": "last_name",
"required": true,
"type": "string"
},
{
"name": "knock_count",
"required": true,
"type": "integer"
},
{
"name": "answered_door",
"required": true,
"type": "boolean"
}
]
}
},
"tagIds": [{"movementAppId": "89ex3a5-mpl3-43f0-e198-x45a9m58p1ee"}]
}Example Response Body
{
"datasetId": "812e3xam4-5678-91ple-abdc-312692jk2lm",
"name": "October Door Knocking",
"description": "All of the doors for knocking",
"dateCreated": "2024-08-21T15:41:03.07133",
"recordCount": 10000,
"dateLastRecordUpdated": null,
"createdBy": {
"userId": 11111,
"displayName": "My Test DXAPI App",
"email": ""
},
"createdByWorkspace": {
"workspaceId": 1235643,
"displayName": "Soledad for Governor"
},
"datasetTags": [
{
"datasetTagId":"3xam112-p346-7789-89pl-876e6q43aa2b",
"name":"Example Texting Tool App",
"movementAppId":"11ex3a3-mpl3-43e0-o198-n45e9a58b1cd"
},
{
"datasetTagId":"3xam112-p123-4456-89pl-987e6q54aa5b",
"name":"My Test DXAPI App",
"movementAppId":"89ex3a5-mpl3-43f0-e198-x45a9m58p1ee"
}
],
}Updated 21 days ago
What’s Next