Application programming interface (API)
- Previous version was designed for the user. This version is designed for an application to enter all parameter values.
The code on this page uploads leaf suggestions to Handprinter database. In addition, it produces a URL link that contains the data given, and so it shows how the same data can be uploaded using an application external to Opasnet. For more about the URL formatting, see R-tools#Giving parameters in an URL.
The input is a table where the columns are separated by "|" and rows are separated by "||". The test version has four columns: Leaf_id, Name, Idea, and Result.
You must know the password to make the code actually work. At this testing phase, it is 72634524.
library(OpasnetUtils) library(OpasnetUtilsExt) colnam <- c("Leaf_id", "Name", "Idea", "Result") set.seed(pw) if(round(runif(1), 6) != 0.921817) stop("Wrong password") dat <- strsplit(inp, split = "\\|\\|")[] dat <- strsplit(dat, split = "\\|") dat <- as.data.frame(t(as.data.frame(dat))) colnames(dat) <- colnam rownames(dat) <- 1:nrow(dat) oprint(dat) out <- paste("Handprinter_API?app[pw]=00000000&app[inp]=", inp, sep = "") olink(out, wiki = "op_en", text = "This URL uploads the data given to the API") opbase.upload( dat, ident = "Op_en6285", name = "Handprinter_API", subset = "Leaves", act_type = "append", language = "eng", who = wiki_username )