Search.../

getPost( )

Developer Preview

Retrieves a single post by ID.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function getPost(postId: string, options: GetPostOptions): Promise<PostResponse>

getPost Parameters

NAME
TYPE
DESCRIPTION
postId
string

Post ID.

options
Optional
GetPostOptions

Options specifying which additional fields to return.

Returns

Return Type:

Promise<
PostResponse
>
NAME
TYPE
DESCRIPTION
post
Post

Post for the provided post ID.

Was this helpful?

getPost example

Copy Code
1import { posts } from 'wix-forum.v2';
2
3 async function getPost(postId, options) {
4 try {
5 const result = await posts.getPost(postId, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13