---
id: video/qNHUj3ZEang
type: video
title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
summary: "Business Central REST client module additions: cookie support (set on requests, read from responses) and collectible errors with a REST client exception enum. Described as coming in the module version released with Business Central version 26."
tier: official
language: en
tags:
  - rest client
  - cookies
  - exception handling
  - collectible errors
  - error behavior
  - rest client module
  - http requests
  - al development
system: integration
review:
  state: reviewed
  by: opus
  at: "2026-10-07T23:01:58.052Z"
  flags: []
generated:
  at: "2026-10-07T23:01:58.090Z"
  pipeline: 0.2.0
  prompts:
    extract-video: 1
    summarize-video: 2
  input_hash: ff39d5253bceadf5c11aa057844bb5508164fa32481bb2a453f703daaa14bc1d
evidence:
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s
    title: "Cookie Support in REST Client: announced"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 6
    quote: in the next version of the rest client module that will be released with version 26 of business Central the rest client module now
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 6
    quote: in the next version of the rest client module that will be released with version 26 of business Central the rest client module now
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=64s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 64
    quote: if you want to set some extra properties on the cookie like uh domain uh or Secrets then you have to create a cookie
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=165s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 165
    quote: get cookies so this uh is not justk returning a list of cookie names but gives you a full dictionary which I think uh
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=273s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 273
    quote: get collected errors so based on um this line of code you see here um where you enable um error collection
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=313s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 313
    quote: there will always be one error because uh it stops at the first failure is not going to try anything further because that doesn't
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=374s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 374
    quote: you can test the enum um what is it was it blocked by environment uh was it the connection field request field which means
  - kind: video
    url: https://www.youtube.com/watch?v=qNHUj3ZEang&t=394s
    title: "What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client"
    date: "2025-02-27T14:30:32.000Z"
    commit: null
    t: 394
    quote: by um implementing this pattern you are actually getting close to what is known in CP code as the tri catch pattern
links:
  learn: []
  objects:
    - object/codeunit/2362
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
video_id: qNHUj3ZEang
channel: yt-microsoft
source_name: Microsoft Dynamics 365 Business Central (YouTube)
url: https://www.youtube.com/watch?v=qNHUj3ZEang
published_at: "2025-02-27T14:30:32.000Z"
duration_s: 451
captions: full
audience:
  - developer
chapters:
  - t: 0
    title: Cookie Support in REST Client Module
  - t: 185
    title: Exception Handling Overview and Previous Behavior
  - t: 253
    title: Collectible Errors and Error Collection Pattern
  - t: 333
    title: REST Client Exception Enum and Try-Catch Pattern
features:
  - name: Cookie Support in REST Client
    status: announced
    t: 6
    verified: true
    status_source: video
  - name: Get Cookie Names Function
    status: unclear
    t: 84
    verified: false
    status_source: video
  - name: Get Cookies Dictionary Function
    status: unclear
    t: 165
    verified: false
    status_source: video
  - name: Collectible Errors in REST Client
    status: unclear
    t: 273
    verified: false
    status_source: video
  - name: REST Client Exception Enum
    status: unclear
    t: 353
    verified: false
    status_source: video
  - name: REST Client Exception Builder
    status: unclear
    t: 353
    verified: false
    status_source: video
objects_mentioned:
  - codeunit REST Client Exception Builder
quotes:
  - t: 6
    text: in the next version of the rest client module that will be released with version 26 of business Central the rest client module now
    check: exact
  - t: 64
    text: if you want to set some extra properties on the cookie like uh domain uh or Secrets then you have to create a cookie
    check: exact
  - t: 165
    text: get cookies so this uh is not justk returning a list of cookie names but gives you a full dictionary which I think uh
    check: exact
  - t: 273
    text: get collected errors so based on um this line of code you see here um where you enable um error collection
    check: fuzzy
  - t: 313
    text: there will always be one error because uh it stops at the first failure is not going to try anything further because that doesn't
    check: exact
  - t: 374
    text: you can test the enum um what is it was it blocked by environment uh was it the connection field request field which means
    check: exact
  - t: 394
    text: by um implementing this pattern you are actually getting close to what is known in CP code as the tri catch pattern
    check: exact
---

# What's Cooking in Business Central: Cookies and Collectible Errors in the REST Client

> Business Central REST client module additions: cookie support (set on requests, read from responses) and collectible errors with a REST client exception enum. Described as coming in the module version released with Business Central version 26.

[Watch on YouTube](https://www.youtube.com/watch?v=qNHUj3ZEang) · Microsoft Dynamics 365 Business Central (YouTube) · 2025-02-27 · 7:31 · tier official · reviewed (checked by Opus)

## Overview

The video covers two additions to the REST client module in Business Central, which the presenter says will be released with version 26. The first is cookie support: setting cookies on requests, reading them from responses, and working with cookie objects.

The second is collectible errors. With error collection enabled, the REST client throws collectible errors for problems such as connection failures, invalid JSON and HTTP errors. The code can then read the collected error and test an exception enum, which gets close to a try-catch pattern.

## Key points

- The cookie support and error handling shown are in the next version of the REST client module, released with Business Central version 26.
- Set cookie on the request message takes either a cookie object or a cookie name and value. To set extra properties such as domain or secret, create a cookie object first. An existing cookie is replaced.
- The get cookie names function returns a list of cookie names in the response, so you can check whether a cookie was returned.
- If you get a cookie without checking the names first, you get an empty cookie when it does not exist. A try-get variant returns a Boolean that says whether the cookie exists.
- The get cookies function returns a full dictionary with cookie names as keys, which is more convenient than a list of names.
- Adding the error behavior line (error collection) to your function makes the REST client throw collectible errors instead of normal errors. Only one error is collected, because the client stops at the first failure.
- The REST client exception enum covers blocked by environment, connection failed, request failed (HTTP errors), invalid JSON, invalid XML and unknown errors.

## Chapters

- [0:00](https://www.youtube.com/watch?v=qNHUj3ZEang&t=0s) Cookie Support in REST Client Module
- [3:05](https://www.youtube.com/watch?v=qNHUj3ZEang&t=185s) Exception Handling Overview and Previous Behavior
- [4:13](https://www.youtube.com/watch?v=qNHUj3ZEang&t=253s) Collectible Errors and Error Collection Pattern
- [5:33](https://www.youtube.com/watch?v=qNHUj3ZEang&t=333s) REST Client Exception Enum and Try-Catch Pattern

## Features

| Feature | Status | At | Evidence |
|---|---|---|---|
| Cookie Support in REST Client | announced, demoed | [0:06](https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s) | "in the next version of the rest client module that will be released with version 26 of business Central the rest client module now" ([0:06](https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s)) |
| Get Cookie Names Function | status not stated, demoed | [1:24](https://www.youtube.com/watch?v=qNHUj3ZEang&t=84s) |  |
| Get Cookies Dictionary Function | status not stated, demoed | [2:45](https://www.youtube.com/watch?v=qNHUj3ZEang&t=165s) |  |
| Collectible Errors in REST Client | status not stated, demoed | [4:33](https://www.youtube.com/watch?v=qNHUj3ZEang&t=273s) |  |
| REST Client Exception Enum | status not stated, demoed | [5:53](https://www.youtube.com/watch?v=qNHUj3ZEang&t=353s) |  |
| REST Client Exception Builder | status not stated, demoed | [5:53](https://www.youtube.com/watch?v=qNHUj3ZEang&t=353s) |  |

## AL objects mentioned

As heard in the captions. A name that matches one object page by exact type and name links to it; the others stay as named.

- [codeunit 2362 "Rest Client Exception Builder"](../objects/codeunit/2362.md) at [5:53](https://www.youtube.com/watch?v=qNHUj3ZEang&t=353s)

## Quotes

- [0:06](https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s) "in the next version of the rest client module that will be released with version 26 of business Central the rest client module now"
- [1:04](https://www.youtube.com/watch?v=qNHUj3ZEang&t=64s) "if you want to set some extra properties on the cookie like uh domain uh or Secrets then you have to create a cookie"
- [2:45](https://www.youtube.com/watch?v=qNHUj3ZEang&t=165s) "get cookies so this uh is not justk returning a list of cookie names but gives you a full dictionary which I think uh"
- [4:33](https://www.youtube.com/watch?v=qNHUj3ZEang&t=273s) "get collected errors so based on um this line of code you see here um where you enable um error collection"
- [5:13](https://www.youtube.com/watch?v=qNHUj3ZEang&t=313s) "there will always be one error because uh it stops at the first failure is not going to try anything further because that doesn't"
- [6:14](https://www.youtube.com/watch?v=qNHUj3ZEang&t=374s) "you can test the enum um what is it was it blocked by environment uh was it the connection field request field which means"
- [6:34](https://www.youtube.com/watch?v=qNHUj3ZEang&t=394s) "by um implementing this pattern you are actually getting close to what is known in CP code as the tri catch pattern"

## Disclaimers in the video

- [0:06](https://www.youtube.com/watch?v=qNHUj3ZEang&t=6s) coming-later: will be released with version 26 of business Central
