How to filter requests? It seems that filtering doesn't work now

  • lskjvbh
    Asked on November 24, 2015 at 6:46 AM
    Please see the screenshot. This is a piece of response for "GET /user/submissions". The goal is to select ONLY those submissions that have "type: control_paypal" and/or "type: control_payment". And it seems that the filtering doesn't work. My request url is this: "https://api.jotform.com/user/submissions?apiKey=.....&limit=20&filter=%7B%22type%22%3A%22control_paypal%22%7D". I encode desired uri component like this "encodeURIComponent(JSON.stringify({"type":"control_paypal"}))" and append it to my request url. As you can see I do "limit=20". It means I have to get 20 entries with "type: control_paypal". But for some reason I get 20 entries and only 12 of them have "type: control_paypal". So the response is the same as without adding a filter, as if I only use "limit=20". My question is: How to filter? Does this feature work?here is much better markup http://developers.jotform.com/forum/post/56545743387b5d6518000015
    Jotform Thread 710841 Screenshot
  • mert JotForm UI Developer
    Replied on November 24, 2015 at 11:15 AM

    Hi there,

    Actually, filtering the submissions with "type" is not working. To do the filtering, you need to get all of the submissions, then you need to filter those with answer/content.

     

    To illustrate (not the actual code),

    for (answers) {

    if(answers[content][type] == "control_paypal")

    }

     

    Also, you can use the following guide and the examples to understand how to filter the data of the API. I assume that this link will be very beneficial:

    http://api.jotform.com/docs/#form-id-submissions

     

    For further assistance, please feel free to contact us.

    Thanks.

  • mert JotForm UI Developer
    Replied on November 24, 2015 at 11:42 AM

    In addition, you can also use the app called "JotPayments". You can easily add this app to your form by using the following link:

    http://apps.jotform.com/app/jotpayments