How to push data using API from other mysql server/application

I have imported the metadata of Covid-19 and Immunization.

I have created a YoY chart, now I want to PUSH data from the MySQL server to this DHIS2 using API.

I have gone through various pages such as (DHIS 2 Demo - Sierra Leone) but have not been able to find the solution for it. I want to know how to create an API for that and which fields need to be added for that particular data set/indicators etc.

Here I am attaching the screenshot where I want to PUSH data using API.
Chart:


Data:

Thank you for your post @kandarpjoshi!

It sounds like you are going to have several databases and sources for the info, so it’d interesting to know why it’s necessary to push from MySQL server instead of entering data directly to DHIS2? DHIS2 uses Postgresql which is open-source too!

The developer docs offer detailed instructions on using the api so you’d probably start there, and as for which fields, it depends on the endpoint that is being used. For example, the /Indicators endpoint only allows the “GET” method but not a ‘post’ method because the Indicator needs to calculate it’s values based on the indicator expression; on the other hand, there are endpoints which allow for the ‘POST’ method using CSV metadata export: Metadata - DHIS2 Documentation

It’s clear what’s required exactly, could you explain the steps that need to be taken? I see that the Data Visualizer app created the chart based on your explanation.

Thanks!

Hello Addin,

#It sounds like you are going to have several databases and sources for the info, so it’d interesting to know why it’s necessary to push from MySQL server instead of entering data directly to DHIS2? DHIS2 uses Postgresql which is open-source too!

: My data is stored in Mysql, so I want to pull it from Mysql Database and I am willing to PUSH those data in DHIS2.

I have gone through Metadata - DHIS2 Documentation link which is shared by you.

I tried API of dataValueSets from the command prompt,
curl -d @datavalueset.xmlDHIS 2 Demo - Sierra Leone” -H “Content-Type:application/xml” -u admin:district
But it is giving me the below error,

Please guide me.

While accessing “DHIS 2 Demo - Sierra Leone” url, it is giving below error.
“At least one organisation unit or organisation unit group must be specified”

This XML file does not appear to have any style information associated with it. The document tree is shown below.

At least one organisation unit or organisation unit group must be specified