# ContentResource

Canonical page: https://docs.ovok.com/java-sdk/reference/content-resource

```java
public final class ContentResource
```

Manages localized content entries in the project's CMS. Get it from [`Ovok.content()`](/java-sdk/reference/ovok#content).

## Methods [#methods]

### search [#search]

```java
public JsonNode search(String type, String language) throws IOException, InterruptedException
```

Lists entries of one type in one language (`GET /cms/{type}/{language}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode search(
        String type,
        String language,
        Map<String, ?> parameters) throws IOException, InterruptedException
```

Searches entries of one type in one language (`GET /cms/{type}/{language}?...`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `parameters`: query parameters

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode search(
        String type,
        String language,
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException
```

Searches entries of one type in one language (`GET /cms/{type}/{language}?...`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `parameters`: query parameters
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### retrieve [#retrieve]

```java
public JsonNode retrieve(
        String type,
        String language,
        String key) throws IOException, InterruptedException
```

Reads one entry (`GET /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key

**Returns:** the entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode retrieve(
        String type,
        String language,
        String key,
        RequestOptions options) throws IOException, InterruptedException
```

Reads one entry (`GET /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key
- `options`: per-request options, such as the timeout

**Returns:** the entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### create [#create]

```java
public JsonNode create(
        String type,
        String language,
        Object body) throws IOException, InterruptedException
```

Creates an entry (`POST /cms/{type}/{language}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `body`: the entry, serialized as JSON

**Returns:** the created entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode create(
        String type,
        String language,
        Object body,
        RequestOptions options) throws IOException, InterruptedException
```

Creates an entry (`POST /cms/{type}/{language}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `body`: the entry, serialized as JSON
- `options`: per-request options, such as the timeout

**Returns:** the created entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### update [#update]

```java
public JsonNode update(
        String type,
        String language,
        String key,
        Object body) throws IOException, InterruptedException
```

Replaces an entry (`PUT /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key
- `body`: the entry, serialized as JSON

**Returns:** the updated entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode update(
        String type,
        String language,
        String key,
        Object body,
        RequestOptions options) throws IOException, InterruptedException
```

Replaces an entry (`PUT /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key
- `body`: the entry, serialized as JSON
- `options`: per-request options, such as the timeout

**Returns:** the updated entry

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### delete [#delete]

```java
public void delete(
        String type,
        String language,
        String key) throws IOException, InterruptedException
```

Deletes an entry (`DELETE /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public void delete(
        String type,
        String language,
        String key,
        RequestOptions options) throws IOException, InterruptedException
```

Deletes an entry (`DELETE /cms/{type}/{language}/{key}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key
- `options`: per-request options, such as the timeout

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### map [#map]

```java
public JsonNode map(
        String type,
        String language,
        Map<String, ?> parameters) throws IOException, InterruptedException
```

Reads the entries of one type as a key-to-entry map (`GET /cms/{type}/map/{language}?...`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `parameters`: query parameters

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode map(String type, String language) throws IOException, InterruptedException
```

Reads the entries of one type as a key-to-entry map (`GET /cms/{type}/map/{language}`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode map(
        String type,
        String language,
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException
```

Reads the entries of one type as a key-to-entry map (`GET /cms/{type}/map/{language}?...`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `parameters`: query parameters
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### copyFromParent [#copyfromparent]

```java
public JsonNode copyFromParent(
        String type,
        String language,
        String key) throws IOException, InterruptedException
```

Copies one entry from the parent project (`POST /cms/{type}/{language}/{key}/copy-from-parent-project`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode copyFromParent(
        String type,
        String language,
        String key,
        RequestOptions options) throws IOException, InterruptedException
```

Copies one entry from the parent project (`POST /cms/{type}/{language}/{key}/copy-from-parent-project`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `key`: the entry key
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### copyAllFromParent [#copyallfromparent]

```java
public JsonNode copyAllFromParent(
        String type,
        String language) throws IOException, InterruptedException
```

Copies every entry of one type and language from the parent project (`POST /cms/{type}/{language}/copy-from-parent-project`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

```java
public JsonNode copyAllFromParent(
        String type,
        String language,
        RequestOptions options) throws IOException, InterruptedException
```

Copies every entry of one type and language from the parent project (`POST /cms/{type}/{language}/copy-from-parent-project`).

**Parameters:**

- `type`: the content type, such as `articles`
- `language`: the language code, such as `en`
- `options`: per-request options, such as the timeout

**Returns:** the response body

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
