Fetching images of resource space using URL from outside

877 views
Skip to first unread message

neel bhatt

unread,
Nov 22, 2016, 4:01:19 AM11/22/16
to ResourceSpace
Hello All,

We have subscribed to resource space and now we are having some use case which I need to know how to go further.

First of all we need to fetch image from resource space URL from web portal which will basically give URL into src of image tag.

But as we know there are some extra data in the URL for example below:

"/filestore/2/0/4/3_[extra_data]/123pre_[extra_data]?[extra_data]"

So if I want to fetch image from resource space URL then which is the best practice?


Bill Tickle

unread,
Nov 23, 2016, 3:46:18 AM11/23/16
to ResourceSpace

Frederick Yocum

unread,
Nov 23, 2016, 9:48:18 AM11/23/16
to ResourceSpace
@Bill The answer to a question I have may be connected to your response. I want to link to images stored in MediaSpace in the Help content that I am building in MediaSpace. Can are build a scr using the api? If so what would the format be? 
Would I need to use an absolute link or a relative one?

TIA

Frederick Yocum

unread,
Nov 23, 2016, 9:48:34 AM11/23/16
to ResourceSpace
@Bill The answer to a question I have may be connected to your response. I want to link to images stored in MediaSpace in the Help content that I am building in MediaSpace. Can are build a scr using the api? If so what would the format be? 
Would I need to use an absolute link or a relative one?

TIa
Message has been deleted

Bill Tickle

unread,
Nov 28, 2016, 4:09:17 PM11/28/16
to ResourceSpace
It is really hard to be able to give an answer. If you are using for static images it might be easier just to rip the path to them but if your needs are more complex then perhaps the api is the route. 
Here is how we are using the api... we have built an external search using .net c# that makes a query based on a simple form submission - emulating the simple search function. 
It returns the preview asset of each of the images returned. 
If you know the asset Id then use the get_resource_path function
http://www.resourcespace.com/knowledge-base/api/get_resource_path
you pass this as a query which has been hashed - see documentation - here is a snippet of how that works in our .net solution

// get image
                    String ApiIDquery = "user=" + APIuser + "&function=get_resource_path&param1=" + refID + "&param2=&param3=pre&param4=&param5=jpg";  - pass image Id, null, pre(meaning image preview size, null and jpg exention
                    String idHash = privateKey + ApiIDquery;               concatenate with private key
                    String apiIDCode = getHashSha256(idHash);         -- subroutine that hashes the above string
                    String idLowerCode = apiIDCode.ToLower();          -- for some reason with .net we have to make the result lower case - not sure why. 
                    var idUrl = "http://[url to site]/resourcespace/api/?" + ApiIDquery + "&sign=" + idLowerCode;  - make the whole thing into a URL -- this returns json code containing the string to the preview that then needs to be in your img tag. This all looks a bit scary but .net does - it is way easier in php. 
If I get some time and people are interested I'll make the code more generic and post it. 

Frederick Yocum

unread,
Nov 29, 2016, 2:27:54 PM11/29/16
to ResourceSpace
@Bill Talking with someone from Montana. It would probably be simplest for my needs to put the images in a folder on the server and link directly to the images. This would keep them out of the ResourceSpace system. But would also be the clean and clean. Looking at your function made my head spin in any case :-)

Jordan Ormrod

unread,
Oct 11, 2018, 11:46:19 AM10/11/18
to ResourceSpace
Hi Bill. Have you had any success downloading a file from a collection using C#? Cheers. 
Reply all
Reply to author
Forward
0 new messages