Forum Discussion

MalcolmMcDonald's avatar
MalcolmMcDonald
Qrew Cadet
6 months ago

Jotforms API

Hey folks - 

Sharing a win for future generations - I use Jotforms on the website to gather simple form data...but their webhook payload is in multipart/form-type rather than JSON. Had to take a couple steps to make it usable.

Getting the Submission ID

Their API lets you call form data and get a JSON response if you know the submission ID. After resetting up the incoming webhook, fetch JSON using the following:

{% set data = a.body %}
{% set start = data.find('name="submissionID"') + 20 %}
{% set end = data.find('-', start) %}
{% set submission_id = data[start:end]|trim %}
 
This parses through the lengthy multipart/formdata content, searching for SubmissionID, pulling the data, and trimming any extra spaces for safety.  A bit of a fragile solution because it really depends on JotForm not changing their wording, but works well enough.
The api URL I can call then looks like:
Getting the file
I have a file attachment in the 12th field of the JSON; but extracting a clean name was also difficult.
The JSON only gives a result like:
That provides the path to download the file, but to strip the name out, jinja split needs to be used; however, the node the url is on is a list.
I know there will only be one file - so used the following to work around the split limitation.
{% set dlurl = c.raw_record.answers['12'].answer[0] %}
{% set parts = dlurl.split('/') %}
{% set last_part = parts[-1] %}
 
{{ last_part|trim }}
Where the [0] pulls the index 0 from the list array.
Hope this helps someone in the future!


------------------------------
Malcolm McDonald
------------------------------

2 Replies

  • Thx for sharing!



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
  • Malcom,

    Thanks for posting this . You know JotForms also does a webhook on submission which can be directed toward QuickBase incoming webhook



    ------------------------------
    Prashant Maheshwari
    ------------------------------