[ckan-dev] Cannot post json data to our own ckan server using the Ckan php client
Hayden Waring
haydenwaring at gmail.com
Thu Mar 6 02:06:12 UTC 2014
Hey Lloyd,
Firstly for the 409 error you most likely have a dataset that has the name
of test2 in the database.
Secondly, the name that you are using is 'Test2' which is invalid. It must
be purely lowercase. 'test2' would work provided that there is not already
an entry in the database with the same name.
Hayden,
On Wed, Mar 5, 2014 at 5:06 PM, 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/20140305/d806c196/attachment-0003.html>
More information about the ckan-dev
mailing list