Php 提及API-将提及标记为已读

Php 提及API-将提及标记为已读,php,api,mention,mentionapp,Php,Api,Mention,Mentionapp,在此处使用API: 据我所知,如果我想在阅读时标记一个特定的“提及”,我会这样做: $browser = new \Buzz\Browser(new \Buzz\Client\Curl); $params = ['read' => true]; //tried this $url = "https://api.mention.net/api/accounts/" . $this->getAccountId() . "/alerts/{$alert_id}/mentions/{$m

在此处使用API:

据我所知,如果我想在阅读时标记一个特定的“提及”,我会这样做:

$browser = new \Buzz\Browser(new \Buzz\Client\Curl);

$params = ['read' => true]; //tried this

$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 this isnt needed because i pass $params below to the $browser->put but it was worth a try.
}

$response = $browser->put($url, array(
            "Authorization: Bearer {$this->getAccessToken()}",
            "Accept: application/json",
        ), $params);

if (200 != $response->getStatusCode()) {
    return false;
}
$params = ['read' => true];

// params are json encoded
$params = json_encode($params);

$response = $browser->put($url, array(
    "Authorization: Bearer $token",
    "Accept: application/json",
    // the Content-Type header is set to application/json
    "Content-Type: application/json",
), $params);
但是,当我运行代码时,它不会产生任何错误,并且infact返回一个有效的响应,但是“read”标志仍然设置为false

还尝试:

$params = ['read' => 'true']; //tried this
$params = ['read' => 1]; //tried this

提及API在请求体中接受JSON:

您可以将提及标记为如下所示:

$browser = new \Buzz\Browser(new \Buzz\Client\Curl);

$params = ['read' => true]; //tried this

$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 this isnt needed because i pass $params below to the $browser->put but it was worth a try.
}

$response = $browser->put($url, array(
            "Authorization: Bearer {$this->getAccessToken()}",
            "Accept: application/json",
        ), $params);

if (200 != $response->getStatusCode()) {
    return false;
}
$params = ['read' => true];

// params are json encoded
$params = json_encode($params);

$response = $browser->put($url, array(
    "Authorization: Bearer $token",
    "Accept: application/json",
    // the Content-Type header is set to application/json
    "Content-Type: application/json",
), $params);