---
title: "evaluate exercise srvr"
method: POST
path: "/learnr/{session_id}"
tags: ["srvr"]
---

# evaluate exercise srvr

`POST /learnr/{session_id}`

Evaluate an exercise in a given session

## Path parameters

- `session_id` string, required

## Request body

- SrvrEvaluateExerciseRequestBody
  - `check` string — TODO
  - `chunks` string — List of setup knitr code chunks for the exercise when using the `exercise.setup` option.
  - `code` string, required — The R code to execute
  - `code_check` string — TODO
  - `engine` string — The knitr engine of the exercise.
  - `global_setup` string — Setup code from the `setup-global-exercise` or `setup` chunk that should be run before every exercise
  - `label` string — Label of the exercise.
  - `options` string, required — The exercise options
  - `restore` boolean — TODO
  - `setup` string — Setup code associated with this specific exercise
  - `solution` string — Unused, the solution code for this exercise
  - `version` string — Version of the exercise structure.

## Response `200`

The server was able to fulfill the request. This does _not_ imply that the provided R code didn't produce an error -- just that we were able to run it through to completion.

- SrvrEvaluateExerciseResponseBody
  - `error_message` string, required — If an error occurred, the plain-text representation
  - `feedback` ExerciseFeedbackResponseBody, required
    - `correct` boolean — TRUE/FALSE logical value indicating whether the submitted answer was correct.
    - `location` string — Location for feedback (“append”, “prepend”, or “replace”).
    - `message` string — Feedback message. Can be a plain character vector or can HTML produced via the htmltools package.
    - `type` string — Feedback type (visual presentation style). Can be “auto”, “success”, “info”, “warning”, “error”, or “custom”. Note that “custom” implies that the “message” field is custom HTML rather than a character vector.
  - `html_output` string, required — The output of the given command
  - `timeout_exceeded` boolean, required — True if the time limit was exceeded; otherwise false

## Other responses

- `400` — Bad Request response.
- `503` — Service Unavailable response.

---

[API](https://skmtc.net/rstudio/apis/external-evaluator-service.md) · [All operations](https://skmtc.net/rstudio/apis/external-evaluator-service/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/rstudio/external-evaluator-service/versions/4bd2591763f4/schema)
