Title: | Easily Import Data from Your 'ODK-X Sync Endpoint' |
---|---|
Description: | Provides helper functions for authenticating and retrieving data from your 'ODK-X Sync Endpoint'. This is an early release intended for testing and feedback. |
Authors: | Emil Rossing [aut, cre] |
Maintainer: | Emil Rossing <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-20 15:25:33 UTC |
Source: | CRAN |
This function downloads attachments for the specified table rows and saves them in a structured directory. Each row with attachments will have a dedicated folder under the table-specific subdirectory.
download_attachments( rows, table_meta, save_to_directory, skip_if_instance_folder_exists = FALSE )
download_attachments( rows, table_meta, save_to_directory, skip_if_instance_folder_exists = FALSE )
rows |
A tibble or data frame containing the table rows to download attachments for. |
table_meta |
List. Metadata for the table, as returned by |
save_to_directory |
String. The parent directory where attachments will be saved. A subdirectory with the name of the table will be created, and each row with attachments will have its own subfolder under this directory. |
skip_if_instance_folder_exists |
Logical. If |
Invisibly returns NULL
. Downloads the attachments as a side effect.
This function retrieves all rows for a given table from the ODK-X Sync Endpoint and tries to parse known types based on the table's schema definition.
get_all_rows(table_name)
get_all_rows(table_name)
table_name |
String. The name of the table from which to retrieve rows. |
A tibble containing all rows.
This function fetches the stored API credentials from environment variables.
get_credentials()
get_credentials()
A list containing username, password, and server_url.
Retrieves metadata for a given table from the ODK-X Sync Endpoint.
get_table_metadata(table_name)
get_table_metadata(table_name)
table_name |
A character string specifying the table name. |
This function calls the ODK-X Sync Endpoint to fetch metadata
about a specific table. If the dataUri
field is missing in the response,
an error is thrown.
A list containing table metadata.
This function retrieves the list of tables from the ODK-X Sync Endpoint by making a paginated GET request to
(<server_url>)/odktables/default/tables
. It uses BASIC authentication with the credentials stored via
rockx::set_username_and_password()
.
get_tables()
get_tables()
A tibble containing the list of found tables.
Before calling this function, first set username, password, and host with:
rockx::set_username_and_password()
.
has_access()
has_access()
TRUE or FALSE
This function sets the environment variables ROCKX_USERNAME
, ROCKX_PASSWORD
, and ROCKX_SERVER_URL
for authentication and specifying the ODK-X Sync Endpoint.
set_username_and_password(username, password, server_url)
set_username_and_password(username, password, server_url)
username |
A character string containing the API username. |
password |
A character string containing the API password. |
server_url |
A character string containing the URL of the ODK-X sync endpoint (e.g., "https://my.sync-endpoint.com"). |
A message confirming that credentials and server URL have been set.
rockx::set_username_and_password("my_user", "my_password", "https://my.sync-endpoint.com")
rockx::set_username_and_password("my_user", "my_password", "https://my.sync-endpoint.com")