[ckan-dev] Cannot post json data to our own ckan server using the Ckan php client

Nigel Babu nigel.babu at okfn.org
Thu Mar 6 06:04:46 UTC 2014


Hi Lloyd,

We do not officially support the php client. Additionally, it hasn't been
updated in 4 years and is probably using a very old version of the API. I
would recommend using the action API (version 3) directly from PHP.

Nigel Babu

Developer  |  @nigelbabu <https://twitter.com/nigelbabu>

The Open Knowledge Foundation <http://okfn.org/>

Empowering through Open Knowledge

http://okfn.org/  |  @okfn <http://twitter.com/OKFN>  |  OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter>

 CKAN | http://ckan.org/ | @CKANproject
<http://twitter.com/CKANproject> |the world’s leading open-source data
portal platform


On 6 March 2014 06:36, Lloyd Harischandra <ayubowan.ll at gmail.com> wrote:

> Hi All,
>
> I am trying to use CKan php client to send following json data to one of
> our own ckan servers.
>
> {"name":"Test2","title":"Test 2 by
> Lloyd","url":"lloyd_2","notes":"notes_2","tags":
>  [],"maintainer":"Lloyd","maintainer_email":"lloydharis at gmail.com
> ","license_id":"ll_2","resources":[]}
>
> The code is:
>
> $ckan = new Ckan_client("http://my_url/api/");
> $ckan->set_api_key('my_api_key');
>  $data_array = array("name" => "Test2",
> "title" => "Test 2 by Lloyd",
>  "url" => "lloyd_2",
> "notes" => "notes_2",
> "tags" => array(),
>  "maintainer" => "Lloyd",
> "maintainer_email" => "my_email at xxxx.com",
>  "license_id" => "ll_2",
> "resources" => array());
> $json_data = json_encode($data_array);
>  $ckan->post_package_register($json_data);
>
> Then when I look at curl response, It says following:
>
> {"name": ["Url must be purely lowercase alphanumeric (ascii) characters
> and these symbols: -
>  _"]}
>
> And get 409 error - which is "Conflict (e.g. name already exists)"
> according to Ckan_client.php class.
>
> But I cannot see any datasets on our server with that name when I login
> using web interface.
>
> Does anyone know why I am getting this error?
>
>
> Thanks
> ~LLoyD~
>
> _______________________________________________
> 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/20140306/37524d46/attachment-0003.html>


More information about the ckan-dev mailing list