the-library-code / dspace-rest-python

DSpace REST API Client Library
BSD 3-Clause "New" or "Revised" License
24 stars 19 forks source link

get_communities method always return empty list when used with uuid #8

Closed andreasgeissner closed 9 months ago

andreasgeissner commented 9 months ago

Identifying a community using get_communities endpoint does not appear to be working when called directly with a uuid. The method always returns an empty list.

The reason probably is that the endpoint response does not contain an _embedded element when called directly with the uuid. See for example https://demo.dspace.org/server/api/core/communities/64b0f8cd-f323-4eea-8598-920266da756f

kshepherd commented 9 months ago

Thanks @andreasgeissner , I have fixed this with PR #9

I had thought about separate get_community and get_communites methods at one stage (and so on for each DSO type) but thought a single method that allows both and always returns a list was more simple, and kept the term in line with the endpoint name. In implementing, I forgot to actually get for the single non-embedded result as you note!

I am interested to hear any feedback on that design decision

kshepherd commented 9 months ago

I have also release a new version with this fix included: https://pypi.org/project/dspace-rest-client/0.1.8/

andreasgeissner commented 9 months ago

Thanks @kshepherd for fixing this so quickly.

I went the routhe to first look at which endpoints I need and then looked whether there are the respective methods in your library. So, the choice of having on method eemed prettty "natural" to me.