I want to add a tag "Water" to any dataset that includes data "agua"

Can I use the API to search, find and update all datasets that contain the search string "agua" to add a tag "Water"

1 Answer 1


Yes, you can search all datasets that contain the word "agua" using the package_search API action, eg http://demo.ckan.org/api/3/action/package_search?q=agua

Once you have them you can either:

  • For each of the returned results, add the "Water" tag and call the package_update action (sending the whole package object, not just the tag)
  • For each of the returned results, call the package_patch action, sending the updated tags (make sure to include the existing ones), eg :

    {"tags": [{"name": "Water"}, {"name": "OtherTag"}]}

Hope this helps

  • Thank you amercader for the response. Still very new at this and could use additional help using the API. Completed 1st step easy data.amerigeoss.org/api/3/action/package_search?q=agua finds 1503 packages/resources. Now how do I "append" = add additional tags called "water" and "environment" to the current list of tags in each of the 1503 results keeping the existing tags adding the 2 additional tags. Would you give me an example of how to add the tags calling each of the actions package_search-->package_update-->package_patch step by step? Any help is appreciated. Jun 23, 2018 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.