Hello,
Accessing DHIS2 trackedEntityInstances through the api endpoint does not return all attributes.
By default when you access the tracked entity instance for the first time, it returns only two attributes, fisrtName and Last Name.
When you edit the entity it now add the Unique ID, but still does not return gender.
When you change the gender, it does not show up when you call the endpoint.
But still is displayed on the UI
When you change the gender, it bring and error in the console saying.
Error: Failed to execute ‘get’ on ‘IDBObjectStore’: No key or key range specified.
Even you create new Instance, the gender attribute is not being returned even when you selected gender.
It looks like all attributes with drop downs are not returned through the api.
I used both the 2.30 and 2.31 demo servers.
I need to be able to return all attributes.
Hey @carapai!
You are right that the endpoint will by default only return a limited set of tracked entity attributes. The attributes returned will be dependent on which attributes that is set to “display in list”. When asking for tracked entity instances in the context of a program, the programs tracked entity attribute settings is used. When asking in the context of a tracked entity type, the tracked entity attributes that is set in the tracked entity type will be used.
If the user has access to capture data in the organisation unit that owns the tracked entity instance, the endpoint also allows querying the other attributes that are not returned by default. This is done by adding url params:
attribute=(uid of attribute)
For adding several attributes:
attribute=(uid of attribute)&attribute=(uid of attribute)
The tracker app however should take care of all this - I was not able to reproduce the problem that is demonstrated by your screenshot. Can you make sure you clean the cache and retry - if the problem persists it would be great with some steps to reproduce it.