Setup

To use the Tags API, install the @wix/blog package using npm or Yarn:

Copy
1
npm install @wix/blog

or

Copy
1
yarn add @wix/blog

Then import { tags } from @wix/blog:

Copy
1
import { tags } from '@wix/blog'
Was this helpful?
Yes
No

getTag( )

Gets a tag by the specified ID.

The getTag() function returns a Promise that resolves to a tag whose ID matches the specified ID.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Blog
Manage Blog
Read Draft Blog Posts
Learn more about permission scopes.
Copy
function getTag(tagId: string, options: GetTagOptions): Promise<BlogTag>
Method Parameters
tagIdstringRequired

Tag ID.


optionsGetTagOptions

Options specifying which additional fields to return.

Returns
Return Type:Promise<BlogTag>
Was this helpful?
Yes
No

getTagByLabel( )

Gets a tag by the specified label.

The getTagByLabel() function returns a Promise that resolves to a tag whose label matches the specified label.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Blog
Manage Blog
Read Draft Blog Posts
Learn more about permission scopes.
Copy
function getTagByLabel(label: string, options: GetTagByLabelOptions): Promise<GetTagByLabelResponse>
Method Parameters
labelstringRequired

Tag label.


optionsGetTagByLabelOptions

Options specifying which additional fields to return.

Returns
Return Type:Promise<GetTagByLabelResponse>
Was this helpful?
Yes
No

getTagBySlug( )

Gets a tag by the specified slug.

The getTagBySlug() function returns a Promise that resolves to a tag whose slug matches the specified slug.

The slug is the end of a tag's URL that refers to a specific tag. For example, if a tag's URL is https://example.com/blog/tag/{my-tag-slug}, the slug is my-tag-slug. The slug is case-sensitive and derived from the tag's label.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Blog
Manage Blog
Read Draft Blog Posts
Learn more about permission scopes.
Copy
function getTagBySlug(slug: string, options: GetTagBySlugOptions): Promise<GetTagBySlugResponse>
Method Parameters
slugstringRequired

Slug of the tag to retrieve.


optionsGetTagBySlugOptions

Options specifying which additional fields to return.

Returns
Return Type:Promise<GetTagBySlugResponse>
Was this helpful?
Yes
No

queryTags( )

Creates a query to retrieve a list of tags.

The queryTags() function builds a query to retrieve a list of up to 4,000 tags per language, and returns a TagsQueryBuilder object.

The returned object contains the query definition, which is typically used to run the query using the find() function.

You can refine the query by chaining TagsQueryBuilder functions onto the query. TagsQueryBuilder functions enable you to sort, filter, and control the results that queryTags() returns.

queryTags() runs with these TagsQueryBuilder defaults that can be overridden:

The following TagQueryBuilder functions are supported for queryTags(). For a full description of the Tags object, see the object returned for the items property in TagsQueryResult.

PROPERTYSUPPORTED FILTERS & SORTING
_ideq(),ne(),hasSome()
labeleq(),ne(),startsWith(),hasSome(),exists(),in(),ascending(),descending()
slugeq(),ne(),startsWith(),hasSome(),exists(),in(),ascending(),descending()
publicationCounteq(),ne(),lt(),le(),gt(),ge(),in(),ascending(),descending()
postCounteq(),ne(),lt(),le(),gt(),ge(),in(),ascending(),descending()
translationIdeq(),ne(),exists(),in()
languageeq(),ne(),exists(),in(),ascending(),descending()

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Blog
Manage Blog
Read Draft Blog Posts
Learn more about permission scopes.
Copy
function queryTags(options: QueryTagsOptions): TagsQueryBuilder
Method Parameters
optionsQueryTagsOptions

Options specifying which fields to return.

Returns
Return Type:TagsQueryBuilder
Was this helpful?
Yes
No