updateContentFieldValue
The updateContentFieldValue function updates a single field of an existing content entry. It is the JavaScript/TypeScript counterpart of the PUT /content/:id REST endpoint.
There are two ways to identify the target field: by field name + language (recommended) or by field value id (deprecated).
Example:
// Recommended: identify the field by name + languageawait client.updateContentFieldValue(contentId, { fieldName: 'title', language: 'en' }, 'Hello world (updated)');Interface
export type FieldSelector = { fieldName: string; language: string };
export interface ApiClient { // Recommended overload updateContentFieldValue(contentId: string, selector: FieldSelector, value: unknown): Promise<boolean>;
// Deprecated overload — pass a FieldSelector instead updateContentFieldValue(contentId: string, fieldValueId: string, value: unknown): Promise<boolean>;
// ... other methods}Parameters
| Name | Description |
|---|---|
contentId | The ID of the content entry to update. You can find it in your project’s Content tab, either in the list or in the content details. |
selector | Either a FieldSelector object ({ fieldName, language }, recommended) or a string with the field value id (deprecated). |
value | The new value for the field. The expected type depends on the field’s type in the model. |
Update by fieldName + language (recommended)
await client.updateContentFieldValue( '660f5b8a3a1c2d4e7f8b9012', { fieldName: 'title', language: 'en' }, 'Hello world (updated)');| Property | Description |
|---|---|
fieldName | The name of the field as defined in the model (e.g. 'title'). |
language | The language of the value being updated. Must be one of the languages enabled on the project. |
Update by field value id (deprecated)
// Deprecatedawait client.updateContentFieldValue('660f5b8a3a1c2d4e7f8b9012', 'fieldValueId-1234', 'Hello world (updated)');Output
The function returns a Promise<boolean> indicating whether the update succeeded.
const ok = await client.updateContentFieldValue( contentId, { fieldName: 'title', language: 'en' }, 'Hello world (updated)');// ok → trueUpdating a field value automatically advances the content’s status (for example from published to pending changes), so the change needs to be published before read-token consumers can see it.