[ckan-dev] Resource not being found via Datastore API

Dominik Moritz dominik.moritz at okfn.org
Tue Feb 11 02:30:37 UTC 2014


I'm guessing the resource id and the auth key should not be in {}. The documentation is a bit confusing in that regard. 

This should do it

```
curl -X POST http://172.16.104.245/api/3/action/datastore_create -H "Authorization: 946ac3c2-'f5ef-4e60-a4ee-efcc8b10a2ff" -d '{"resource_id": "c952e399-d856-4571-9cd5-9e24094a1960", "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}'
```

I suggest you change your API key since it is public now. 

On Feb 10, 2014, at 9:36, Alexandre Gomes <alegomes at gmail.com> wrote:

> The thing is I have a dataset with a resource with id 'c952e399-d856-4571-9cd5-9e24094a1960' as you can see in http://postimg.org/image/4oz4cwkwx/
> 
> The resource can be located with Action API:
> 
> $ curl http://172.16.104.245/api/3/action/resource_show?id=c952e399-d856-4571-9cd5-9e24094a1960
> {
>   "help": "...",
>   "success": true,
>   "result": {
>      "resource_group_id": "f5d9dbc4-a362-4939-b4bb-915c0cba4ab4",
>      "cache_last_updated": null,
>      "webstore_last_updated": null,
>      "datastore_active": false,
>      "id": "c952e399-d856-4571-9cd5-9e24094a1960",
>      "size": null,
>      "state": "active",
>      "last_modified": null,
>      "hash": "",
>      "description": "",
>      "format": "JSON",
>      "tracking_summary": {"total": 0,
>      "recent": 0},
>      "mimetype_inner": null,
>      "url_type": null,
>      "mimetype": null,
>      "cache_url": null,
>      "name": "Lista din\u00e2mica",
>      "created": "2014-02-10T14:51:29.022416",
>      "url": "http://www.example.org",
>      "webstore_url": null,
>      "position": 3,
>      "revision_id": "3cc36a35-0aeb-4a0c-b0a9-284c0c87582e",
>      "resource_type": null
>   }
> }
> 
> ...but not with Datastore API:
> 
> $ curl http://172.16.104.245/api/3/action/datastore_search?resource_id=c952e399-d856-4571-9cd5-9e24094a1960
> {
>   "help": "Search a DataStore resource.(...)", 
>   "success": false, 
>   "error": {
>      "message": "Not found: Resource \"c952e399-d856-4571-9cd5-9e24094a1960\" was not found.", 
>      "__type": "Not Found Error"
>   }
> }
> 
> 
> ...and datasetore_create doesn't work too.
> 
> $ curl -X POST http://172.16.104.245/api/3/action/datastore_create -H "Authorization: {946ac3c2-'f5ef-4e60-a4ee-efcc8b10a2ff'}" -d '{"resource_id": "{'c952e399-d856-4571-9cd5-9e24094a1960'}", "fields": [ {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2, "b": "zzz"} ]}'
> {"help": "Adds a new table to the DataStore.
> 
>     (...)
> 
>     ", "success": false, "error": {"resource_id": ["Not found: Resource"], "__type": "Validation Error"}}
> 
> 
> Why?
> 
> 
> 
> []s!
> http://alegom.es
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140210/abc6af1d/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140210/abc6af1d/attachment-0003.sig>


More information about the ckan-dev mailing list