Accessing Form Data via R

Dear all,

I am attempting to access form data via the tutorial found at https://humanitarian-user-group.github.io/post/kobo_restapi/ .

I have so far written the following script:

library(httr)
library(jsonlite)
#for reading and writing data
library(readr) # to read CSV data
library(openxlsx) # to write to excel file

kobo_server_url<-"https://kobo.humanitarianresponse.info/"

form_id<-"a75awiQyBniHSfmSgxaKiu" #change the id to your form's id
url<-paste0(kobo_server_url,"api/v1/data/",form_id,".csv")
rawdata<-GET(url,authenticate("user","password"),progress())
print(paste0("Status Code: ",rawdata$status_code))

d_content <- content(rawdata,"raw",encoding="UTF-8")
d_content_csv <- read_csv(d_content)

However the line which prints the Status Code tells me the request has met with a 404 error. I wonder if the form Id is the issue. Where does one get the form Id from on Kobo Toolbox?

Kind regards

Hi @Tumaini
Welcome to the community forum.

I would suggest that you kindly look at the following discussion.

Stephane

1 Like