diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index cdc66a0..df93903 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.14.0.3 pkgdown: 2.0.2 pkgdown_sha: ~ articles: {} -last_built: 2022-02-27T00:31Z +last_built: 2022-02-28T03:21Z urls: reference: https://rapidsurveys.io/okapi/reference article: https://rapidsurveys.io/okapi/articles diff --git a/docs/reference/index.html b/docs/reference/index.html index 7407531..017c4ba 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -52,7 +52,7 @@
Open Data Kit (ODK)-based Computer-assisted Personal Interview (CAPI) Tools
Configure HTTP headers
Delete published form
Retrieve specific dataset by form ID from specific user
Retrieve list of datasets available to specific user
Delete published form
List published forms
List projects
Publish XLSForm
Delete registered project
Get project info
Publish XLSForm
List projects
Register a project
Share projects with user(s)
R/ona_data.R
+ ona_data_get.Rd
Retrieve specific dataset by form ID from specific user
+ona_data_get(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password"),
+ form_id
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
Form identifier.
A tibble of retrieved dataset.
+ona_data_get(form_id = 276175)
+#> # A tibble: 4 × 31
+#> `_id` `_tags` `_uuid` `_notes` `_edited` `_status` `_version` `_duration`
+#> <int> <list> <chr> <list> <lgl> <chr> <chr> <chr>
+#> 1 24339185 <list> fcc6fe74… <list> FALSE submitte… 201801220… ""
+#> 2 24339187 <list> 9d71537b… <list> FALSE submitte… 201801220… ""
+#> 3 26371042 <list> a32ee359… <list> FALSE submitte… 201801220… ""
+#> 4 26371044 <list> 2c5eaa35… <list> FALSE submitte… 201801220… ""
+#> # … with 23 more variables: `_xform_id` <int>, `_attachments` <list>,
+#> # `_geolocation` <list>, `_media_count` <int>, `_total_media` <int>,
+#> # `final/fbmam5` <chr>, `formhub/uuid` <chr>, `_submitted_by` <chr>,
+#> # `group2/fbmam1` <chr>, `intro1/intro2` <chr>, `group1/position` <chr>,
+#> # `group1/workshop` <chr>, `meta/instanceID` <chr>, `_submission_time` <chr>,
+#> # `_xform_id_string` <chr>, `_bamboo_dataset_id` <chr>,
+#> # `_media_all_received` <lgl>, `group1/organisation` <chr>, …
+
+
Retrieve list of datasets available to specific user
+ona_data_list(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password")
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
A tibble of datasets available to specific user.
+ona_data_list()
+#> # A tibble: 0 × 1
+#> # … with 1 variable: x <list>
+
+
Delete published form
+ona_form_delete(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password"),
+ form_id = NULL
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
Form identifier.
Delete specified form from ONA.
+form_list <- ona_form_list()
+form_id <- form_list[["formid"]][form_list[["title"]] == "Appearance Widgets"]
+ona_form_delete(form_id = form_id)
+#> Response [https://api.ona.io/api/v1/forms/]
+#> Date: 2022-02-28 03:22
+#> Status: 404
+#> Content-Type: text/html; charset=utf-8
+#> Size: 4.57 kB
+#> <!DOCTYPE html>
+#> <html lang="en">
+#> <head>
+#> <meta charset="utf-8">
+#> <title>Ona</title>
+#> <meta name="description" content="Mobile data collection made easy. formh...
+#> <meta name="author" content="">
+#>
+#> <meta name="google-site-verification" content="H0JRFrqLHnVfHuZaHRfz1Gmc5f...
+#>
+#> ...
+
+
List published forms
+ona_form_list(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password")
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
A tibble of published forms.
+ona_form_list()
+#> # A tibble: 0 × 1
+#> # … with 1 variable: x <list>
+
+
Publish XLSForm
+ona_form_publish(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password"),
+ xls_file = NULL,
+ xls_url = NULL,
+ dropbox_xls_url = NULL,
+ project_id = NULL,
+ public = FALSE
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
Path to the XLSForm file.
URL to the XLSForm file.
Dropbox URL to the XLSForm file.
Project identifier of project to publish XLSForm to. +If NULL (default), XLSForm is published to the an account's default +project.
Logical. Should the form be public? Default to FALSE.
A published form on ONA.
+ona_project_register(name = "test")
+#> $owner
+#> [1] "You do not have permission to create a project in the organization validtrial."
+#>
+ona_form_publish(
+ xls_file = system.file(
+ "appearance_widgets.xlsx", package = "okapi"
+ ),
+ project_id = ona_project_list()[["projectid"]]
+)
+#> $url
+#> [1] "https://api.ona.io/api/v1/forms/652914"
+#>
+#> $formid
+#> [1] 652914
+#>
+#> $metadata
+#> list()
+#>
+#> $owner
+#> [1] "https://api.ona.io/api/v1/users/okapi_bot"
+#>
+#> $created_by
+#> [1] "https://api.ona.io/api/v1/users/okapi_bot"
+#>
+#> $public
+#> [1] FALSE
+#>
+#> $public_data
+#> [1] FALSE
+#>
+#> $public_key
+#> [1] ""
+#>
+#> $require_auth
+#> [1] FALSE
+#>
+#> $submission_count_for_today
+#> [1] 0
+#>
+#> $tags
+#> list()
+#>
+#> $title
+#> [1] "Appearance Widgets"
+#>
+#> $users
+#> is_org metadata.zebra.tos-pp.2018-03-30.date
+#> 1 FALSE 2022-02-27T08:33:12.296Z
+#> metadata.zebra.tos-pp.2018-03-30.accepted metadata.zebra.first-login
+#> 1 TRUE TRUE
+#> metadata.zebra.eu-citizen-consent.date
+#> 1 2022-02-27T08:34:27.361Z
+#> metadata.zebra.eu-citizen-consent.eu-citizen-data
+#> 1 FALSE
+#> metadata.zebra.hide-home-walkthrough?
+#> 1 TRUE
+#> metadata.zebra.hide-project-view-walkthrough? metadata.is_email_verified
+#> 1 TRUE TRUE
+#> metadata.last_password_edit first_name last_name user role
+#> 1 2022-02-27T08:33:12.024525+00:00 Okapi Bot okapi_bot owner
+#>
+#> $enketo_url
+#> [1] "https://enketo.ona.io/x/s1m4nd3g"
+#>
+#> $enketo_preview_url
+#> [1] "https://enketo.ona.io/preview/s1m4nd3g"
+#>
+#> $enketo_single_submit_url
+#> [1] "https://enketo.ona.io/x/s1m4nd3g"
+#>
+#> $num_of_submissions
+#> [1] 0
+#>
+#> $last_submission_time
+#> NULL
+#>
+#> $form_versions
+#> list()
+#>
+#> $data_views
+#> list()
+#>
+#> $xls_available
+#> [1] TRUE
+#>
+#> $has_id_string_changed
+#> [1] FALSE
+#>
+#> $description
+#> [1] ""
+#>
+#> $downloadable
+#> [1] TRUE
+#>
+#> $allows_sms
+#> [1] FALSE
+#>
+#> $encrypted
+#> [1] FALSE
+#>
+#> $sms_id_string
+#> [1] "appearance_widgets"
+#>
+#> $id_string
+#> [1] "appearance_widgets"
+#>
+#> $date_created
+#> [1] "2022-02-27T22:22:09.682388-05:00"
+#>
+#> $date_modified
+#> [1] "2022-02-27T22:22:09.682411-05:00"
+#>
+#> $uuid
+#> [1] "a199616254b6442cbdb269f36e39b80b"
+#>
+#> $bamboo_dataset
+#> [1] ""
+#>
+#> $instances_with_geopoints
+#> [1] FALSE
+#>
+#> $instances_with_osm
+#> [1] FALSE
+#>
+#> $version
+#> [1] "202202280322"
+#>
+#> $has_hxl_support
+#> [1] FALSE
+#>
+#> $last_updated_at
+#> [1] "2022-02-27T22:22:09.682466-05:00"
+#>
+#> $hash
+#> [1] "md5:535c372347d03b216bec18cdcf6ecbe3"
+#>
+#> $is_merged_dataset
+#> [1] FALSE
+#>
+#> $project
+#> [1] "https://api.ona.io/api/v1/projects/179676"
+#>
+
+
Delete registered project
+ona_project_delete(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password"),
+ project_id = NULL
+)
ONA URL. Default is https://api.ona.io.
Password or token? Default is token.
Project identifier.
Delete specified project from specific ONA account.
+project_list <- ona_project_list()
+project_id <- project_list[["projectid"]]
+ona_project_delete(project_id = project_id)
+#> Response [https://api.ona.io/api/v1/projects/179676]
+#> Date: 2022-02-28 03:22
+#> Status: 204
+#> Content-Type: <unknown>
+#> <EMPTY BODY>
+
+
ona_project_info(project_id = 179619)
-#> $url
-#> [1] "https://api.ona.io/api/v1/projects/179619"
-#>
-#> $projectid
-#> [1] 179619
-#>
-#> $owner
-#> [1] "https://api.ona.io/api/v1/users/ernestguevarra"
-#>
-#> $created_by
-#> [1] "https://api.ona.io/api/v1/users/ernestguevarra"
-#>
-#> $metadata
-#> $metadata$description
-#> [1] "Default Project"
-#>
-#>
-#> $starred
-#> [1] FALSE
-#>
-#> $users
-#> is_org metadata.zebra.tos-pp.2018-03-30.date
-#> 1 FALSE 2018-06-02T18:56:14.817Z
-#> 2 FALSE 2020-09-17T11:52:25.034Z
-#> metadata.zebra.tos-pp.2018-03-30.accepted metadata.zebra.tos-pp.nil.date
-#> 1 TRUE <NA>
-#> 2 TRUE 2021-01-07T09:43:19.973Z
-#> metadata.zebra.tos-pp.nil.accepted metadata.zebra.eu-citizen-consent.date
-#> 1 NA 2018-08-07T11:10:09.652Z
-#> 2 TRUE 2020-09-17T11:52:23.960Z
-#> metadata.zebra.eu-citizen-consent.eu-citizen-data
-#> 1 FALSE
-#> 2 FALSE
-#> metadata.zebra.hide-home-walkthrough?
-#> 1 TRUE
-#> 2 TRUE
-#> metadata.zebra.hide-data-view-walkthrough?
-#> 1 TRUE
-#> 2 TRUE
-#> metadata.zebra.hide-share-modal-walkthrough?
-#> 1 TRUE
-#> 2 TRUE
-#> metadata.zebra.hide-project-view-walkthrough? metadata.is_email_verified
-#> 1 TRUE FALSE
-#> 2 TRUE TRUE
-#> metadata.avatar-url
-#> 1 <NA>
-#> 2 https://images.ona.io/image/a9af299945734cfb9d5869bc7c3eaca8/Guevarra Photo 2.jpg
-#> first_name last_name user role
-#> 1 Valid validtrial readonly
-#> 2 Ernest Guevarra ernestguevarra owner
-#>
-#> $forms
-#> name formid id_string num_of_submissions downloadable
-#> 1 Appearance Widgets 652741 appearance_widgets 0 TRUE
-#> encrypted published_by_formbuilder last_submission_time
-#> 1 FALSE NA NA
-#> date_created url
-#> 1 2022-02-26T17:19:18.835107-05:00 https://api.ona.io/api/v1/forms/652741
-#> last_updated_at is_merged_dataset
-#> 1 2022-02-26T17:19:19.123932-05:00 FALSE
-#>
-#> $public
-#> [1] FALSE
-#>
-#> $tags
-#> list()
-#>
-#> $num_datasets
-#> [1] 1
-#>
-#> $last_submission_date
-#> NULL
-#>
-#> $teams
-#> list()
-#>
-#> $data_views
-#> list()
-#>
-#> $name
-#> [1] "ernestguevarra's Project"
-#>
-#> $date_created
-#> [1] "2022-02-26T17:19:17.929848-05:00"
-#>
-#> $date_modified
-#> [1] "2022-02-26T17:19:19.120641-05:00"
-#>
-#> $deleted_at
-#> NULL
+ ona_project_info(project_id = 12345)
+#> $detail
+#> [1] "Not found."
#>
diff --git a/docs/reference/ona_project_list.html b/docs/reference/ona_project_list.html
new file mode 100644
index 0000000..3507833
--- /dev/null
+++ b/docs/reference/ona_project_list.html
@@ -0,0 +1,102 @@
+
+List projects — ona_project_list • okapi
+
+
+
+
+
+
+
+
+
+
+
+
+ List projects
+
+
+
+ ona_project_list(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password")
+)
+
+
+
+ Arguments
+ - base_url
+ONA URL. Default is https://api.ona.io.
+- auth_mode
+Password or token? Default is token.
+
+
+ Value
+ A tibble of projects.
+
+
+
+ Examples
+ ona_project_list()
+#> # A tibble: 0 × 1
+#> # … with 1 variable: x <list>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/reference/ona_project_register.html b/docs/reference/ona_project_register.html
new file mode 100644
index 0000000..bf7599e
--- /dev/null
+++ b/docs/reference/ona_project_register.html
@@ -0,0 +1,118 @@
+
+Register a project — ona_project_register • okapi
+
+
+
+
+
+
+
+
+
+
+
+
+ Register a project
+
+
+
+ ona_project_register(
+ base_url = "https://api.ona.io",
+ auth_mode = c("token", "password"),
+ owner = Sys.getenv("ONA_USERNAME"),
+ name = NULL,
+ public = TRUE
+)
+
+
+
+ Arguments
+ - base_url
+ONA URL. Default is https://api.ona.io.
+- auth_mode
+Password or token? Default is token.
+- owner
+Username or organisation name creating the project. Default to
+username of currently authenticated account
+(via `Sys.getenv(ONA_USERNAME)`). If organisation name, should be
+an organisation to which currently authenticated account is the owner or
+admin user.
+- name
+Name of the project. If NULL (default), project is given a
+default name similar to that created by ONA for forms published without
+a project
+- public
+Logical. Should the project be public? Default to TRUE.
+
+
+ Value
+ Invisible. Project registered and created in ONA account
+
+
+
+ Examples
+ ona_project_register()
+#> $owner
+#> [1] "You do not have permission to create a project in the organization validtrial."
+#>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/reference/ona_project_share.html b/docs/reference/ona_project_share.html
new file mode 100644
index 0000000..a6a7073
--- /dev/null
+++ b/docs/reference/ona_project_share.html
@@ -0,0 +1,124 @@
+
+Share projects with user(s) — ona_project_share • okapi
+
+
+
+
+
+
+
+
+
+
+
+
+ Share projects with user(s)
+
+
+
+
+
+
+
+ Arguments
+ - base_url
+ONA URL. Default is https://api.ona.io.
+- auth_mode
+Password or token? Default is token.
+- project_id
+Project identifier.
+- username
+A character value or vector of username/s of user/s to share
+a form with.
+- role
+A character value for the role the user/s will have on the
+project. This can be *readonly*, *dataentry*, *editor*, or *manager*.
+- email
+Email message to send to user/s to whom project has been
+shared with. If NULL (default), user/s will not be notified.
+
+
+ Value
+ Invisible. Project shared with specified users with specified
+ roles. A tibble of project information.
+
+
+
+ Examples
+ ona_project_share(
+ project_id = 12345,
+ username = "validtrial",
+ role = "readonly"
+ )
+#> # A tibble: 1 × 2
+#> forms users
+#> <list> <list>
+#> 1 <NULL> <NULL>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
index 2fa51fd..74f19cc 100644
--- a/docs/sitemap.xml
+++ b/docs/sitemap.xml
@@ -48,9 +48,24 @@
https://rapidsurveys.io/okapi/reference/ona_configure.html
+
+ https://rapidsurveys.io/okapi/reference/ona_data_get.html
+
+
+ https://rapidsurveys.io/okapi/reference/ona_data_list.html
+
https://rapidsurveys.io/okapi/reference/ona_delete_form.html
+
+ https://rapidsurveys.io/okapi/reference/ona_form_delete.html
+
+
+ https://rapidsurveys.io/okapi/reference/ona_form_list.html
+
+
+ https://rapidsurveys.io/okapi/reference/ona_form_publish.html
+
https://rapidsurveys.io/okapi/reference/ona_get_data.html
@@ -63,9 +78,21 @@
https://rapidsurveys.io/okapi/reference/ona_list_projects.html
+
+ https://rapidsurveys.io/okapi/reference/ona_project_delete.html
+
https://rapidsurveys.io/okapi/reference/ona_project_info.html
+
+ https://rapidsurveys.io/okapi/reference/ona_project_list.html
+
+
+ https://rapidsurveys.io/okapi/reference/ona_project_register.html
+
+
+ https://rapidsurveys.io/okapi/reference/ona_project_share.html
+
https://rapidsurveys.io/okapi/reference/ona_publish_form.html
diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml
index 6235513..45f2b5d 100644
--- a/pkgdown/_pkgdown.yml
+++ b/pkgdown/_pkgdown.yml
@@ -26,9 +26,22 @@ reference:
contents:
- okapi
- - title: ONA API
+ - title: ONA API - Setup
contents:
- - starts_with("ona")
+ - starts_with("ona_auth")
+ - ona_configure
+
+ - title: ONA API - Data
+ contents:
+ - starts_with("ona_data")
+
+ - title: ONA API - Forms
+ contents:
+ - starts_with("ona_form")
+
+ - title: ONA API - Projects
+ contents:
+ - starts_with("ona_project")
- title: KoBo Toolbox API
contents: