05-22-2012 06:50 PM
Hello.
We are Nuxeo ECM total rookies. We have defined a document model in our ECM instance, and this model contains a blob "illustration" attribute, which enables to store an image.
When looking at the rendering page which of that document model, when the blob attribute has been fulfilled with a picture, the image is diplayed in ECM with an hyperlink like "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png".
We strive to download that image from the command line with cURL with the command 'curl -H 'Content-Type:application/json+nxrequest' -u:Administrator:Administrator "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png"', authenticated properly, but this command returns an empty stream. Eventually, we will achieve that download from a Java application, which cannot use the Automation client, because we run in a Google App Engine box.
However, we thought that we had followed the documentation available at "http://doc.nuxeo.com/display/NXDOC55/Using+cURL", but we must have missed something. I need to mention that, if we open a browser with the URL "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png", the browser proposes to open or save the file.
If someone could help us to work this out, we would be grateful. Thank you for your attention.
Regards, Édouard
05-22-2012 07:31 PM
This is most probably because you have a syntax error in your command:
curl -H 'Content-Type:application/json+nxrequest' -u:Administrator:Administrator "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png"
Please note there should be a space instead of the colon between -u and Administrator to have the following instead:
-u Administrator:Administrator
05-22-2012 07:31 PM
This is most probably because you have a syntax error in your command:
curl -H 'Content-Type:application/json+nxrequest' -u:Administrator:Administrator "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png"
Please note there should be a space instead of the colon between -u and Administrator to have the following instead:
-u Administrator:Administrator
05-23-2012 05:16 AM
Thank you Wojciech. Shame on me, I must be too tired! It now works lit a charm. Regards, Édouard
05-23-2012 05:37 AM
Just an after thought, running
curl -I -H 'Content-Type:application/json+nxrequest' "http://localhost:8080/nuxeo/nxfile/default/351993be-1ee6-43c1-b081-709a519f665c/as:illustration/image.png"
actually returns the right HTTP status,
HTTP/1.1 302 D?plac? Temporairement
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=5D57191A544CCA6D6BA5442672954DA8.nuxeo; Path=/nuxeo
Location: http://localhost:8080/nuxeo/login.jsp?requestedUrl=nxfile%252Fdefault%252F351993be-1ee6-43c1-b081-70...
Content-Length: 0
Date: Wed, 23 May 2012 07:31:22 GMT
which accounts for the credential issue 😉 Maybe, a "forbidden" status would be better...
05-23-2012 11:21 AM
This is done on purpose, we redirect to the login page so that an unauthenticated user that follows the link is asked to authenticate first.
05-23-2012 12:17 PM
Right the "Content-Type" is misleading and unnecessary.
05-23-2012 11:21 AM
Why the `Content-Type
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.