Hi Alan,

I have never used postgREST personally but such kind of tools are unlikely to 
work well on DSpace as there are lot of logic and domain constraints that are 
not implemented at the database level. Using them you will end with a REST API 
that will allow you to messy up your data (if you allow write operation) or on 
the other hand if you use it only for READ you will expose low level details 
coupling heavily your REST API and so you REST Client with the inner database 
model of DSpace.

For DSpace 7 we are working on a new REST API, domain driven and based on 
standards and best-practice (HATEOAS, HAL, etc.). Any feedback on the current 
implementation (plan) or use cases that need to be addressed is useful and 
anyone is more than welcome to join!

You can find more information on the DSpace 7 work here:

https://wiki.duraspace.org/display/DSPACE/DSpace+7+UI+Working+Group

Andrea

Il 01/04/2017 17:50, Alan Orth ha scritto:
I've often wondered if it would be possible to use something like PostgREST to 
automatically create a REST API from DSpace's PostgreSQL database.

https://github.com/begriffs/postgrest

Has anyone tried this?

On Sat, Apr 1, 2017 at 5:44 PM Tsegaselassie Tadesse 
<[email protected]<mailto:[email protected]>> wrote:
Pick an easy problem, OK?  :)

Thanks I will next time :D

That query pointed me into the right direction. I had no idea the bitstream 
information was part of the metadata.

I would never have guessed it.

Thanks again!

On Thursday, March 30, 2017 at 6:36:06 PM UTC+3, Chris Gray wrote:
Pick an easy problem, OK?  :)

I can get you started and get you to the file name and sequence number, but the 
policy (isAllowed=y) is trickier because policies are hierarchical and 
inheritable.  I haven't worked much with policies in the database.

This will get you started, to get the other data given a handle:

select item2bundle.item_id, bundle_id, bitstream_id, text_value as filename, 
sequence_id
from bitstream --here we go up the hierarchy
join bundle2bitstream
using (bitstream_id)
join item2bundle
using (bundle_id)
join handle
on (handle.resource_id = item2bundle.item_id)
join metadatavalue
on (bitstream.bitstream_id = metadatavalue.resource_id) --file name is dc.title 
for the bitstream
where handle = '10568/70234' -- your handle example
and metadata_field_id = 64 -- dc.title
and bitstream_format_id = 11;

The text_value is the file name.  This will require some refinement, since 
there may be other jpeg bitstreams (bitstream_format_id = 11).  You could check 
that the file name ends in .pdf.jpg instead of using the bitstream_format_id.

You can look up the policies by using the resource_id in the resourcepolicy 
table, but deciphering that isn't straightforward.  It depends if you ever make 
thumbnails private.  We don't in our instance.

Cheers,
Chris

On Thursday, March 30, 2017 at 10:35:57 AM UTC-4, Tsegaselassie Tadesse wrote:
I am trying to build a very light-weight API endpoint that lists items from the 
database. I want to provide a url link to the item's thumbnail but it seems 
DSpace works very differently from what I expected.

I have read the Storage 
Layer<https://wiki.duraspace.org/display/DSDOC5x/Storage+Layer> documentation 
the Bitstream Store section to be specific on how to use the internal id to get 
to the directory of the bitstream; however, I am looking for is just to get the 
exact thumbnail for the item; e.g. on the detail page of an item, 
https://cgspace.cgiar.org/handle/10568/70234, you will see the thumbnail has a 
normal image source, 
https://cgspace.cgiar.org/bitstream/handle/10568/70234/beca_africanRice_poster_feb2016.pdf.jpg?sequence=4&isAllowed=y.

How do I generate that?
--
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
--

Alan Orth
[email protected]<mailto:[email protected]>
https://englishbulgaria.net
https://alaninkenya.org
https://mjanja.ch

--
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 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.


--
Andrea Bollini
Chief Technology and Innovation Officer

4Science,  www.4science.it<http://www.4science.it>
office: Via Edoardo D'Onofrio 304, 00155 Roma, Italy
mobile: +39 333 934 1808
skype: a.bollini
linkedin: andreabollini
orcid: 0000-0002-9029-1854

an Itway Group Company
Italy, France, Spain, Portugal, Greece, Turkey, Lebanon, Qatar, U.A.Emirates

-- 
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 [email protected].
To post to this group, send email to [email protected].
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