> For the complete documentation index, see [llms.txt](https://doc.ozforensics.com/oz-knowledge-ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ozforensics.com/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/rabota-s-konteinerom-dannykh-ozcapsula.md).

# Работа с контейнером данных OzCapsula

### Конфигурация Oz API <a href="#configuring-oz-api" id="configuring-oz-api"></a>

Основное изменение в работе с API — это новый content type для передачи данных. Контейнер представляет собой бинарный файл, поэтому установите `Content-Type` = `application/octet-stream`. Поддержка этого типа добавлена вместе с функциональностью контейнера.

#### Примеры <a href="#examples" id="examples"></a>

`POST api/folders`:

```bash
curl -X POST \
  '{{host}}/api/folders' \
  -H 'Content-Type: application/octet-stream' \
  -H 'X-Forensic-Access-Token: <YOUR_TOKEN>' \
  --data-binary '@/path/to/container.dat'
```

`POST api/instant/folders`:

```bash
curl -X POST \
  '{{host}}api/instant/folders' \
  -H 'Content-Type: application/octet-stream' \
  -H 'X-Forensic-Access-Token: <YOUR_TOKEN>' \
  --data-binary '@/path/to/container.dat'
```

Для Instant API также потребуются публичный и приватный ключи. Пути к этим ключам должны быть указаны в переменных `OZ_JWT_PRIVATE_KEY_PATH` и `OZ_JWT_PUBLIC_KEY_PATH` в файле конфигурации.

Генерация ключей:

```bash
# Generate private key:
openssl ecparam -name secp384r1 -genkey -noout | openssl pkcs8 -topk8 -nocrypt -out ./jwt.key
# Generate public key:
openssl ec -in ./jwt.key -pubout -out ./jwt.pub
```

### Возможные ошибки

| **Код ошибки** | **Сообщение**        | **Описание**                                          |
| -------------- | -------------------- | ----------------------------------------------------- |
| 3              | Invalid request data | Отсутствует payload.json                              |
| 4              | Invalid request data | В контейнере нет медиафайлов                          |
| 5              | Invalid request data | Контейнер поврежден                                   |
| 13             | Invalid request data | API не получил контейнер                              |
| 14             | Invalid request data | В контейнере обнаружены ошибки, распаковка невозможна |

## Получение Session Token

До начала работы с SDK получите session token:

1. (Опционально, только для stateful API) авторизуйтесь с любой ролью, кроме OPERATOR.
2. Вызовите метод `GET {{host}}/api/authorize/session_token`.

**Пример запроса**

```bash
curl -L 'https://{{host}}/api/authorize/session_token' \
-H 'X-Forensic-Access-Token: <token>' \
-H 'Content-Type: application/json'
```

**Пример ответа**

```bash
{
    "session_token": "<session_token>"
}
```

<figure><img src="/files/8ygTGuYTMy4aCrB8ysc2" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.ozforensics.com/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/rabota-s-konteinerom-dannykh-ozcapsula.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
