Android Capture app: Why is the trackedEntityInstances API call missing the `ou` parameter during login?

android
(David Huser) #1

This is not (yet?) a bug report as it also could be a configuration bug but it’s very difficult to find out the cause so far.

Every time upon login it fails with a 409 when requesting trackedEntityInstances due to the ou= parameter being empty. The response is 409 with “At least one organisation unit must be specified”.

The user has access to (all 3 types of) Org Units, Programs are assigned to Org Units etc. - general data entry works in the GUI (Tracker Capture, Event Capture, Data Entry) but not in the Android app.

Could you share what is the source for the ou parameter when accessing TEIs in order to track back?
The /api/me … call correctly returns an array of orgunits for organisationUnits and teiSearchOrganisationUnits.

Entry from Nginx’s access log:

Summary

::ffff:xx.xx.xx.xx - username [15/May/2019:11:56:47 +0000] “GET /api/trackedEntityInstances?ou=&ouMode=DESCENDANTS&fields=trackedEntityInstance,created,lastUpdated,orgUnit,trackedEntityType,coordinates,featureType,deleted,relationships[trackedEntityInstanceA,trackedEntityInstanceB,relationship,relationshipName,relationshipType,created,lastUpdated,from[trackedEntityInstance[trackedEntityInstance],enrollment[enrollment],event[event]],to[trackedEntityInstance[trackedEntityInstance],enrollment[enrollment],event[event]],relative],attributes[attribute,value,created,lastUpdated],enrollments[enrollment,created,lastUpdated,orgUnit,program,enrollmentDate,incidentDate,followup,status,deleted,trackedEntityInstance,coordinate,events[event,enrollment,created,lastUpdated,status,coordinate,program,programStage,orgUnit,eventDate,completedDate,deleted,dueDate,attributeOptionCombo,dataValues[dataElement,storedBy,value,created,lastUpdated,providedElsewhere]],notes[note,value,storedBy,storedDate]],attributes[attribute,value,created,lastUpdated]&paging=true&page=10&pageSize=50&includeAllAttributes=true HTTP/1.1” 409 124 “-” “Dhis2/0.15.5-SNAPSHOT/1.2.3/Android_25” “-”

DHIS2 is on 2.31.2 f3d71fe (an upgrade to 2.31.3 did not help)
App versions tested: 1.2.1, 1.2.2, 1.2.3
Android version: 7.1

1 Like
(James Omutsani) #2

Hi @dhuser,

As the community members explore this, our team from @dhis2-android will have a look at it and advise too.

Best,
James.

1 Like
(Marta Vila) #3

Hi @dhuser,

it has actually been reported here: https://jira.dhis2.org/browse/ANDROAPP-2163. We are having a look.

Are you and @berhard working on the same instance?

1 Like
(David Huser) #4

Yes, that is the same instance @marta - cc @berhard - happy to provide more info!

1 Like
(Blake Erhardt-Ohren) #5

Hi Marta,

Yes, we are working on the same instance.

1 Like
(Pablo Pajuelo Cabezas) #6

Hi @dhuser, @berhard,

Can you share with us some testing credentials? We would like to check it.

Thank you!

2 Likes
(Pablo Pajuelo Cabezas) #7

So the problem comes from the api call:
https://pathfinder.baosystems.com/api/trackedEntityTypes
Missing required properties: trackedEntityAttribute

Not sure why it is not returning them. Maybe it is a problem with the use of brackets… check if this helps:

I’ll keep on testing.

1 Like
(David Huser) #8

Thanks @Pablo - the use of brackets is allowed in the Tomcat settings - Tracker Capture also opens normally

1 Like
(Pablo Pajuelo Cabezas) #9

Ok. Then it seems it is a sharing settings issue. Could you check the permissions?

1 Like
(David Huser) #10

@Pablo Sure, what is the full API call used? I assume it’s still trackedEntityTypes? Or is that but nested in another resource?

1 Like
(David Huser) #11

only strange thing I found so far is <displayShortName>null </displayShortName> when looking at TETAs at https://server.com/api/trackedEntityTypes?fields=:all (with specific user) as TETAs do not have shortNames. Sharing looks alright for TETs and TETAs though

1 Like
(David Huser) #12

It is related to trackedentitytypeattribute.trackedentityattributeid being NULL (see here for more details): https://jira.dhis2.org/browse/ANDROAPP-2163. Deleting the NULL records leads to a working login (would probably need proper clean up).

2 Likes