Hi Alan,

A 401 HTTP Response means you are "Unauthorized".  So, it sounds to me like
you need to login first via the REST API before completing that request.
Here's info on how to login (and then you'd pass the returned token on
future requests):
https://wiki.duraspace.org/display/DSDOC5x/REST+API#RESTAPI-Index

I hope that helps

Tim

On Wed, Apr 24, 2019 at 10:49 AM Alan Orth <alan.o...@gmail.com> wrote:

> Dear list,
>
> I am having an issue with the DSpace 5.8 REST API's
> /items/find-by-metadata-field endpoint. There should be hundreds of results
> for the following search according to the XMLUI and the database, but when
> searching via the REST API the response is HTTP 401:
>
> $ curl -f -H "Content-Type: application/json" -X POST "
> http://localhost:8080/rest/items/find-by-metadata-field"; -d
> '{"key":"dc.subject", "value":"WATER MANAGEMENT","language": "en_US"}'
> curl: (22) The requested URL returned error: 401
>
> I see the following error message in the DSpace log:
>
> 2019-04-24 08:42:33,956 INFO  org.dspace.rest.ItemsResource @ Looking for
> item with metadata(key=dc.subject,value=WATER MANAGEMENT, language=en_US).
> 2019-04-24 08:42:34,055 INFO  org.dspace.usage.LoggerUsageEventListener @
> anonymous::view_item:handle=123456789/72448
> 2019-04-24 08:42:34,060 INFO  org.dspace.usage.LoggerUsageEventListener @
> anonymous::view_item:handle=123456789/72491
> 2019-04-24 08:42:34,065 INFO  org.dspace.usage.LoggerUsageEventListener @
> anonymous::view_item:handle=123456789/75703
> 2019-04-24 08:42:34,071 ERROR org.dspace.rest.ItemsResource @
> User(anonymous) has not permission to read item!
>
> Assuming there is actually a private item, why is the REST API trying to
> read it? And why is it failing? How would I even find the offending item?
> Thanks!
> --
> Alan Orth
> alan.o...@gmail.com
> https://picturingjordan.com
> https://englishbulgaria.net
> https://mjanja.ch
> "In heaven all the interesting people are missing." ―Friedrich Nietzsche
>
> --
> All messages to this mailing list should adhere to the DuraSpace 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+unsubscr...@googlegroups.com.
> To post to this group, send email to dspace-tech@googlegroups.com.
> Visit this group at https://groups.google.com/group/dspace-tech.
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Tim Donohue
Technical Lead for DSpace & DSpaceDirect
DuraSpace.org | DSpace.org | DSpaceDirect.org

-- 
All messages to this mailing list should adhere to the DuraSpace 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+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to