I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
···
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
···
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
This is the other way (I had forgotten to put “true” at the end) - though I dont understand why it is parent and not parentid…
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=parent:null:true
···
On Wed, Jun 11, 2014 at 8:08 AM, Knut Staring knutst@gmail.com wrote:
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
It points to the “parent” field in the object, not to the db directly.
filter=parent:null seems to be sufficient.
···
On Wed, Jun 11, 2014 at 8:13 AM, Knut Staring knutst@gmail.com wrote:
This is the other way (I had forgotten to put “true” at the end) - though I dont understand why it is parent and not parentid…
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=parent:null:true
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
On Wed, Jun 11, 2014 at 8:08 AM, Knut Staring knutst@gmail.com wrote:
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
Right…
And therefore it seems not to be possible to do this:
parent:null:false
Just gives the same as parent:null
···
On Wed, Jun 11, 2014 at 8:25 AM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:
It points to the “parent” field in the object, not to the db directly.
filter=parent:null seems to be sufficient.
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:13 AM, Knut Staring knutst@gmail.com wrote:
This is the other way (I had forgotten to put “true” at the end) - though I dont understand why it is parent and not parentid…
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=parent:null:true
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
On Wed, Jun 11, 2014 at 8:08 AM, Knut Staring knutst@gmail.com wrote:
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
If you want to get the data view root(s) for the logged in user instead of hard coding level:eq:1 you can use
http://apps.dhis2.org/demo/api/organisationUnits.json?userDataViewFallback=true
which falls back to level 1 if no data view orgunits are specified.
···
On Wed, Jun 11, 2014 at 8:25 AM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:
It points to the “parent” field in the object, not to the db directly.
filter=parent:null seems to be sufficient.
On Wed, Jun 11, 2014 at 8:13 AM, Knut Staring knutst@gmail.com wrote:
This is the other way (I had forgotten to put “true” at the end) - though I dont understand why it is parent and not parentid…
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=parent:null:true
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
On Wed, Jun 11, 2014 at 8:08 AM, Knut Staring knutst@gmail.com wrote:
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
Great, thanks.
Sorry for the newbie question, but could you please also tell me how to deal with this? I am trying something like this, but not sure how to access the ID that comes back:
var url = dhis_api_base +‘organisationUnits.json?userDataViewFallback=true’;
console.log(url);
$.getJSON( url, function( json ) {
console.dir(json);
});
···
On Wed, Jun 11, 2014 at 8:31 AM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:
If you want to get the data view root(s) for the logged in user instead of hard coding level:eq:1 you can use
http://apps.dhis2.org/demo/api/organisationUnits.json?userDataViewFallback=true
which falls back to level 1 if no data view orgunits are specified.
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:25 AM, Jan Henrik Øverland janhenrik.overland@gmail.com wrote:
It points to the “parent” field in the object, not to the db directly.
filter=parent:null seems to be sufficient.
On Wed, Jun 11, 2014 at 8:13 AM, Knut Staring knutst@gmail.com wrote:
This is the other way (I had forgotten to put “true” at the end) - though I dont understand why it is parent and not parentid…
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=parent:null:true
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
On Wed, Jun 11, 2014 at 8:08 AM, Knut Staring knutst@gmail.com wrote:
Thanks to Jason, I see this is working:
http://apps.dhis2.org/demo/api/organisationUnits.json?filter=level:eq:1
http://apps.dhis2.org/dev/api/organisationUnits.json?filter=level:eq:1
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:03 AM, Knut Staring knutst@gmail.com wrote:
I am trying to use the filtering as described in the manual:
http://www.dhis2.org/doc/snapshot/en/user/html/ch30s06.html
My goal is to do something like this (in order to find the Root OU), but the filter seems to have no effect?
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
http://apps.dhis2.org/demo/api/organisationUnits?filter=parentid:null
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
morten
(Morten Hansen)
11 June 2014 07:03
8
$.ajax({
url: URL,
dataType: 'json'
}).done(function(data) {
$.each(data.organisationUnits, function(idx) {
console.log("root" + idx + ": " + this.id);
})
});
Something like that could work, it returns an array of orgUnits
···
On Wed, Jun 11, 2014 at 8:50 AM, Knut Staring <knutst@gmail.com> wrote:
$.getJSON( url, function( json ) {
console.dir(json);
});
--
Morten
Thanks!
I now did this, which also works:
var url = dhis_api_base +‘organisationUnits.json?userDataViewFallback=true’;
$.getJSON( url, function( json ) {
console.dir(json.organisationUnits[0].name + ' has UID ' + json.organisationUnits[0].id);
});
···
On Wed, Jun 11, 2014 at 9:03 AM, Morten Olav Hansen mortenoh@gmail.com wrote:
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:50 AM, Knut Staring knutst@gmail.com wrote:
$.getJSON( url, function( json ) {
console.dir(json);
});
$.ajax({
url: URL,
dataType: ‘json’
}).done(function(data) {
$.each(data.organisationUnits, function(idx) {
console.log(“root” + idx + ": " + this.id );
})
});
Something like that could work, it returns an array of orgUnits
–
Morten
Thanks Knut for raising this question. Now I no longer have to hard code the root OU UID so as to render the full OU hierarchy in my apps.
···
On Wed, Jun 11, 2014 at 9:07 AM, Knut Staring knutst@gmail.com wrote:
Thanks!
I now did this, which also works:
var url = dhis_api_base +‘organisationUnits.json?userDataViewFallback=true’;
$.getJSON( url, function( json ) {
console.dir(json.organisationUnits[0].name + ’ has UID ’ + json.organisationUnits[0].id);
});
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
–
Farai Mutero
On Wed, Jun 11, 2014 at 9:03 AM, Morten Olav Hansen mortenoh@gmail.com wrote:
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:50 AM, Knut Staring knutst@gmail.com wrote:
$.getJSON( url, function( json ) {
console.dir(json);
});
$.ajax({
url: URL,
dataType: ‘json’
}).done(function(data) {
$.each(data.organisationUnits, function(idx) {
console.log(“root” + idx + ": " + this.id );
})
});
Something like that could work, it returns an array of orgUnits
–
Morten
Yes, I think we should try to add these kind of helpful tips to the manual. The Web API is quite extensively covered, but there is still some leap to get started with apps for those of us who are not experienced API + JS developers…
···
On Wed, Jun 11, 2014 at 9:09 AM, Farai Mutero fmutero@gmail.com wrote:
Thanks Knut for raising this question. Now I no longer have to hard code the root OU UID so as to render the full OU hierarchy in my apps.
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 9:07 AM, Knut Staring knutst@gmail.com wrote:
Thanks!
I now did this, which also works:
var url = dhis_api_base +‘organisationUnits.json?userDataViewFallback=true’;
$.getJSON( url, function( json ) {
console.dir(json.organisationUnits[0].name + ’ has UID ’ + json.organisationUnits[0].id);
});
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
–
Farai Mutero
On Wed, Jun 11, 2014 at 9:03 AM, Morten Olav Hansen mortenoh@gmail.com wrote:
–
Knut Staring
Dept. of Informatics, University of Oslo
+4791880522
http://dhis2.org
On Wed, Jun 11, 2014 at 8:50 AM, Knut Staring knutst@gmail.com wrote:
$.getJSON( url, function( json ) {
console.dir(json);
});
$.ajax({
url: URL,
dataType: ‘json’
}).done(function(data) {
$.each(data.organisationUnits, function(idx) {
console.log(“root” + idx + ": " + this.id );
})
});
Something like that could work, it returns an array of orgUnits
–
Morten