Twitch api how to user follow and unfollow

Hello to everyone,
I want to create a platform using Twitch api.
I want to use many features such as logging in, watching live broadcasts, joining a conversation but I’m having trouble follow and unfollow tracking not ( Sorry for typos :slight_smile: )
codes I use:
$th = curl_init();

    curl_setopt(
        $th, 
        CURLOPT_HTTPHEADER,
        array(
            'Accept: application/vnd.twitchtv.v5+json',
            'Client-ID:'$client,
            'Authorization: OAuth '. $tokenns,
            'Host: api.twitch.tv',
            'User-Agent: curl/7.43.0'
        )
    );
    curl_setopt($th, CURLOPT_URL, 'https://api.twitch.tv/kraken/users/'.$yid.'/blocks/'.$myid);
    curl_setopt($th, CURLOPT_RETURNTRANSFER, 1);
    $t = curl_exec($th);
    // $stast = json_decode($t,true);
    curl_close($th);
    echo $t;

this is the result of:
{

error: “Not Found”,

status: 404,

message: “Follow not found”

}
Do you have any idea what you can do?

You have posted code relating to “blocks”

Follows is documented here:

UnFollow here:

I was trying the blocking code
the code I use to track this way:
curl_setopt($th, CURLOPT_URL, ‘https://api.twitch.tv/kraken/users/’.$myid.’/follows/channels/’.$yid);

can you help me please

This means there is no follow to unfollow.

I’ve linked the docs, not sure what else you need there?

I want the users to follow each other and I get an error.
for example:
I want a user b to follow
did you understand me?

Whats the error?


such a result is returning but does not follow

edit:
in the meantime, if they follow each other this result comes out
if a user does not follow b before the transaction, doesn’t it have to follow?

if not followed before;
{

error: “Not Found”,

status: 404,

message: “Follow not found”

}

I forgot to tag, sorry.

when i use this code is not follow just checking

  1. There is no need to bump the topic JUST to tag me
  2. There is no need to bump the topic at all

If you are performing an attempt to follow and getting

{

error: “Not Found”,

status: 404,

message: “Follow not found”

}

Then you are not doing it right. That’s not a correct response for performing a “create follow”.

Sounds like you are not PUTting, just GETting

As documented

Please provide your full code and the responses you are getting

problem solved thank you :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.