Skip to content

Instantly share code, notes, and snippets.

@chathurawidanage
Last active May 4, 2017 17:42
Show Gist options
  • Save chathurawidanage/89752188aaee2ff34cf6e58b257c3f4b to your computer and use it in GitHub Desktop.
Save chathurawidanage/89752188aaee2ff34cf6e58b257c3f4b to your computer and use it in GitHub Desktop.
$.get("http://dhis.pgim.cmb.ac.lk/nss/api/organisationUnits.json?fields=[id,level,name]&filter=level:eq:3").then(function(data){
data.organisationUnits.forEach(function(ou){
$.get("http://dhis.pgim.cmb.ac.lk/nss/api/enrollments.json?ou="+ou.id+"&ouMode=DESCENDANTS&totalPages=true&skipPaging=true&programStatus=ACTIVE&program=MmGml1Gyb7K").then(function(data){
console.log(ou.name+":"+data.enrollments.length);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment