Get SessionID of Document Template - Forum - Rollbase - Progress Community

Get SessionID of Document Template

 Forum

Get SessionID of Document Template

This question is answered

Hi there,

We have a quality management system application.
When a form is created, a html is automatically created through a document template.

I am trying to download this html (pdf) with powershell as a pdf to my local pc.

If I Clik on the form, it's html link is the following:
https://qap360-d.qap360.nl/master/servlet/Template?sessionId=E94F4A46D55B53DE4610BB84A71A7B603756E2C17CF9.Pas_Instance&hint=file&objDefId=52140&templateId=52328&id=141058

So when I download this with powershell to my local pc as a pdf file, it succeeds and gets me a correct PDF.
But when i use the rollbase field url of that document template: {!Print_Formulier#url}, it gives: 
https://qap360-d.qap360.nl/master/servlet/Template?hint=file&objDefId=52140&templateId=52767&id=141063

without the sessionid and if i download this to pdf i get a corrupt pdf file.

It seems to be the case that it only renders as pdf when you are logged in at that url.

So without the sessionId it directs to the login page and won't render as pdf. = corrupt pdf.

Is there any way to get that sessionID?
Because for a customer we need to upload that pdf to sharepoint as soon as it is created or the status is updated.

Kind regards,
Ramon Schouten

Verified Answer
  • Hi Prem,

    Thanks for your answer.

    We have solved it in another way.

    We have used our REST API and the api account to get the sessionId.

    Then perform a rest method in powershell to download a file from an url.

    Where the url is as the following:

    qap360-d.qap360.nl/.../Template

    In which <sessionId> is the sessionId which we gotten from our REST API call, with the Rollbase api account.

    The trick is to put the ampersant (&) between the sessionid and the .Pas_Instance.

    We tried before without the ampersant (&) and that didn't work.

    Because the original url when you are logged in doesn't have the ampersant (&) there.

    But to use it as a REST API call you will need the ampersant (&).

    Kind regards,

    Ramon Schouten

All Replies
  • Hi Ramon,

    The url which comes up when you click on file in the form has sessionId for the version of Rollbase you are using.

    But we've removed the sessionId from the url due to security concerns as the sessionId gives access to the account it is related to.

    So, in Rollbase 5.0 and above we will not be having sessionId as one of the URL parameters.

    Now the URL when you click open the file and {!Print_Formulier#url} will result in same URL,

    but only will be accessible to user in which browser he is logged in(else he will be prompted to login).

    From the usecase you've mentioned, if your use case is to share a file with customer then you can email the document as an attachment from Rollbase.

    Please let me know if this helps.

    Regards,

    Prem

  • Hi Prem,

    Thanks for your answer.

    We have solved it in another way.

    We have used our REST API and the api account to get the sessionId.

    Then perform a rest method in powershell to download a file from an url.

    Where the url is as the following:

    qap360-d.qap360.nl/.../Template

    In which <sessionId> is the sessionId which we gotten from our REST API call, with the Rollbase api account.

    The trick is to put the ampersant (&) between the sessionid and the .Pas_Instance.

    We tried before without the ampersant (&) and that didn't work.

    Because the original url when you are logged in doesn't have the ampersant (&) there.

    But to use it as a REST API call you will need the ampersant (&).

    Kind regards,

    Ramon Schouten