问题
In my project, I used CKAN to manage my data, now I want to obtain the dataset list under my authorization(both public and private datasets), does anyone know how could I get such a list through CKAN API?
回答1:
Get public datasets using package_list
or package_search
.
Get datasets that your user has created, including ones that are private and drafts, using user_show
with option include_datasets=True
. Remember to use your user's api key, of course.
However I believe this leaves the private datasets created by other members of your organizations, that are not available afaict via the API. I raised an issue: https://github.com/ckan/ckan/issues/3176 in case you'd like to provide a contribute a fix or bounty for someone else to.
回答2:
Now @D Read's issue has been addressed, this question has a solution:
/api/3/action/get.package_search?include_private=True
Using HTTPie, for example:
http https://ckan.example.com/api/3/action/package_search include_private=True Authorization:123-abc
Why doesn't
/api/3/action/current_package_list_with_resources
get all resources visible to the user with the API key?! If we wanted only public resources we could omit the API key or (most logically to me) filter a search. Anyone else think this should work this way?
来源:https://stackoverflow.com/questions/38625786/how-to-obtain-a-given-users-dateset-listboth-public-and-private-through-ckan