> 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 # CreateLike # Package: blog # Namespace: LikeService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/blog/likes/create-like.md ## Permission Scopes: Manage Blog: SCOPE.DC-BLOG.MANAGE-BLOG ## Introduction Creates a like for blog content. >**Note:** >This method requires [visitor or member authentication](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md). --- ## REST API ### Schema ``` Method: createLike Description: Creates a like for blog content. >**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 Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: like.fqdn, like.entityId Method parameters: param name: like | type: Like | description: A like represents a positive reaction to blog content. Likes are associated with specific blog content using their FQDN and entity GUID, allowing likes to be created for various types of blog content such as posts or comments. - name: id | type: string | description: Like GUID. - name: entityId | type: string | description: GUID of the specific blog content being liked, such as a blog post or comment. | required: true - 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. | required: true Return type: CreateLikeResponse - name: like | type: Like | description: Created like. - 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. Possible Errors: HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: | Description: There is already a like for this entity by the current user. ``` ### Examples ### Create a like on a blog post ```curl curl -X POST \ 'https://www.wixapis.com/blog/v1/likes' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "like": { "fqdn": "wix.blog.v3.post", "entityId": "12345678-1234-1234-1234-123456789012" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.blog.LikeService.createLike(options) Description: Creates a like for blog content. >**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: options.like.fqdn, options.like.entityId Method parameters: param name: options | type: CreateLikeOptions none - name: like | type: Like | description: Like to create. - name: _id | type: string | description: Like GUID. - name: entityId | type: string | description: GUID of the specific blog content being liked, such as a blog post or comment. | required: true - 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. | required: true Return type: PROMISE - 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. Possible Errors: HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: | Description: There is already a like for this entity by the current user. ``` ### Examples ### createLike ```javascript import { likes } from '@wix/blog'; async function createLike(options) { const response = await likes.createLike(options); }; ``` ### createLike (with elevated permissions) ```javascript import { likes } from '@wix/blog'; import { auth } from '@wix/essentials'; async function myCreateLikeMethod(options) { const elevatedCreateLike = auth.elevate(likes.createLike); const response = await elevatedCreateLike(options); } ``` ### createLike (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 createLike(options) { const response = await myWixClient.likes.createLike(options); }; ``` ---