Get Attachment from CS without logging in?

Hi, 

I'm trying to access a specific image-attachment I have in CS, and have found this URL to go directly to the image:

http://service.cs.com/scripts/rms.exe/getAttachment/50166-ealkrltlvgnlfwcywdghcrtyeqzowpiluynrgulvsmmtljtydcsxnahaznhttinu-0/signature.png

This works fine when I am  logged in to CS, but I also need to be able to get the picture without logging in. Are there any parameters I can pass in the URL to see the image without logging in?

In this scenario security is not an issue, so I can hardcode a global password etc in the URL if that is possible. The image is going to be used while I'm building up a PDF file with data from CS, so the URL will only used by the PDF generator on the server.

We also have customer.exe licence, if that helps.

So the question is - how can I get the attachment without manually logging in?

RE: Get Attachment from CS without logging in?

Add it to External documents:

Under Knowledge Base > External documents, you can add documents to make them available to anyone using SuperOffice Customer Service, including unregistered customers. Documents you upload here are available when you write the content of messages to send to a customer.

Like: https://cs.superoffice.com/scripts/customer.fcgi/getAttachment/1853351-Z98TTGiIsnSBcrzL0Ww9dooEqbX3pDfEH35SIFpRMAjFQCynagx4FdDtpixdALdK-0/Confirmation.png

gives you

Av: Margrethe Romnes 26. nov 2013

RE: Get Attachment from CS without logging in?

Hi Margrethe, thanks, but I think I need it to be available without manually adding as External document.

The flow here is that a customer and an associate are standing together with an iPad, and the customer signs his name on a digital contract on the iPad by drawing with his finger on a canvas. This gets saved to SuperOffice CS as a ticket, and the signature is an attachment image. This part works already.

Now, I need to create a PDF version of the contract. By using an external component for converting HTML to PDF I can call a CS page, and parse it into a PDF file. This webpage is using a URL somewhat like this;

http://service.cs.com/service/customer.exe?&action=safeParse&includeId=contract-as-html&key=secret&contractId=6618

By navigating to that page I get a HTML page with the contract. This also works fine.

But, then comes the problem. On that HTML page I want to add the Signature-image from attachments. I've added an IMG tag that uses the link from the first post, but since the PDF generator isnt logged in to CS the image doesn't display.

So I need the image to be available for the PDF generator as soon as the ticket is created, and I don't want thousands of signaturefiles added to the External Documents. I just want the PDF Generator to be able to view the attachment.

Av: Frode Lillerud 26. nov 2013

RE: Get Attachment from CS without logging in?

Replacing rms.exe with customer.exe should give you a URL to the image that is also available unauthenticated.

Using ejscript, have a look at the getDownloadUrl function, specifically the Bool external parameter. It will give you an external/internal download url. 

Av: Anders Lien 26. nov 2013

RE: Get Attachment from CS without logging in?

Perfect Anders, changing to customer.exe fixed it :)

Av: Frode Lillerud 28. nov 2013

RE: Get Attachment from CS without logging in?

Hi, has this changed behavor somewhere after 8.0 SR4?

We've upgraded a customer from 8.0 SR4 to 8.2 R04, and now we get the error described here.

Av: Frode Lillerud 11. apr 2018

RE: Get Attachment from CS without logging in?

Hi. 

We experience the same. Using the getDownloadUrl with External parameter set to true now fails.

Is this fixed in newer versions, or do anyone have a workaround ( Is it possible to build this url with a combination of the attachment-id, session-key and so on?)

Av: Jan Abrante 15. maj 2018

RE: Get Attachment from CS without logging in?

Hi jan,

I'm pretty sure you need to add the session key after the url now.

getAttachment/AttID-AttKey/Name?custSessionKey=CustID-CustSessionKey

The url would be something like:

https://url.com/scripts/customer.fcgi/getAttachment/1234-KLL5c7miOhirfRMAwHfDyBZI9WGsWZp92YrYyiMEexnzaekF8frBxh2hUlwOurOp-0/Test.txt?custSessionKey=9999-wfvopitwkkkrzskbpyfmccutqijeezfi

 

Hope this helps

Av: Simen Mostuen Iversen 15. maj 2018

RE: Get Attachment from CS without logging in?

No, it did not work. So I did a bad workaround by grabbing an old customer.exe (from eJournal 411) and named it customer411.exe and added it to the web-binaries. Then when calling the attachment.getDownloadUrl(...) and substituted the customer.fcgi with customer411.exe ... it worked. So the final code was:

"<a href='" + attachment.getDownloadUrl(true,false).substitute("customer.fcgi","customer411.exe") + "'>" + attachment.getValue("name") + "</a>"

Av: Jan Abrante 15. maj 2018