I've set up a CKAN server with all necessary plugins. There is some content on the server (.csv files). Now I'd like to download a specific .csv file to change it locally and upload it again.
But I don't know how to download the complete file using the CKAN API.
Can someone help me?
The package_show
API call will tell you the URL for the CSV so that you can download it.
e.g. this dataset: http://data.gov.uk/dataset/uk-open-access-non-vosa-sites is available on the API at: http://data.gov.uk/api/action/package_show?id=uk-open-access-non-vosa-sites which results in something like:
{
"help": "http://data.gov.uk/api/3/action/help_show?name=package_show",
"success": true,
"result":
{
"name": "uk-open-access-non-vosa-sites",
"license_title": "UK Open Government Licence (OGL)",
"resources": [
{
"description": "A list of Authorised Testing Facilities (ATFs) and DVSA test stations ",
"format": "CSV",
"url": "http://dft.gov.uk/vosa/images/Find%20your%20nearest%20ATF%20or%20VOSA%20test%20station.csv",
"id": "bd9aaa9f-2a9c-45f8-8246-6b99dd78208a",
"resource_type": "file",
}
]
}
}
from which you can see the url is http://dft.gov.uk/vosa/images/Find%20your%20nearest%20ATF%20or%20VOSA%20test%20station.csv
which you can download e.g. using wget:
wget http://dft.gov.uk/vosa/images/Find%20your%20nearest%20ATF%20or%20VOSA%20test%20station.csv