> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryLikes # Package: blog # Namespace: LikeService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/blog/likes/query-likes.md ## Permission Scopes: Read Blog : SCOPE.DC-BLOG.READ-BLOGS ## Introduction Retrieves a list of likes created by the currently authenticated site visitor or member, given the provided paging, filtering, and sorting. This method: - Only returns likes [created](https://dev.wix.com/docs/api-reference/business-solutions/blog/likes/create-like.md) by the current authenticated user through the API. - Doesn't include likes created through the blog UI. - Doesn't include likes created by other users. Up to 100 likes can be returned per request. Query Likes runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0` >**Note:** >This method requires [visitor or member authentication](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md). --- ## REST API ### Schema ``` Method: queryLikes Description: Retrieves a list of likes created by the currently authenticated site visitor or member, given the provided paging, filtering, and sorting. This method: - Only returns likes [created](https://dev.wix.com/docs/api-reference/business-solutions/blog/likes/create-like.md) by the current authenticated user through the API. - Doesn't include likes created through the blog UI. - Doesn't include likes created by other users. Up to 100 likes can be returned per request. Query Likes runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0` >**Note:** >This method requires [visitor or member authentication](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md). URL: https://www.wixapis.com/blog/v1/likes/query Method: POST Method parameters: param name: query | type: CursorQuery - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryLikesResponse - name: likes | type: array | description: Retrieved likes. - name: id | type: string | description: Like GUID. - name: createdDate | type: string | description: Date and time the like was created. - name: entityId | type: string | description: GUID of the specific blog content being liked, such as a blog post or comment. - name: fqdn | type: string | description: Fully qualified domain name that identifies the type of blog content being liked. For example, `wix.blog.v3.post` for blog posts. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### Query likes for a blog post ```curl curl -X POST \ 'https://www.wixapis.com/blog/v1/likes/query' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "query": { "filter": { "fqdn": "wix.blog.v3.post", "entityId": "12345678-1234-1234-1234-123456789012" }, "paging": { "limit": 50 } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.blog.LikeService.queryLikes(query) Description: Retrieves a list of likes created by the currently authenticated site visitor or member, given the provided paging, filtering, and sorting. This method: - Only returns likes [created](https://dev.wix.com/docs/api-reference/business-solutions/blog/likes/create-like.md) by the current authenticated user through the API. - Doesn't include likes created through the blog UI. - Doesn't include likes created by other users. Up to 100 likes can be returned per request. Query Likes runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0` >**Note:** >This method requires [visitor or member authentication](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: query | type: LikeQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: likes | type: array | description: Retrieved likes. - name: _id | type: string | description: Like GUID. - name: _createdDate | type: Date | description: Date and time the like was created. - name: entityId | type: string | description: GUID of the specific blog content being liked, such as a blog post or comment. - name: fqdn | type: string | description: Fully qualified domain name that identifies the type of blog content being liked. For example, `wix.blog.v3.post` for blog posts. - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### queryLikes ```javascript import { likes } from '@wix/blog'; async function queryLikes(query) { const response = await likes.queryLikes(query); }; ``` ### queryLikes (with elevated permissions) ```javascript import { likes } from '@wix/blog'; import { auth } from '@wix/essentials'; async function myQueryLikesMethod(query) { const elevatedQueryLikes = auth.elevate(likes.queryLikes); const response = await elevatedQueryLikes(query); } ``` ### queryLikes (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { likes } from '@wix/blog'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { likes }, // Include the auth strategy and host as relevant }); async function queryLikes(query) { const response = await myWixClient.likes.queryLikes(query); }; ``` ---