Jotform API: Applying Filter Does Not Return All Submissions

  • ehawman
    Answered on January 10, 2023 12:23 PM

    I am attempting to use the Jotform Python API to pull some information. I have submitted an email to api@jotform.com, but sometimes the response times can be lengthy so I'm putting this here as well.


    def get_submissions(api_key, set_form_ID, set_limit=100, set_debug=False):

        jotformAPIClient = jf.JotformAPIClient(api_key, debug=set_debug)

        return jotformAPIClient.get_form_submissions(

            formID=set_form_ID,

            limit=set_limit,

            # filterArray={

            #     "workflowStatus:eq":"Approve",

            # },

            # order_by="new"

        )


    ​Running this, I'll get the 100 most recent ​submissions.

    If I uncomment filterArray and order_by (Your API documentation says filter and orderby, btw. Very frustrating when the docs don't match the product), then I get the earliest twenty-five submissions that meet the workflowStatus criteria. That is, submissions from Jan 2022 (when I first created the form) rather than Jan 2023. The same is true if I pass "created_at" to order_by, or if I leave the order_by arg out entirely.

    I want the 100 most recent submissions which have a workflowStatus of Approve. How do I accomplish this?

  • Jovanne JotForm Support
    Answered on January 10, 2023 08:04 PM

    Hello Evan,

    Thanks for reaching out to Jotform Support. I checked your form and did not find any form with 100 submissions. Can you send me the link to your form so I can look at it for you? I also checked your filter, and it appears that you have only selected the submissions with approved workflowStatus. Can you please confirm that these 100 submissions have all approved status?

    After we hear back from you, we’ll have a better idea of what’s going on and how to help.

  • ehawman
    Answered on January 10, 2023 10:10 PM
    My apologies. I should have included the form number.
    The form in question is 220114796842154.
    ...
  • Alexander JotForm Support
    Answered on January 11, 2023 05:50 AM

    Hello Evan,

    Thanks for your reply. Please, let me some time to test and discover the issue. We will circle back to you as soon as possible.

    Thanks for your understanding and patience.

  • ehawman
    Answered on January 11, 2023 10:14 AM

    All good. Thank you!

  • Alexander JotForm Support
    Answered on January 11, 2023 10:34 AM

    Hello Evan,

    Thanks for your patience. Unfortunately, I am not familiar with Python, but if you want to use filter by approval status and creation date - you can use this API request:

    GET https://api.jotform.com/form/{formID}/submissions?apiKey={API}&orderby[created_at]=desc&filter={"workflowStatus:ne":"Approve", "created_at:gt":"2022-01-01 00:00:00"}&limit=100

    This request will show you the 100 last approved submissions created after 2022-01-01.

    You can learn more on this documentation page. 

    Let us know if you need further help.


  • ehawman
    Answered on January 11, 2023 12:20 PM

    Thank you for the assistance. For those coming after, my frankensolution looks like this

    def get_submissions(api_key, set_form_ID, set_limit=100, set_debug=False):

        url = f"https://api.jotform.com/form/{set_form_ID}/submissions?apiKey={api_key}&orderby[created_at]=desc&filter=\u007b%27workflowStatus:eq%27:%27In%20Progress%27\u007d&limit={set_limit}"

        req = urllib.request.Request(

            url,

            data=None,

            # headers are required to avoid a 403

            headers={

                "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36"

            },

        )

        data_json = json.loads(urllib.request.urlopen(req).read())

        return data_json


    This bypasses the jotform API package entirely and hard-codes things in a hideous way that works for now. I'll be opening an issue on the jotform-api-python github with this problem.

    Thank you!

  • ehawman
    Answered on January 11, 2023 12:48 PM

    This is the Github issue for future reference https://github.com/jotform/jotform-api-python/issues/27