[ckan-discuss] API and Tag management

Aaron McGlinchy McGlinchyA at landcareresearch.co.nz
Tue Oct 1 21:20:49 BST 2013


Thanks Sean,
                     Yes, just yesterday I learnt that Python 3 has made quite a few changes from 2.6/2.7 and that many people are sticking with the earlier versions.  I have rolled back my python install to v2.7 and now have been able to get API calls working.

I also found some people have been doing work on this so I have been able to work out how to do things following their examples : https://github.com/okfn/ckan/wiki/CKAN-API-Clients

For other peoples reference, you can see all the tags in your CKAN from:   <your CKAN url>/tag   (not sure if you need to be logged in as sysadmin to see this?).

Whilst testing we got some random tags entered, and the API call has enabled me to clean them up nicely.

Thanks
Aaron

----------------------------------------------------------------------

Message: 1
Date: Tue, 1 Oct 2013 11:06:19 +0200
From: Sean Hammond <sean.hammond at okfn.org>
Subject: Re: [ckan-discuss] API and Tag management
To: ckan-discuss at lists.okfn.org
Message-ID: <20131001090619.GA24514 at mistakenot>
Content-Type: text/plain; charset=us-ascii

> I have also got Python 3.3.2 installed, though I have come across
> problems trying the example python code at the above documentation
> page : seems to have been changes to python with regards to urllib and
> urllib2 amongst other issues. So I have not been able to get the
> examples to work as yet.

The example code is tested with Python 2.6 and 2.7 (same as CKAN itself). If you like, I can construct an example in Python 3 for you.
Let me know.

> This page references deleting tags:
> http://docs.ckan.org/en/ckan-2.0.2/ckan.logic.action.delete.html
>
> Is it possible to execute these action.delete commands with the setup
> I have?

Yes, you should have no problem calling any API action using httpie. Do note however that *_delete actions will require you to provide a CKAN API key in the http command. This is done with 'Authorization:' in httpie.  For example:

http '127.0.0.1:5000/api/3/action/tag_delete' id=foo Authorization:150a520d-ea52-4a08-9f14-2baa5975ed73

The API key should be the API key of a sysadmin user for tag_delete. To find your API key, login to the CKAN web interface and go to your profile page (e.g.
/user/seanh).



------------------------------

Message: 2
Date: Tue, 1 Oct 2013 18:25:36 +0800
From: Yanting Chen <mx.alexender at gmail.com>
Subject: [ckan-discuss] Import data to CKAN from an exising database
To: ckan-discuss <ckan-discuss at lists.okfn.org>
Message-ID:
        <CAFKQfRyOA8CHxQNtE4bXAt3JCOyc8O75yF+2hC5=_6yF=dKaOg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

>From the official doc, it said data can be stored directly into a CKAN
site. There are two APIs, FileStore and DataStore.

Does anyone ever use these two APIs to make import from an existing database using JAVA? Like a batch job.

If yes, is it possible to provide some examples?

Thanks in advance,
Yanting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-discuss/attachments/20131001/f4ee70ce/attachment.htm>

------------------------------

_______________________________________________
ckan-discuss mailing list
ckan-discuss at lists.okfn.org
http://lists.okfn.org/mailman/listinfo/ckan-discuss
Unsubscribe: http://lists.okfn.org/mailman/optionss/ckan-discuss


End of ckan-discuss Digest, Vol 45, Issue 1
*******************************************

________________________________

Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz



More information about the ckan-discuss mailing list