I am trying to like/unlike a post via API but it returns 404, “errors”:[“The requested URL or resource could not be found.”] and sometimes it executes successfully. What could be the possible reason for this?
I am making a HTTP call from Node.js with following data:
let form = {
post_action_type_id: 2
};
and with following options :
{ hostname: 'comments.charmboard.com',
path: '/post_actions/85815',
method: 'DELETE',
timeout: 3000,
headers:
{ 'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': 21,
Accept: 'application/json',
'Api-Key': '12345678909876543212345678987654323456789',
'Api-Username': '113225072183895994023' } }
Did you tried the same by using Postman?
I think I got the issue. Somehow only unlike Post is being called from my code and that’s why its returning 404. Thanks for the reply @fzngagan.
Yes. Are you sending the request always using DELETE
method?
Its only for unliking. For liking, you need to send the request with POST
method.
2 Likes