API:ClearHasMsg/ko
Appearance
| 이 문서는 MediaWiki Action API 문서의 부분입니다. |
GET request to clear hasmsg flag for the current user.
| 미디어위키 버전: | ≥ 1.24 |
API documentation
Example
POST request
Clear the
hasmsg flag for the current user.Response
{
"clearhasmsg": "success"
}
Sample code
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
"""
import requests
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
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
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
*/
var params = {
action: "clearhasmsg",
format: "json"
},
api = new mw.Api();
api.post( params ).done( function ( data ) {
console.log( data );
} );
Possible errors
| Code | Info |
|---|---|
| mustbeposted | clearhasmsg 모듈은 POST 요청이 필요합니다. |
Additional notes
- The
clearhasmsgaction will remove the HasMsg flag, which causes theYou have new messagesbanner 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 messageswill not appear until you receive any more messages from other users. - 이 모듈은 1.29.0-wmf.5 이후로 POST 처리되어야 합니다.[1]
References
- ↑ BREAKING CHANGE: action=clearhasmsg will require POST on the mediawiki-api-announce Mailing list