How to obtain a given user's dateset list(both public and private) through CKAN API?

巧了我就是萌 提交于 2019-12-11 12:33:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!