publishContent
The publishContent function publishes an existing content entry. After this call the entry becomes visible (the default behavior of getContent and getContentList). It is the JavaScript/TypeScript counterpart of the POST /content/:id/publish REST endpoint.
Example:
// Using the previously created clientawait client.publishContent('660f5b8a3a1c2d4e7f8b9012');Interface
export interface ApiClient { publishContent: (contentId: string) => Promise<boolean>; // ... other methods}Parameters
| Name | Description |
|---|---|
contentId | The ID of the content entry to publish. You can find it in your project’s Content tab, either in the list or in the content details. |
Output
The function returns a Promise<boolean> that resolves to true on success.
const ok = await client.publishContent('660f5b8a3a1c2d4e7f8b9012');// ok → trueUntil you call publishContent, a freshly created or edited entry is only reachable in preview mode — that is, by prefixing the read token with PREVIEW_ (see Preview token).