[ckan-dev] Create free-form tag programmatically?

Ryan Clark ryan.clark at azgs.az.gov
Tue Mar 26 23:34:00 UTC 2013


I'm trying to figure out how to add free-form (vocabulary-free) tags to a package programmatically, and I'm finding the documentation a little confusing.

http://docs.ckan.org/en/latest/ckan.logic.action.create.html#ckan.logic.action.create.package_create says I can add tags and "see tag_create() for the format of tag dictionaries"
http://docs.ckan.org/en/latest/ckan.logic.action.create.html#ckan.logic.action.create.tag_create says "To create a new free tag simply add the tag to a package, e.g. using the package_update function"
http://docs.ckan.org/en/latest/ckan.logic.action.update.html#ckan.logic.action.update.package_update doesn't really specify how to use it, so I tried:

package_update({"id": "my-package-id", "tags": [ "some", "free", "tags"]})

However that complains that it wants tags in dictionary format, as I would use for specifying tags that are part of a vocabulary. How do I specify a free tag?

Also, what is the best way to access the tags once I have them entered? I ran into a situation where my_package.package_tags contained a tag, but my_package.get_tags() returned an empty list?

Thanks so much!!

____________________

Ryan Clark
Arizona Geological Survey
ryan.clark at azgs.az.gov
(520) 302-4871







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130326/94e258c5/attachment.html>


More information about the ckan-dev mailing list