Skip to content

Commit

Permalink
[#4926] Add url param to file upload API examples
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jun 21, 2018
1 parent 4286739 commit d743d03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/maintaining/filestore.rst
Expand Up @@ -81,7 +81,7 @@ For example, to create a new CKAN resource and upload a file to it using

.. parsed-literal::
curl -H'Authorization: your-api-key' 'http://yourhost/api/action/resource_create' --form upload=@filetoupload --form package_id=my_dataset
curl -H'Authorization: your-api-key' 'http://yourhost/api/action/resource_create' --form upload=@filetoupload --form package_id=my_dataset --form url=url --form name="resource name"
(Curl automatically sends a ``multipart-form-data`` heading with you use the
``--form`` option.)
Expand All @@ -93,7 +93,7 @@ To create a new resource and upload a file to it using the Python library
import requests
requests.post('http://0.0.0.0:5000/api/action/resource_create',
data={"package_id":"my_dataset"},
data={"package_id":"my_dataset", "name": "resource name", "url": ""},
headers={"X-CKAN-API-Key": "21a47217-6d7b-49c5-88f9-72ebd5a4d4bb"},
files=[('upload', file('/path/to/file/to/upload.csv'))])
Expand Down

0 comments on commit d743d03

Please sign in to comment.