DSpace 6.3 - Yet the expand parameter in the rest get collections

32 views
Skip to first unread message

rdias...@gmail.com

unread,
May 18, 2021, 4:25:15 PM5/18/21
to DSpace Technical Support
Hi,

For some time now, I've been trying to get the parent Community for when reading the collections through the Rest API.

Today I finally went to the source code and found, in CollectionsResource.java the line

Collection collection = new org.dspace.rest.common.Collection(dspaceCollection, servletContext, null, context, limit, offset);

I wish to know why the parameter  expand is set to null. I changed to expand (a string passed to the function getCollections) and it seems to work as expected.

As I  think no code is made without a reason, I feel insecure to let it modified without further notice or advice.

Any help is welcome.

Thanks,

Ricardo

Alan Orth

unread,
May 25, 2021, 2:29:45 AM5/25/21
to rdias...@gmail.com, DSpace Technical Support
Dear Ricardo,

I don't understand the logic around that code block in CollectionsResource.java, but I'm on DSpace 6.3 as well and I can use expand on a collection to get the parent community, for example:


Were you doing something differently? You can check the git log for that file to see its history.

Cheers,

--
All messages to this mailing list should adhere to the Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/35842b5e-f6a9-4d40-944b-32035503f47fn%40googlegroups.com.


--

Ricardo Campos

unread,
May 25, 2021, 5:08:31 PM5/25/21
to Alan Orth, DSpace Technical Support
Hi, Alan.

Thanks for your reply.

There is a difference between your call to rest and mine. While you ask for a specific collection - you give an collection uuid in the url -, I'm asking a list of all collections in the repository. In terms of the java code, you call "getCollection" while I call "getCollections". In you case, the the call to the Collection class includes the expand parameter.  Maybe the fact getCollections asks for a list of collections would have been the reason why the code for all collections does not refer to expand, i'd say on purpose: to minimize, to shorten the answer. The problem is that if you have the list of all collections you could find many of them with the same name, making impossible to identify which is which, if you understand me. I'd try to have the parent community name with collection name in order to make this identification unique, if possible (you could still have "homonimes" until a certain level).

Thanks again.

Livre de vírus. www.avast.com.

Alan Orth

unread,
May 26, 2021, 6:45:04 AM5/26/21
to Ricardo Campos, DSpace Technical Support
Dear Ricardo,

So you mean that you're getting a list of all collections with the parentCommunity expand parameter like this?


In this example above I see that the response does not include parentCommunity data for each collection. If you change the null to expand on line 197 of CollectionsResource.java does it fix the problem? If so, then you should definitely file a bug on Jira and make a pull request. That's a good find!

Cheers,
Reply all
Reply to author
Forward
0 new messages