---
title: "Handling Submissions with the Nettskjema API"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Handling Submissions with the Nettskjema API}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r}
#| label: setup
#| include: false

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = TRUE,
  error = FALSE,
  fig.path = "static"
)

vcr::setup_knitr(prefix = "sub-")
nettskjemar:::mock_if_no_auth()

```

# Overview

This vignette demonstrates how to handle form submissions and answers using the Nettskjema API.
Specifically, you will learn how to:
1. Get an individual submission answer.
1. Download an individual submission as a PDF.

# Getting an Individual Submission Answer: `ns_get_submission`

The `ns_get_submission` function fetches a single submission's answers based on a **submission ID**.

## Example: Fetch an Individual Submission

To retrieve an individual submission, use the **submission ID** (a unique identifier for each submission).

```{r}
#| label: single
#| cassette: true

library(nettskjemar)

# Replace with your submission ID
submission_id <- 27685292

# Get the submission data
submission <- ns_get_submission(submission_id)

# Display the submission data
submission
```

This function returns a list containing all answers for the specified submission.

