I am looking for a way to get the total count of submissions and count of submissions per form using the REST API. I tried several combinations but without any effort. Anyone already tackled this problem or has an idea on how to solve this??
if you send a call similar to this:
https://kc.kobotoolbox.org/api/v1/forms?format=json
you will get a json string that contains properties of all the forms that you have access.
the json string will contain 1 or more form objects with each form object containing
- a list of user objects
- a list of metadata objects
this is the structure of the form object in c#:
public class KoboForm
{
public string url { get; set; }
public int formid { get; set; }
public List<Metadata> metadata { get; set; }
public string owner { get; set; }
public bool is_public { get; set; }
public bool public_data { get; set; }
public bool require_auth { get; set; }
public int submission_count_for_today { get; set; }
public List<object> tags { get; set; }
public string title { get; set; }
public List<User> users { get; set; }
public string hash { get; set; }
public bool has_kpi_hooks { get; set; }
public string description { get; set; }
public bool downloadable { get; set; }
public bool allows_sms { get; set; }
public bool encrypted { get; set; }
public string sms_id_string { get; set; }
public string id_string { get; set; }
public DateTime date_created { get; set; }
public DateTime date_modified { get; set; }
public DateTime last_submission_time { get; set; }
public string uuid { get; set; }
public string bamboo_dataset { get; set; }
public bool instances_with_geopoints { get; set; }
public int num_of_submissions { get; set; }
public string kpi_asset_uid { get; set; }
}
you will get several interesting properties for each form like
submission_count_for_today
last_submission_time
num_of_submissions
You now have all the data you need to get total count of submissions and count of submissions per form.
2 Likes