Jump to content
MediaWiki

API:ClearHasMsg

From mediawiki.org
This page is a translated version of the page API:ClearHasMsg and the translation is 61% complete.
このページは MediaWiki 操作 API の説明文書の一部です。
MediaWiki 操作 API
基本
認証
利用者とアカウント
ページのオペレーション
検索
開発者向けユーティリティ
チュートリアル
· ·

GET request to clear hasmsg flag for the current user.

MediaWiki バージョン:
≧ 1.24

APIの説明文書

以下の説明文書は、このサイト (MediaWiki.org) で稼働しているリリース前のバージョンのMediaWikiによって自動的に生成された、Special:ApiHelp/clearhasmsg の出力です。

action=clearhasmsg

(main | clearhasmsg)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: MediaWiki
  • License: GPL-2.0-or-later

Clears the hasmsg flag for the current user.

Example:
Clear the hasmsg flag for the current user.
api.php?action=clearhasmsg [open in sandbox]

POST リクエスト

Clear the hasmsg flag for the current user.

レスポンス

{
"clearhasmsg":"success"
}

サンプル コード

Python

#!/usr/bin/python3
"""
 clear_has_msg.py
 MediaWiki API Demos
 Demo of `ClearHasMsg` module: Clear the hasmsg flag for the current user.
 MIT License
"""
importrequests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
 "action": "clearhasmsg",
 "format": "json"
}
R = S.post(url=URL, data=PARAMS)
DATA = R.json()
print(DATA)

PHP

<?php
/*
 clear_has_msg.php
 MediaWiki API Demos
 Demo of `ClearHasMsg` module: Clear the hasmsg flag for the current user.
 MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
 "action" => "clearhasmsg",
 "format" => "json"
];
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $endPoint );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $params ) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_COOKIEJAR, "cookie.txt" );
curl_setopt( $ch, CURLOPT_COOKIEFILE, "cookie.txt" );
$response = curl_exec($ch);
curl_close($ch);
echo ($response);

JavaScript

/*
	clear_has_msg.js
 MediaWiki API Demos
 Demo of `ClearHasMsg` module: Clear the hasmsg flag for the current user.
 MIT License
*/
varurl="https://en.wikipedia.org/w/api.php";
varparams={
action:"clearhasmsg",
format:"json"
};
request.post({url:url,form:params},function(error,res,body){
if(error){
return;
}
console.log(body);
});

MediaWiki JS

/*
	clear_has_msg.js
 MediaWiki API Demos
 Demo of `ClearHasMsg` module: Clear the hasmsg flag for the current user.
 MIT License
*/
varparams={
action:"clearhasmsg",
format:"json"
},
api=newmw.Api();
api.post(params).done(function(data){
console.log(data);
});

起こりうるエラー

コード 情報
mustbeposted The clearhasmsg module requires a POST request.

追加的な注記

  • The clearhasmsg action will remove the HasMsg flag, which causes the You have new messages banner to appear and returns true in HasMsg query. It can be used by applications that retrieve the talk page using the API, which unlike opening your talk page in a browser, doesn't automatically remove this flag.
  • When you trigger this action, the banner You have new messages will not appear until you receive any more messages from other users.
  • This module must be POSTed since 1.29.0-wmf.5.[1]

脚注

AltStyle によって変換されたページ (->オリジナル) /