I am trying to upload some data from excel to an existing kobo form.
I am trying using R, and simplified script for the test project is as follows -
library(httr)
library(jsonlite)
url ← “https://kobo.unhcr.org/api/v2/assets/6a1c035d-a4f9-4e13-80c2-d9ca40c9acdb/data/”
#https://kobo.unhcr.org/api/v2/assets/aSr2Aba8ti8DzZ9okGx9ZW/data/
#“https://enketo.unhcr.org/submission/l1DZEgfJ”,
data ← list(
list(
Name = “String Test Value”,
Age = 3,
Sex = “M”,
Country = “IRN”
)
)
json_data ← toJSON(data, auto_unbox = TRUE)
response ← POST(url,
body = json_data,
add_headers(
“Authorization” = paste(“Token”, “my_token”),
“Content-Type” = “application/json”
))
Check the status of the POST request
print(status_code(response))
would appreciate if anyone have done it in R/SQL/SSIS would be great!