---
title: "Caching"
slug: "caching"
abstract: "How to cache responses to save bandwidth."
---
# Caching

The client can cache responses as needed. For requests with media content (such as an image), an `ETag` header is present.

On the next request for the same resource, the client can send the value of this header in an `If-None-Match header`. This lets the server decide that the response to the request is exactly the same as the former request, and the server will respond with `304 Not Modified`. This can save the client a lot of bandwidth, as this way the client is instructed to reuse the cached response.

## Example request:

```html
GET http://<hostname>/api
Host: hostname
Accept: application/json

```

## Example response:

```json
HTTP/1.1 200 OK
Content-Length: content length
Content-Type: application/json; charset=utf-8
ETag: "hash string"

{
  "entitydefinitions":{
    "href":"http://<hostname>/api/entitydefinitions",
    "title":"The collection of entity definitions."
  },
  "entities":{
    "href":"http://<hostname>/api/entities",
    "title":"The collection of entities."
  },
  "entitydefinition_by_name":{
    "href":"http://<hostname>/api/entitydefinitions/{name}",
    "title":"Get the entity definition with the spe...",
    "is_template":true
  },
  "entity_by_id":{
    "href":"http://<hostname>/api/entities/{id}",
    "title":"Get the entity with the specified id.",
    "is_template":true
  }
}

```

## Example follow-up request:

```html
GET http://<hostname>/api
Host: hostname
Accept: application/json
If-None-Match: "KEWz1VCrPJHbdBYEKfq4C3316wXW3VkwII61gtt8PO4="

```

## Example follow-up response:

```json
HTTP/1.1 304 Not Modified
Content-Length: content length
Content-Type: application/json; charset=utf-8
ETag: "KEWz1VCrPJHbdBYEKfq4C3316wXW3VkwII61gtt8PO4="

```