[DuraSpace JIRA] (DS-4065) DSpace 6 REST API includes restricted items in its internal count

3 views
Skip to first unread message

Hrafn Malmquist (DuraSpace JIRA)

unread,
Oct 29, 2018, 8:46:01 AM10/29/18
to dspace-...@googlegroups.com
Hrafn Malmquist created an issue
 
DSpace / Bug DS-4065
DSpace 6 REST API includes restricted items in its internal count
Issue Type: Bug Bug
Affects Versions: 6.2
Assignee: Unassigned
Components: REST API
Created: 29/Oct/18 7:45 AM
Labels: volunteer-sought
Priority: Minor Minor
Reporter: Hrafn Malmquist

It is a known issue that the REST API in 6 does not supply total results when doing pagination (see DS-3887) which makes iterating the results an exploratory process.

This problem is compounded by the fact that the REST API does an internal count, then responds with those items that are not restricted. This means that if you send an anonymous query like so:

curl -s -H "Accept: application/json" https://demo.dspace.org/rest/items?offset=0\&limit=5"

you will get 5 results provided they're all open to anonymous users

if you then login to the server and pick one item and make it private and do the same query

you will get 4 results

even though the next query:

curl -s -H "Accept: application/json" https://demo.dspace.org/rest/items?offset=5\&limit=5

would give you up to five results

there are at the time of this writing 63 items in the demo server and I've made two of them private.

the bug can be confirmed by doing a curl query like above with a low limit, selecting one of the items and making it private and then redoing the same query to see that the next record does not cascade down.

 

 

  

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.0#710001-sha1:0399717)

Mark H. Wood (DuraSpace JIRA)

unread,
Oct 30, 2018, 1:10:01 PM10/30/18
to dspace-...@googlegroups.com
Mark H. Wood updated an issue
Change By: Mark H. Wood
Status: Received Volunteer Needed

Hrafn Malmquist (DuraSpace JIRA)

unread,
Nov 1, 2018, 10:05:01 AM11/1/18
to dspace-...@googlegroups.com

Anonymous (DuraSpace JIRA)

unread,
Nov 30, 2018, 12:23:01 PM11/30/18
to dspace-...@googlegroups.com
Issue was automatically transitioned when Hrafn Malmquist created pull request #2275 in GitHub
Change By: Hrafn Malmquist
Status: Volunteer Code Review Needed

Alan Orth (LYRASIS JIRA)

unread,
Jun 21, 2021, 5:40:01 AM6/21/21
to dspace-...@googlegroups.com
Alan Orth commented on Bug DS-4065
 
Re: DSpace 6 REST API includes restricted items in its internal count

I confirmed this issue on the current DSpace 6.3 Demo as well as our own DSpace 6.3 production instance. Here is a simple reproducer on the public DSpace 6.3 Demo server:

 

$ curl -s -H "Accept: application/json" "https://demo.dspace.org/rest/items?offset=0&limit=5" | jq length
5
$ curl -s -H "Accept: application/json" "https://demo.dspace.org/rest/items?offset=0&limit=5" | jq '.[].handle'
"10673/4"
"10673/3"
"10673/6"
"10673/5"
"10673/7"
# log into DSpace Demo XMLUI as admin and make one item private (for example 10673/6)
$ curl -s -H "Accept: application/json" "https://demo.dspace.org/rest/items?offset=0&limit=5" | jq length       
4
$ curl -s -H "Accept: application/json" "https://demo.dspace.org/rest/items?offset=0&limit=5" | jq '.[].handle' 
"10673/4"
"10673/3"
"10673/5"
"10673/7"

The result set which includes a private item is clearly incorrect: we are asking for a limit of five items starting at offset 0, but we get four. The REST API is counting the private item internally, but not taking that into account when returning the resulting items.

I tested the fix proposed by Hrafin in PR #2275 and it works as expected in our DSpace 6.3 staging environment: when a result set includes private items they are excluded from the REST API's internal item count and you get limit number of items returned.

This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages