dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #16590
DHIS2 Web API and R
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
Follow ups