Is it possible to generate a PDF document using the API?

  • Adam Cardamone
    Asked on August 9, 2020 at 9:40 AM

    Hi,

    I have a customer that is using JotForm and would like to be able to download a completed form in PDF format. They currently receive the form via Email and would like to change this.

    I know I can use your API to download the form data (presumably in json), but wondering if you have a way to get the auto generated PDF via API too?

    Thanks


    Adam

  • Kevin Support Team Lead
    Replied on August 9, 2020 at 12:11 PM

    Unfortunately, the PDF documents cannot be generated with our API; however, if your purpose is to download it, you may load the following URL: 

    https://www.jotform.com/server.php?action=getSubmissionPDF&sid=submissionID&formID=formID

    You can get the "submissionID" and "formID" with the API as well. 

    I hope this helps. 

  • Adam Cardamone
    Replied on August 9, 2020 at 7:28 PM
    Hi,
    Thanks very much for your reply, this should help.
    Regards
    Adam
    Adam Cardamone
    [cid:DDi-Solutions-Email-Logo_fdcff211-839d-4fd1-865e-c500dea56b8a.png] M: 0413 317 720
    E: adam@ddisolutions.com.au
    Custom Software, Databases and Websites
    P Please consider the environment before printing this email.
    The content of this message is confidential. If you have received it by mistake, please inform us by an email reply and then delete the message. It is forbidden to copy, forward, or in any way reveal the contents of this message to anyone. The integrity and security of this email cannot be guaranteed over the Internet. Therefore, the sender will not be held liable for any damage caused by the message.
    ________________________________
    ...
  • Adam Cardamone
    Replied on August 12, 2020 at 9:23 AM

    Hi, in testing this, it seems that there is an authentication requirement, is it possible to authenticate a web request to this url without using a web browser? 

    Without authenticating (ie not logged in to the Jotform web site), I get this error.


    Status: 400 Bad Request

    Response: {"error":"You're not authorized","success":false,"duration":"0.009"}

  • Patrick_R
    Replied on August 12, 2020 at 11:31 AM

    Hi Adam! Authenticatin via the brower is required in this case.

    However, you can disable the Privacy setting that controls this behavior, i.e. "Require log-in to see submissions.".

    You'll find this setting on this page: https://www.jotform.com/myaccount/settings

    1597246254JotFor sdfcsdy Account 2020 08 Screenshot 10

    If disabled, anyone with the PDF link can download the PDF Submission Report.

    I hope this solves your purpose. For further queries, feel free to write back to us.

    Thank you!

  • Adam Cardamone
    Replied on August 12, 2020 at 9:09 PM

    Hi,

    Thanks again for the further answer, one more clarification if I may.

    I now understand I can turn off the log in requirement, thankyou, but is there any method where I can authenticate a web request (e.g. powershell Invoke-WebRequest or standard .Net WebClient)?

    I tried using basic authentication and passing in valid credentials but that fails also. I would like to retain the security if at all possible.

  • Kevin Support Team Lead
    Replied on August 13, 2020 at 12:46 AM

    Unfortunately, there is not such function. However, an alternative would be to try logging in and out before and after accessing the link, you will find more details about each function on our API page: 

    https://api.jotform.com/docs/#user-login

    https://api.jotform.com/docs/#user-logout

    I hope this helps. 

  • Adam Cardamone
    Replied on August 16, 2020 at 6:54 PM

    Hi,

    I have been able to get the user login/logout to work so that I can keep the authentication requirement for downloading PDFs, however I seem to be hitting a limit on the number of times I can log in via the api, is this expected?

    I'm not sure what the limit is as i am doing testing so haven't really been monitoring or counting how many times until it denies me log in. 

    Is this a configurable option? I tried passing in the apikey with the call in case that helped but it didn't seem to make any difference.


    Thanks.

  • Girish JotForm Support
    Replied on August 16, 2020 at 10:21 PM

    Hello Adam,

    There are limits on API calls as explained here: https://www.jotform.com/help/406-Daily-API-Call-Limits 

    But, I could not find an account linked to your email address.

    Could you provide us your JotForm account username, please?

  • Adam Cardamone
    Replied on August 16, 2020 at 10:25 PM

    Hi,

    The account I am accessing for this purpose is username: TraceyMerriman.


    Standard API calls are working at I can see that there is a daily limit of 10000, which decreases as expected per call. It is only the api login call that seems to get limited. (FYI, when testing and I hit this 403 error, I can still log in to the account using a web browser).

  • Girish JotForm Support
    Replied on August 17, 2020 at 12:25 AM

    Hello Adam,

    I have moved your last response to a new ticket link so that I could escalate it to our concerned team.

    Here is the new link: https://www.jotform.com/answers/2516688 

  • TraceyMerriman
    Replied on August 25, 2020 at 8:42 PM
  • Adam Cardamone
    Replied on August 25, 2020 at 8:43 PM

    Hi,

    I have demonstrated the results of using https://www.jotform.com/server.php?action=getSubmissionPDF&sid=submissionID&formID=formID to our customer and they are not satisfied.

    What they want is the PDF in the format that it is when it is emailed to them. Can I tweak the url to get the customer designed form filled in as the download instead of the generic answers file?


    Thanks



    Adam

  • Girish JotForm Support
    Replied on August 25, 2020 at 9:55 PM

    Hello Adam,

    Sorry, but using that method, you only get the PDF download in the default format. It is not possible to obtain a customized PDF document using this method.

    For that, you will need to download the same from the PDF Editor.