How to get form submissions by date and/or filtered by a field value
SOLVE
Hello,
I would like to know if it is possible, via the API, to get forms submissions (for a specific form) filtered by date or by field value.
In my case I have to retrieve the number of submissions of a form by country (with a country field in the form) monthly. Example : Get the number of submissions on the form with ID "xxx-xxx-xxx" where the submissions were created on january 2021 (from january 1st to 31) and where the country field of each submission is "France"
The only option I found for now is to use this method : https://legacydocs.hubspot.com/docs/methods/forms/get-submissions-for-a-form I'll have to parse every submission to check country field value, this is not a problem, but I would like to know if there is any possiblity to filter on the field value during the request.
And for the date, I read that submissions are returned in reverse chronological order. It's okay to retrieve data from 1 or 2 months ago, but if I need to get data from older months, it'll be a bit difficult and weird. I'll have to parse every submission, check the "submittedAt" value until I reach the needed date. Is there a parameter or another API call that can help me get the data I need ?
I also looked at analytics data ( https://legacydocs.hubspot.com/docs/methods/analytics/get-analytics-data-by-object ). With this method, I have the date filter and it directly return the number of submissions, which is what I need in the end. But I can't see any possibility to pass parameters to filter on submissions field value. And I think this method is not available for professional license, when I tried, I got a 403 error, but I can't find on the API documentation what methods are restricted by license/account type.
Why does the "submissions/forms" method can't accept a date parameter while the "reports/:object_type" the method can ?
Thanks in advance for your help, Valentin - Concept Image