Skip to content

Commit

Permalink
Merge pull request #1763 from ckan/1763-update-datastore-docs
Browse files Browse the repository at this point in the history
can not edit read-only resources -- datastore test problem
  • Loading branch information
brew committed Nov 5, 2014
2 parents f6b2d10 + 3e230e8 commit ab9242d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions doc/maintaining/datastore.rst
Expand Up @@ -167,17 +167,20 @@ This should return a JSON page without errors.
To test the whether the set-up allows writing, you can create a new DataStore resource.
To do so, run the following command::

curl -X POST http://127.0.0.1:5000/api/3/action/datastore_create -H "Authorization: {YOUR-API-KEY}" -d '{"resource_id": "{RESOURCE-ID}", "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}'
curl -X POST http://127.0.0.1:5000/api/3/action/datastore_create -H "Authorization: {YOUR-API-KEY}" -d '{"resource": {"package_id": "{PACKAGE-ID}"}, "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}'

Replace ``{YOUR-API-KEY}`` with a valid API key and ``{RESOURCE-ID}`` with the
id of an existing CKAN resource.
Replace ``{YOUR-API-KEY}`` with a valid API key and ``{PACKAGE-ID}`` with the
id of an existing CKAN dataset.

A table named after the resource id should have been created on your DataStore
database. Visiting this URL should return a response from the DataStore with
the records inserted above::

http://127.0.0.1:5000/api/3/action/datastore_search?resource_id={RESOURCE_ID}

Replace ``{RESOURCE-ID}`` with the resource id that was returned as part of the
response of the previous API call.

You can now delete the DataStore table with::

curl -X POST http://127.0.0.1:5000/api/3/action/datastore_delete -H "Authorization: {YOUR-API-KEY}" -d '{"resource_id": "{RESOURCE-ID}"}'
Expand Down

0 comments on commit ab9242d

Please sign in to comment.