Skip to content

Instantly share code, notes, and snippets.

@jbothma
Created March 9, 2018 14:03
Show Gist options
  • Select an option

  • Save jbothma/9774912a5a867812767587e25aeff89b to your computer and use it in GitHub Desktop.

Select an option

Save jbothma/9774912a5a867812767587e25aeff89b to your computer and use it in GitHub Desktop.
Delete all resources for CKAN packages matching search criteria
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for resource in `curl 'localhost/api/3/action/package_search?q=+organization:"national-treasury"+vocab_financial_years:"2018-19"'|jq -r '.result.results[]|.resources[].id'`
do ckanapi -r http://localhost -a lalala action resource_delete id=$resource
done
IFS=$SAVEIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment