cancel
Showing results for 
Search instead for 
Did you mean: 

Rest api from Share

soldiertt
Champ in-the-making
Champ in-the-making
Hi,

How can i access the results of Rest Api url like this :

http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/6f2dcb7d-6f5b-4c19-99f0-d9cbc2...

from Alfresco Share (either from JQuery or a Share WebScript) ?

From a share webscript i tried :

var resp = remote.call("/api/node/workspace/SpacesStore/6f2dcb7d-6f5b-4c19-99f0-d9cbc2a90ea3/content/thumbnails/imgpreview?ph=true&c=queue");
model.result=resp;

but this give me a blank page.

Thank you.

5 REPLIES 5

yogeshpj
Star Contributor
Star Contributor

soldiertt
Champ in-the-making
Champ in-the-making
Thank you for your response, yes when hitting this url directly in my browser, it renders me the first page of my pdf file as a picture (thumbnail).

Edit : it seems that i'm getting a bit further today, the share WebScript now renders the binary characters from the image, i suppose i just need to specify the appropriate output content-tpye (image/png in this case).
How can i achieve that ?
Thanks

yogeshpj
Star Contributor
Star Contributor
Your script response is coming in json format.Just you need to parse it.Use "eval" fuction for parsing it.

soldiertt
Champ in-the-making
Champ in-the-making
What give you the idea that the response format is Json ? (it fails when i try an eval on it)
What i receive from the backend alfresco webscript seems to be a stream to the png image.
So i just need to render this stream to the browser but i presume my freemarker template 'test.get.html.ftl' is not appropriate since it's not html.

yogeshpj
Star Contributor
Star Contributor
I thought you are using out of the box one repository side webscript which has json response.That give me the idea that reponse is in json format.