Difference between revisions of "Handprinter API"
From Testiwiki
(updated code for API use) |
(now it works) |
||
Line 1: | Line 1: | ||
===Application programming interface (API)=== | ===Application programming interface (API)=== | ||
− | + | ||
:''[http://en.opasnet.org/en-opwiki/index.php?title=Handprinter_API&oldid=31672 Previous version] was designed for the user. This version is designed for an application to enter all parameter values. | :''[http://en.opasnet.org/en-opwiki/index.php?title=Handprinter_API&oldid=31672 Previous version] was designed for the user. This version is designed for an application to enter all parameter values. | ||
− | The | + | 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. | |
− | <rcode name="app" embed=1 recall_inputs=1 label=" | + | You must know the password to make the code actually work. At this testing phase, it is 72634524. |
+ | |||
+ | <rcode name="app" embed=1 recall_inputs=1 label="Upload data" variables=" | ||
name:pw|description:Give the password to enter data|type:default| | name:pw|description:Give the password to enter data|type:default| | ||
category:Give data to be entered into the database as a text string.| | category:Give data to be entered into the database as a text string.| | ||
Line 15: | Line 17: | ||
library(OpasnetUtilsExt) | library(OpasnetUtilsExt) | ||
− | colnam <- c("Leaf_id", "Name", "Idea", " | + | colnam <- c("Leaf_id", "Name", "Idea", "Result") |
set.seed(pw) | set.seed(pw) | ||
Line 28: | Line 30: | ||
oprint(dat) | oprint(dat) | ||
− | out <- paste("Handprinter_API?app[inp]=", inp, sep = "") | + | 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") | olink(out, wiki = "op_en", text = "This URL uploads the data given to the API") | ||
Line 37: | Line 39: | ||
name = "Handprinter_API", | name = "Handprinter_API", | ||
subset = "Leaves", | subset = "Leaves", | ||
− | act_type = " | + | act_type = "append", |
language = "eng", | language = "eng", | ||
who = wiki_username | who = wiki_username | ||
) | ) | ||
+ | </rcode> | ||
− | + | === Show leaves in the database === | |
+ | |||
+ | {{resultlink}} |
Latest revision as of 14:53, 6 February 2016
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.