Unable to interact with new Tracker Import endpoint using App runtime (DHIS2 2.37) [fixed]

I am unable to create a data mutation for the new Tracker endpoint using the useDataMutation hook, as it fails while attempting to access the new Tracker API with the apiVersion in the URL.

Chrome console logs indicate that a 404 is returned when an attempt is made by app runtime data engine to access /api/37/tracker. The new Tracker API is confirmed to be working if /api/tracker endpoint is used rather than /api/<apiVersion>/tracker, however, data engine seems to settle for the latter.

Here is the mutation defined for the request:

const mutation = {
   resource: 'tracker',
   type: 'create',
   params: {
      importMode: 'COMMIT',
      importStrategy: 'CREATE_AND_UPDATE'
   data: {
      events: []

Any thoughts regarding how to get around this, or is a direct API call to /api/tracker the only available option right now?


Hi @barbietunnie, sorry you are running into this issue.

It is correct that this is not currently supported in 2.37 - it has been fixed in 2.38 and will be backported to the next patch of 2.37 soon (see DHIS2-12819)

Until this has been patched in 2.37 we will be updating the app-runtime to support this endpoint. That should be available next week, I will update here when it is available. You can always use direct REST API fetch calls in the meantime.


Thanks for the feedback @austin

1 Like

Thanks for this @austin! Any update on the app runtime update? I was just looking at the commit history and it seems like this is still a work in progress?

1 Like

@plinnegan this has been released in app-runtime version 3.4.1


Thanks it’s working great!

1 Like

Hi @austin

Thanks for the fix. However, this only works for the tracker resource and not its sub-resources such as tracker/jobs. I can open a PR for a fix to change this check to resource.startsWith('tracker') along with the necessary tests.

1 Like

Good catch, a PR would be great thanks @jimiolaniyan !

I think it would be better to be a bit more explicit and use resource === 'tracker' || resource.startsWith('tracker/')

1 Like

(By the way I don’t believe tracker/jobs exists - you probably mean tracker/events, tracker/enrollments, etc)

1 Like

Indeed there is tracker/jobs/<jobid> for getting the status of async imports. @austin

1 Like

Here is the PR.

1 Like

Adding a note that this issue has been marked as done: