Datasets: Add Source Files
This method allows files published on the web to be added to a data.world dataset via their URL. We also store that source URL so you can easily update your file anytime it changes via the fetch latest link on the data.world dataset page or by triggering the sync api.
Just a few examples you might import data from:
Method
POST /datasets/{owner}/{id}/files
Parameters
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
owner | Dataset owner username. Included in data.world dataset URL path, after domain. For example, jonloyens in https://data.world/jonloyens/an-intro-to-dataworld-dataset |
path | string |
id | Dataset id. Included in data.world dataset URL, after owner's username. For example, an-intro-to-dataworld-dataset in https://data.world/jonloyens/an-intro-to-dataworld-dataset |
path | string |
body | List of files to add to dataset. - name (required): the filename including the file extension. If a file by that name already exists in the dataset, the file will be updated/overwritten. - url (required) should be the public, full direct-download path to file. |
body | JSON |
JSON schema
{
"files": [
{
"name": "string",
"source": {
"url": "string"
},
"description": "string",
"labels": [
"string"
]
}
]
}
Response
JSON schema
{
"message": "string"
}
Errors
HTTP Status Code | Reason | Solution |
---|---|---|
400 | Bad request. | Check syntax and URIs. |
401 | Unauthorized | Verify credentials / API key |
403 | Forbidden | |
404 | Not found. | |
422 | Bad request. | Check syntax and URIs. |
500 | Server error. |
Request URL:
https://api.data.world/v0/datasets/jonloyens/an-intro-to-dataworld-dataset/files
cURL:
curl https://api.data.world/v0/datasets/jonloyens/an-intro-to-dataworld/files \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API TOKEN>' \
--data-binary '{"files": [
{"name": "DataDotWorldBBallTeam.csv", "source": {"url": "https://docs.google.com/spreadsheets/d/1UheyB6pxTCfLpRmIGITM0fKb8jHVEvPuajmuejxxRyE/pub?gid=1371600687&single=true&output=csv"},
"description": "Purely fictitious performance data on our purely fictitious data.world basketball team.",
"labels": ["raw data", "clean data"]},
{"name": "DataDotWorldBBallStats.csv", "source": {"url": "https://raw.githubusercontent.com/rebeccaclay/test-repo/master/DataDotWorldBBallStats.csv"},
"description": "Stats about about our purely fictitious basketball team",
"labels": ["raw data", "clean data"]}
] }'
Response Body:
{
"message": "Dataset has been successfully updated with new sources. Sync in progress."
}