Skip to content

getPosts

getPosts

The getPosts method is used to get posts on ZeFer. It returns a list of posts that match the search query and other options provided.

import { zefer } from "zefer-lib";
const getPosts = zefer.getPosts(process.env.ZEFER_API_KEY as string, { // get all posts
limit: 10,
search: "search query",
}).then((posts) => {
console.log(posts);
});
// or
(async () => {
const posts = await zefer.getPosts(process.env.ZEFER_API_KEY as string, { // get all posts
limit: 10,
search: "search query",
});
console.log(posts);
})();

Parameters

NameTypeDescription
tokenenvYour API Key
optionsPostsOptions (optional)The options for retrieving posts

PostsOptions (optional)

NameTypeDescription
qstringThe search query
cursorstringThe cursor for pagination, must be the post’s ID
limitnumberThe maximum number of posts to retrieve
orderBy”latest” or “most-popular”The field to order the posts by
seriesIdstringThe ID of the series of the posts