POST /feed/:channel/posts/:id/reactions -> error 404

Dear community,
I have problem with API call POST /feed/:channel/posts/:id/reactions in javascript.

In my web app, I am successfully logged on and then I call this API, but it response (error: “Not Found”, status: 404, message: null). Really don’t know where is the problem. Has someone similarly problem or know where I have problem?

my js code:

Twitch.api({method: 'feed/twitch/posts/128261463173519/reactions', params: {emote_id:"25", verb:'POST'} }, function(error, response) 
{
    console.debug(response);  				
});

response:

Twitch] Response Data: Object {error: "Not Found", status: 404, message: null}

packet header in webdev (networking): - xyz == my token

Request URL:https://api.twitch.tv/kraken/feed/twitch/posts/128261463173519/reactions?emote_id=25&verb=POST&oauth_token=xyz&callback=jQuery21403838928368669783_1463420311488&_=1463420311491

Can someone please help?

Thank you

Two things to check:

  • Does your OAuth token have the channel_feed_edit scope?

  • Are you sure you’re sending a POST? Your verb attribute needs to be a part of the top-level object and not the params object.

     Twitch.api({method: 'feed/twitch/posts/128261463173519/reactions', verb: 'POST', params: {emote_id:"25"} }

I have all scopes (‘user_read’, ‘channel_read’, ‘channel_feed_edit’, ‘channel_feed_read’). I was trying ‘verb’ on top-level and now again, but response is still same :confused:

Are you using the JavaScript SDK? It is pretty outdated, so it likely has bugs. It also doesn’t seem to support POST. Have you tried with a tool like POSTMan or just plain JavaScript or jQuery? That’ll help narrow down the issue.

The JS SDK supports POST via the verb option. An alternative would be params: { _method: 'POST' } in the options, which is what the verb should do (but doesn’t in old versions of the SDK).

What it does is it sets the _method=POST query parameter (e.g. .../kraken/channels/3ventic?_method=POST), which works at least on the blocks API

1 Like

Thanks man, you saved my day. It works!! Thank you so much, but there is maybe bug in api, or bad documentation, because this same call with verb:‘POST’ doesnt work for me. This call is so simple so I dont know where else can be fail, but nevermind, your solution works. Thanks :smile:

Interesting that it returns 404 for GET instead of 405 though.

1 Like

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