Field Support for Filtering and Sorting

Endpoints that allow for querying follow the API Query Language.

Note that the $hasSome operator works the same as the operator "IN" in SQL.

Post API: Supported Filters and Sorting

The following table shows field support for filters and sorting for the post object:

FieldSupported FiltersSortable
id$eq, $ne, $hasSomeSortable
categoryId$eq, $ne
title$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
ownerId$eq, $ne
contentText$eq, $ne, $contains, $hasSome, $startsWith, $endsWith, $hasSome
bestAnswerCommentId$eq, $ne
pinned$eq, $neSortable
commentingEnabled$eq, $ne
commentCount$eq, $ne, $lt, $lte, $gt, $gteSortable
likeCount$eq, $ne, $lt, $lte, $gt, $gteSortable
viewCount$eq, $ne, $lt, $lte, $gt, $gteSortable
createdDate$eq, $ne, $lt, $lte, $gt, $gteSortable
updatedDate$eq, $ne, $lt, $lte, $gt, $gte
lastActivityDate$eq, $ne, $lt, $lte, $gt, $gteSortable
slug$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSomeSortable

Examples

Query pinned posts

Copy

Get all posts, sorted by created date (latest first)

Copy

Get posts by IDs

Copy

Related content: API Query Language, Query Posts

Category API: Supported Filters and Sorting

The following table shows field support for filters and sorting for the category object:

FieldSupported FiltersSortable
id$in, $eq, $ne, $lt, $lte, $gt, $gte
parentId$in, $eq, $ne, $lt, $lte, $gt, $gte
name$in, $eq, $ne
rank$in, $eq, $ne, $lt, $lte, $gt, $gteSortable
headerTitle$in, $eq, $ne
headerType$in, $eq, $ne
headerDescription$in, $eq, $ne
postCount$in, $eq, $ne, $lt, $lte, $gt, $gteSortable
postViewCount$in, $eq, $ne, $lt, $lte, $gt, $gteSortable
slug$in, $eq, $ne

Examples

Query categories by description

Copy

Get all categories, sorted by rank

Copy

Get categories by IDs

Copy

Related content: API Query Language, Query Categories

Draft Post API: Supported Filters and Sorting

The following table shows field support for filters and sorting for the draft post object:

FieldSupported FiltersSortable
id$eq, $ne, $hasSomeSortable
categoryId$eq, $ne
title$eq, $ne, $contains, $hasSome, $urlized, $startsWith, $endsWith, $hasSome
ownerId$eq, $ne
contentText$eq, $ne, $contains, $hasSome, $startsWith, $endsWith, $hasSome
commentingType$eq, $ne
createdDate$eq, $ne, $lt, $lte, $gt, $gteSortable

Examples

Query draft post by content text

Copy

Get all draft posts, sorted by createdDate

Copy

Get draft posts by IDs

Copy

Related content: API Query Language

Did this help?