How do like a message on NFT

Like a message on NFT using an application

Did you try to like a message on NFTs using the application? You can check out this guide to like a message using our no-code application.

Like a message on NFTs using API's

The process of liking a message with NFT.Kred using the API takes on the same approach as liking it using our no-code application. We have an API /nft/reply which we can use to like a message on NFTs using API.

curl --request POST \
     --url 'https://api.nft.kred/nft/like?token=YourTokenValue&nft=99999&message=MessageId&text=Your Message' \
     --header 'Accept: application/json' \
     --header 'Authorization: Basic am9obndvb2R5OTg1MkBnbWFpbC5jb206QWRtaW5AMTI=='

Unlike a message on NFTs using API's

The process of unlike a message using API is the same as like a message. Anyone can unlike a message by calling nft/unlike API.

curl --request POST \
     --url 'https://api.nft.kred/nft/unlike?token=YourTokenValue&nft=99999&message=MessageId&text=Your Message' \
     --header 'Accept: application/json' \
     --header 'Authorization: Basic am9obndvb2R5OTg1MkBnbWFpbC5jb206QWRtaW5AMTI=='

Like/unlike a message on NFTs using Python SDK

Liking a message using Python-SDK is simple. This Python SDK bridges the gap between your applications and NFT.Kred APIs. Full-scale NFT solutions can be built in hours - instead of months. You can use NFT.Kred functionality via this python package and interact with the NFT.Kred APIs directly in your app.

Installation & Usage
We have created a tutorial on how you can install the Python SDK on your machine. Read our step-by-step guide on “How to install Python SDK” for more details. After importing the python SDK, please follow the below steps to reply to a message using Python SDK.

Step 1: Import SDK Files
Create a python file and import the below necessary library files by adding the following code.

from kred import services
from kred import models

Step 2: Define like API method on your python file
Now we need to create a method that will call the "like a message on NFT" functionality on your code. Right now, we want to like a message on NFT under SocialActions so we will use a "like" method. we can check which method we should use by following the available examples related to the SocialActions, please have a look at the Example References documentation section, where all the available examples are given. You can copy those methods in your file and build your app.

def like(token, nft=None, uuid=None, symbol=None, sequence=None, message=None, text=None):
    """Like an NFT or message
    """

    # service class
    service = services.SocialClient(token)
    model = models.SocialActionModels()

    # parameters
    model.nft = nft # The NFT ID
    model.uuid = uuid # The NFT UUID
    model.symbol = symbol # The batch symbol
    model.sequence = sequence #The batch sequence
    model.message = message # The message ID
    model.text = text # Optional text message

    # Service API calling
    response = service.like(model)

The process of unlike a message using python SDK is the same as like a message. Now we need to create a method that will call the "unlike a message on NFT" functionality on your code.

def unlike(token, nft=None, uuid=None, symbol=None, sequence=None, message=None, text=None):
    """Unlike an NFT or message
    """

    # service class
    service = services.SocialClient(token)
    model = models.SocialActionModels()

    # parameters
    model.nft = nft # The NFT ID
    model.uuid = uuid # The NFT UUID
    model.symbol = symbol # The batch symbol
    model.sequence = sequence #The batch sequence
    model.message = message # The message ID
    model.text = text # Optional text message

    # Service API calling
    response = service.unlike(model)

Step 3: Call your Defined method to like a message on NFTs
From the above step, we have created a python file and defined a "like" method to like a message on NFT. Now we will call that method and pass the required parameter. We may have a look at the required parameter list by following this like API endpoint.

# Define your token here
token = "token value"

# Call define method with values
like(token, nft, uuid, symbol, sequence, message, text)

We can also call the unlike method and pass the required parameter to unlike a message by following this unlike API endpoint.

# Define your token here
token = "token value"

# Call define method with values
unlike(token, nft, uuid, symbol, sequence, message, text)

That's it, now, you can like/unlike a user on NFTs with ease using API and Python SDK.