In this vignette, we demonstrate how to interact with the Nettskjema API to perform the following tasks: 1. Retrieve a list of all forms you have access to. 1. Download reports associated with a form.
Before you begin, ensure that you have already set up authentication. If you haven’t, refer to the vignette on authentication setup.
Additionally, load the required package:
To see which forms you have access to, use the
ns_get_forms function.
# Retrieve all forms
forms <- ns_get_forms()
head(forms)
#>   formId         title
#> 1 123823 API test form
#>              openFrom
#> 1 2023-06-01T20:55:49
#>                openTo
#> 1 2024-06-02T02:00:02
#>    lastSubmissionDate
#> 1 2023-06-01T20:59:50
#>          modifiedDate
#> 1 2025-05-14T19:47:03
#>   personalDataErasedDate
#> 1                     NA
#>   deliveryDestination anonymous
#> 1            DATABASE     FALSE
#>   numberOfDeliveredSubmissions
#> 1                            3
#>   owners isDictaphone
#> 1      3        FALSE
#>   myFormsFormListingGroup  open
#> 1                     OLD FALSEEach form can have reports such as CSV, Excel, or SPSS files
associated with it. Use the ns_get_form_reports function to
download these reports.
For custom output locations, make sure to provide the full file path
in the path argument.