php - Mention API - Mark a mention as READ -
using api here: https://dev.mention.com/resources/alert_mentions/#put-accounts-id-alerts-alert-id-mentions-mention-id
from understand, if want mark specific "mention" read, this:
$browser = new \buzz\browser(new \buzz\client\curl); $params = ['read' => true]; //tried $url = "https://api.mention.net/api/accounts/" . $this->getaccountid() . "/alerts/{$alert_id}/mentions/{$mention_id}"; if(!empty($params)) { $url .= '?' . http_build_query($params); //i think isnt needed because pass $params below $browser->put worth try. } $response = $browser->put($url, array( "authorization: bearer {$this->getaccesstoken()}", "accept: application/json", ), $params); if (200 != $response->getstatuscode()) { return false; }
however, when run code, doesn't produce errors , infact returns valid response, "read" flag still set false.
also tried:
$params = ['read' => 'true']; //tried $params = ['read' => 1]; //tried
the mention api accepts json in request bodies: https://dev.mention.com/#request-format
you can mark mention read this:
$params = ['read' => true]; // params json encoded $params = json_encode($params); $response = $browser->put($url, array( "authorization: bearer $token", "accept: application/json", // content-type header set application/json "content-type: application/json", ), $params);
Comments
Post a Comment