Hi All,

I found an easier implementation of the example of using R with DHIS2. I
found that *httr* library in R is easier and uses fewer lines of code to
achieve the same.

See below.

#Library to use
library(httr)
#This is a URL endpoint for a report table which we can get from the WebAPI.
myurl<-"https://play.dhis2.org/dev/api/reportTables/KJFbpIymTAo/data.csv";

#Use httr to get the data from demo dhis2
response<-GET(url=myurl, authenticate(user="admin", password="district"))
#Here is the data
mydata<-content(response, type="text/csv")
head(mydata)

Regards,

Charles Waka
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to