[ckan-dev] Cannot post json data to our own ckan server using the Ckan php client
Lloyd Harischandra
ayubowan.ll at gmail.com
Thu Mar 6 01:06:05 UTC 2014
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~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140306/fbe2802b/attachment-0002.html>
More information about the ckan-dev
mailing list