# 🚀 DHIS2@6.0.0 Adaptor Released!

**URL:** <https://community.openfn.org/t/dhis2-6-0-0-adaptor-released/666>\
**Category:** Adaptors & Templates\
**Created:** [November 29, 2024, 6:20am UTC](https://community.openfn.org/t/dhis2-6-0-0-adaptor-released/666 "2024-11-29T06:20:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtuchi](https://community.openfn.org/user_avatar/community.openfn.org/mtuchi/32/81_2.png) [@mtuchi](https://community.openfn.org/u/mtuchi)\
**Post date:** [November 29, 2024, 6:20am UTC](https://community.openfn.org/t/dhis2-6-0-0-adaptor-released/666/1 "2024-11-29T06:20:40Z")

</div>

Hey Community 👋

We are excited to announce the release of [version 6.0.0 of the DHIS2 adaptor](https://docs.openfn.org/adaptors/packages/dhis2-changelog#600), introducing significant enhancements to align with the latest [DHIS2 version](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#tracker).This update migrates the adaptor to the new Tracker API (v36+) for resources such as `trackedEntities`, `enrollments`, `events`, and `relationships`. Notably, the `trackedEntityInstances` resource is now deprecated.

The `create`, `update`, `upsert`, and `destroy` functions have been updated to automatically map affected resources to the new Tracker API endpoints. However, existing workflows utilizing these functions with the aforementioned resources may require adjustments to ensure compatibility with the new API structure.We recommend reviewing your code in accordance with the [DHIS2 Tracker Migration Guide](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#tracker) to understand the necessary changes.

For instance, previous implementations using:

```javascript
create('trackedEntityInstances', {
/*...*/
});

```

should be updated to:

```javascript
create('trackedEntities', {  
  /*...*/  
});

```

Similarly, payload structures have evolved. For example, an event creation that previously looked like:

```javascript
create('events', {  
  trackedEntityInstance: 'eBAyeGv0exc',  
  eventDate: '2024-01-01',  
  /* ... */  
});

```

should now be modified to:

```javascript
create('events', {  
  trackedEntity: 'eBAyeGv0exc',  
  occurredAt: '2024-01-01',  
  /* ... */  
});

```

Please note that the HTTP APIs `get()`, `patch()`, and `post()` will continue to call the specified URLs with the provided data without automatic mapping to the new Tracker API.This allows for direct interaction with any DHIS2 API endpoint.

We encourage all users to update to version 6.0.0 to take advantage of these improvements and to ensure seamless integration with DHIS2. As always, we appreciate your feedback and are here to assist with any questions during this transition.

---

<div class="post-metadata">

**Author:** ![mtuchi](https://community.openfn.org/user_avatar/community.openfn.org/mtuchi/32/81_2.png) [@mtuchi](https://community.openfn.org/u/mtuchi)\
**Post date:** [November 29, 2024, 6:24am UTC](https://community.openfn.org/t/dhis2-6-0-0-adaptor-released/666/2 "2024-11-29T06:24:19Z")

</div>

#### Examples

**Creating multiple `trackedEntities`**

```js
create('trackedEntities', [
  {
    trackedEntityType: 'MCPQUTHX1Ze',
    orgUnit: 'DiszpKrYNg8',
    attributes: [
      { attribute: 'w75KJ2mc4zz', value: 'John Doe' },
      { attribute: 'zDhUuAYrxNC', value: 'john.doe@example.com' }
    ]
  },
  {
    trackedEntityType: 'MCPQUTHX1Ze',
    orgUnit: 'DiszpKrYNg8',
    attributes: [
      { attribute: 'w75KJ2mc4zz', value: 'Jane Smith' },
      { attribute: 'zDhUuAYrxNC', value: 'jane.smith@example.com' }
    ]
  }
]);

```

**Creating Multiple `events`**

```js
create('events', [
  {
    program: 'IpHINAT79UW',
    orgUnit: 'DiszpKrYNg8',
    trackedEntity: 'eBAyeGv0exc',
    occurredAt: '2024-01-01',
    dataValues: [
      { dataElement: 'fWIAEtYVEGk', value: '5' },
      { dataElement: 'cYeuwXTCPkU', value: 'Positive' }
    ]
  },
  {
    program: 'IpHINAT79UW',
    orgUnit: 'DiszpKrYNg8',
    trackedEntity: 'hT5pAe83j7x',
    occurredAt: '2024-02-01',
    dataValues: [
      { dataElement: 'fWIAEtYVEGk', value: '3' },
      { dataElement: 'cYeuwXTCPkU', value: 'Negative' }
    ]
  }
]);

```
