Please note the URLS contained in the post aren't real - just examples
Is it possible to check what dataset/s a resource sits in via a single api query?
It seems possible to do via a 3 step query such as:
- Get revision ID: http://demo.ckan.org/api/3/action/resource_search?query=url:https://www.example.com/resources/datafile.csv
- Get package ID: http://demo.ckan.org/api/3/action/revision_show?id=de5707gg-5568-1291-83df-7a6e2a441396
- Get containing dataset: http://demo.ckan.org/api/3/action/package_show?id=de5707gg-5568-1291-83df-7a6e2a441396
Alternatively I've been able to use: https://demo.ckan.org/api/action/package_search This allows me to get all packages and info contained within then use javascript on a page to process the results, this gives me the dataset/s if any are applicable.
However I'm curious if this can be done in a single API call as opposed to doing multiple or having to rely on something outside of CKAN to process (ie without using Javascript as in second example).
I thought it might have been possible to do something like: https://data.qld.gov.au/api/action/package_search?q=de5707gg-5568-1291-83df-7a6e2a441396 but it does not seem to search ID fields? I'd prefer to search by URL as I wouldn't necessarily know what the ID is to begin with unfortunately and the package search doesn't have this content to search across.