```{r}
# Write your code here
```
Appendix F β Import data from ODK Central
F.1 Introduction
F.1.1 Overview
Application Programming Interfaces (APIs) allow you to import data directly from servers.
F.1.2 Learning objectives
- We will explore the use of APIs through the example of ruODK for importing data from ODK Central to R.
F.2 Tutorial
While data digitally captured using ODK Collect or Enketo and stored in ODK Central can be retrieved in bulk through the web interface, ODK Centralβs API provides direct access to its data (and functionality). It is a more efficient way to ensure that data are always up-to-date.
We will see how to retrieve data through the OData API.
Connect to the ODK Central server data set.
- odata service: βhttps://private-anon-24fcfe2426-odkcentral.apiary-mock.com/v1/projects/7/forms/simple.svcβ
- Email: βmy.email.address@getodk.orgβ
- Password: βmy.super.secure.passwordβ.
```{r}
# ruODK::ru_setup(
# svc = "https://private-anon-24fcfe2426-odkcentral.apiary-mock.com/v1/projects/7/forms/simple.svc",
# un = "my.email.address@getodk.org",
# pw = "my.super.secure.password",
# verbose = TRUE
# )
```
library(reticulate)
Warning: Paket 'reticulate' wurde unter R Version 4.3.3 erstellt
#reticulate::use_condaenv("pyodk_test", required = TRUE)
#reticulate::py_discover_config()
https://docs.google.com/presentation/d/1oJdAdmeCIsGTp9083vAS-c5S5rnaO7e3pxzfFYe9-UI/edit#slide=id.g16c4e809b19_0_178
#from pyodk.client import Client
#client = Client()
#client.open()
Retrieve data from form and store the data set into a data frame called df4
- R: use the odata_submission_get function from the
ruODK
package (1). - Python: use functions from the
pyODK
package.
```{r}
# Write your code here
```
```{r}
#fq_form_schema <- ruODK::form_schema()
#fq_form_schema
```
```{r}
#df <- ruODK::odata_service_get()
#df
```
F.3 Encrypted data
Encrypted data can only be retrieved using the RESTful API and cannot be retrieved using the oData API. ODK Central supports two modes of encryption - learn about them here. ruODK supports project managed encryption, however the support is limited to exactly one encryption key. The supplied passphrase will be used against the first returned encryption key. Remaining encryption keys are ignored by ruODK.
If an incorrect passphrase is given, the request is terminated immediately. It has been reported that multiple requests with incorrect passphrases can crash ODK Central.