# Update a content entry

_NgCms / Content Entries_

`PUT /ng-cms/content/{projectId}/{typeKey}/{entryId}`

## Parameters

- `projectId` (string, required) — The unique identifier of the project (bucket)
- `typeKey` (string, required) — The key or ID of the content type
- `entryId` (string, required) — The ID of the content entry to update

## Request Body

### `UpdateContentEntryRequest`

- `id` (string, required) — ID of the entry being updated
- `fields` (object, required) — Key-value map of field data. Keys must match the field keys defined in the content type schema.

## Responses

### `200` — Entry updated successfully.

Type: `ApiResponse<boolean>`

- `success` (boolean) — Indicates whether the request was successful
- `result` (boolean) — Always true on success
- `errors` (ErrorDetail[]) — List of errors (empty on success)

### `400` — Validation failed — fields do not satisfy the content type schema constraints.

Type: `ApiResponse<T>`

- `isValid` (boolean) — Always false for validation errors
- `validationErrors` (ValidationError[]) — List of validation failures
  - `name` (string) — Field that failed validation
  - `attemptedValue` (object) — The value that was submitted
  - `message` (string) — Human-readable validation message

### `401` — Unauthorized. A valid bearer token is required.


### `404` — Not Found. No content entry or content type exists with the given ID or key.


### `412` — Precondition Failed. The project's current plan does not allow access to this resource, or payment is required to proceed.


### `500` — Unexpected server error.

Type: `ApiResponse<T>`

- `success` (boolean) — Always false
- `errors` (ErrorDetail[]) — List of server-side errors
  - `correlationId` (string) — Unique ID for tracing the error
  - `message` (string) — Error message
  - `stack` (string) — Stack trace (non-production only)


## Code Examples

### curl

```curl
curl --request PUT \
  --url https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/{entryId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "id": "<entryId>",
  "fields": {
    "title": "Updated Post Title",
    "body": "<p>Updated content</p>",
    "publishedAt": "2025-06-15T10:00:00Z"
  }
}'
```

### javascript

```js
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    id: '<entryId>',
    fields: {
      title: 'Updated Post Title',
      body: '<p>Updated content</p>',
      publishedAt: '2025-06-15T10:00:00Z'
    }
  })
};

fetch('https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/{entryId}', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

### dotnet

```dotnet
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "<token>");

var request = new UpdateContentEntryRequest
{
    Id = "<entryId>",
    Fields = new Dictionary<string, object>
    {
        ["title"]       = "Updated Post Title",
        ["body"]        = "<p>Updated content</p>",
        ["publishedAt"] = "2025-06-15T10:00:00Z"
    }
};

var response = await client.PutAsJsonAsync("https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/{entryId}", request);
var result = await response.Content.ReadFromJsonAsync<ApiResponse<bool>>();
```

### python

```python
import requests

url = "https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/{entryId}"
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}
payload = {
    "id": "<entryId>",
    "fields": {
        "title": "Updated Post Title",
        "body": "<p>Updated content</p>",
        "publishedAt": "2025-06-15T10:00:00Z"
    }
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

### Request Body Example

```json
{
  "projectId": "example-string",
  "typeKey": "example-string",
  "entryId": "example-string"
}
```

### Response Example (200)

```json
{
  "success": true,
  "result": true,
  "errors": []
}
```

## Repositories

- [konso-cms-nodejs](https://gitverse.ru/konso/konso-cms-nodejs)
- [konso-cms-dotnet](https://gitverse.ru/konso/konso-cms-dotnet)

## Packages

- `dotnet add package Konso.Clients.Cms` — [Konso.Clients.Cms](https://nugetprodusnc-northcentralus-01.regional.azure-api.net/packages/Konso.Clients.Cms)
- `npm install @konso/cms-client` — [@konso/cms-client](https://www.npmjs.com/package/@konso/cms-client)
