0

Retrieving Document ID via API

I'm building a solution involves saving form data and a PDF version of the data on a remote server from ProntoForms.  A form submission creates a PDF of the data and send the JSON to a Web API endpoint (that will do the work).  The plan is for that Web API to call the ProntoForms API to retrieve the PDF document and attach it to the data on the remote server (via its id).

I know the format for that API cal for retrieving the document_idl is:

api.prontoforms.com/api/1/data/[id]/documents/[document_id]

What I don't know is how to retrieve that document_id without the use of the Admin portal (as the example on the Support API page says to do, which isn't applicable in my case).  Is there any way to get that document_id either in the JSON itself that is initially created or through the API?  Not having a way to do this doesn't make sense to me so I feel I am missing it: this is all programming via API, so retrieving a document_id from a website isn't applicable.

5 comments

  • 0
    Avatar
    Danielle Morley

    Hi Tony,

    There is no way to retrieve a list of document ID's through the API at this time

    You may already know this part, but I'll clarify just in case -- the "document_id" is the the ID of the PDF template, not the individual PDF document generated from an individual form submission.   That template is set up once, and re-used for every form submission -- so really you only need one ID, ever.  

    Does that help?

  • 0
    Avatar
    Danielle Morley

    Hi Tony,

    A few more points.

    That Document ID never changes in our system, even if that template is updated in any way -- so it's a very safe thing to embed in a script. 

    Another option --  just using "api.prontoforms.com/api/[version]/data/[id].pdf"  to retrieve a PDF will work -- but we only recommend doing this if you only have one PDF template attached to the form, not multiple.

    Lastly, depending on what you are connecting to, you could also use our HTTP POST destination to send the PDF document, rather than doing an API call to retrieve it -- it would be specified on the web portal side which PDF to use, so there is no ID to handle.

     

     

  • 0
    Avatar
    Elizabeth Allison

    Thanks for the details, Danielle!  I did not see that the ID is the same as the template, so that's my solution.  There will be only one PDF/document for the form.

    For the HTTP POST destination, from what I can see, there isn't a "if this destination is successful, perform another one".  So there's a timing issue with the data entering that system, and the document coming into it.  So the easiest way for me is, on successful data insertion, retrieve the PDF.

  • 0
    Avatar
    Danielle Morley

    Tony,

    Glad there is an option that works for you!

    Yes, at this time our destinations operate parallel/independently of each other.   You can set up rules as to when a destination executes, but it is all based on data in the form, rather than on other parts of your solution (like destinations).

    That's a good concept, though -- we'll keep that idea in mind for future development.  

  • 0
    Avatar
    Danny Williams

    Can you use the Destination Response Outputs to help with this?  We do something that sounds similar... 

    We use Data Destination #1 to create an activity in our remote system.  (but we cannot attach a pdf to it in the "create" call)

    We then use the ID of the activity that was created from the response output of the first data destination and we use it for Data Destination #2 to attach the pdf file to that activity.

     

    More information can be found here:  https://support.prontoforms.com/hc/en-us/articles/360029070591-Destination-Response-Outputs

Please sign in to leave a comment.