Creating Data Elements using the API

Hello,
Hope everyone is okay.

We are working on creating a simple tool to automate how we setup data elements on a dhis2 instance.

We are using a rest client to post json to the endpoint /api/dataElements to create an element.

We are using the demo instance to test and it gives us an interesting error about a failed not null constraint on the column valuetype. This also happens when we provided values e.g valuetype:string or valueType:string , has anyone else experienced the same ? Or could you guide us on how we can get around this problem.

Is there way to see which fields are required ?

We have attached the output from the api call.

out.html (31.1 KB)

···


Muranga James

Hi James

We have a schema-generator at /api/schemas/type (/api/schemas/dataElement), sadly this is not done yet, as possible options for enums etc are not listed.

The only real solution to this today, is to create a few data-elements that has the options you want to import, then go to /api/dataElement/ID and export it… and look at the payload.

···


Morten

On Mon, Aug 25, 2014 at 6:38 PM, James Muranga jmured@gmail.com wrote:

Hello,
Hope everyone is okay.

We are working on creating a simple tool to automate how we setup data elements on a dhis2 instance.

We are using a rest client to post json to the endpoint /api/dataElements to create an element.

We are using the demo instance to test and it gives us an interesting error about a failed not null constraint on the column valuetype. This also happens when we provided values e.g valuetype:string or valueType:string , has anyone else experienced the same ? Or could you guide us on how we can get around this problem.

Is there way to see which fields are required ?

We have attached the output from the api call.


Muranga James


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

Thanks Morten , the schemas endpoint is what we were looking for .
We can view the options for enum from the dhis2 web interface for now .
Thanks

···

On Mon, Aug 25, 2014 at 2:48 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi James

We have a schema-generator at /api/schemas/type (/api/schemas/dataElement), sadly this is not done yet, as possible options for enums etc are not listed.

The only real solution to this today, is to create a few data-elements that has the options you want to import, then go to /api/dataElement/ID and export it… and look at the payload.


Muranga James


Morten

On Mon, Aug 25, 2014 at 6:38 PM, James Muranga jmured@gmail.com wrote:

Hello,
Hope everyone is okay.

We are working on creating a simple tool to automate how we setup data elements on a dhis2 instance.

We are using a rest client to post json to the endpoint /api/dataElements to create an element.

We are using the demo instance to test and it gives us an interesting error about a failed not null constraint on the column valuetype. This also happens when we provided values e.g valuetype:string or valueType:string , has anyone else experienced the same ? Or could you guide us on how we can get around this problem.

Is there way to see which fields are required ?

We have attached the output from the api call.


Muranga James


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

Hi Everyone

On a similar note, is it possible to purposely set the UID value for a particular element/indicator/orgunit using the web API?

Regards,

Greg

···

On Mon, Aug 25, 2014 at 1:57 PM, James Muranga jmured@gmail.com wrote:

Thanks Morten , the schemas endpoint is what we were looking for .
We can view the options for enum from the dhis2 web interface for now .
Thanks


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

Business Intelligence Planner

Health Information Systems Programme

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432
Skype: gregory_rowles

On Mon, Aug 25, 2014 at 2:48 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi James

We have a schema-generator at /api/schemas/type (/api/schemas/dataElement), sadly this is not done yet, as possible options for enums etc are not listed.

The only real solution to this today, is to create a few data-elements that has the options you want to import, then go to /api/dataElement/ID and export it… and look at the payload.


Muranga James


Morten

On Mon, Aug 25, 2014 at 6:38 PM, James Muranga jmured@gmail.com wrote:

Hello,
Hope everyone is okay.

We are working on creating a simple tool to automate how we setup data elements on a dhis2 instance.

We are using a rest client to post json to the endpoint /api/dataElements to create an element.

We are using the demo instance to test and it gives us an interesting error about a failed not null constraint on the column valuetype. This also happens when we provided values e.g valuetype:string or valueType:string , has anyone else experienced the same ? Or could you guide us on how we can get around this problem.

Is there way to see which fields are required ?

We have attached the output from the api call.


Muranga James


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

Hi Greg

It is. At least when posting through the metadata endpoint I can verify that uids are preserved.

Bob

···

On 25 August 2014 13:38, Greg Rowles greg.rowles@gmail.com wrote:

Hi Everyone

On a similar note, is it possible to purposely set the UID value for a particular element/indicator/orgunit using the web API?

Regards,

Greg


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 Mon, Aug 25, 2014 at 1:57 PM, James Muranga jmured@gmail.com wrote:

Thanks Morten , the schemas endpoint is what we were looking for .
We can view the options for enum from the dhis2 web interface for now .
Thanks


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

Business Intelligence Planner

Health Information Systems Programme

**- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - - - ****- - - - - **

Mobile : 073 246 2992
Landline: 021 554 3130
Fax: 086 733 8432

Skype: gregory_rowles

On Mon, Aug 25, 2014 at 2:48 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi James

We have a schema-generator at /api/schemas/type (/api/schemas/dataElement), sadly this is not done yet, as possible options for enums etc are not listed.

The only real solution to this today, is to create a few data-elements that has the options you want to import, then go to /api/dataElement/ID and export it… and look at the payload.


Muranga James


Morten

On Mon, Aug 25, 2014 at 6:38 PM, James Muranga jmured@gmail.com wrote:

Hello,
Hope everyone is okay.

We are working on creating a simple tool to automate how we setup data elements on a dhis2 instance.

We are using a rest client to post json to the endpoint /api/dataElements to create an element.

We are using the demo instance to test and it gives us an interesting error about a failed not null constraint on the column valuetype. This also happens when we provided values e.g valuetype:string or valueType:string , has anyone else experienced the same ? Or could you guide us on how we can get around this problem.

Is there way to see which fields are required ?

We have attached the output from the api call.


Muranga James


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