API:投稿記録のフィード

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Feedcontributions and the translation is 100% complete.
Other languages:
Deutsch • ‎English • ‎Türkçe • ‎dansk • ‎español • ‎français • ‎polski • ‎ไทย • ‎中文 • ‎日本語
MediaWiki バージョン: 1.18

利用者の投稿記録のフィードを返す GET リクエストです。

APIの説明文書


action=feedcontributions

(main | feedcontributions)

Returns a user's contributions feed.

Parameters:
feedformat

The format of the feed.

One of the following values: atom, rss
Default: rss
user

What users to get the contributions for.

This parameter is required.
Type: user, by any of user name, IP, IP range, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
namespace

Which namespace to filter the contributions by.

One of the following values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501
year

From year (and earlier).

Type: integer
month

From month (and earlier).

Type: integer
tagfilter

Filter contributions that have these tags.

Values (separate with | or alternative): Added PHP closing tag, Blocked user editing own talk page, Emoji, LTA:NDBTK, New user editing project page, OAuth CID: 21, OAuth CID: 31, OAuth CID: 429, OAuth CID: 1188, OAuth CID: 1261, OAuth CID: 1352, OAuth CID: 1805, OTRS permission added by non-OTRS member, Potentially problematic translation, Rapid reverts, T144167, abusefilter-condition-limit, advanced mobile edit, android app edit, blanking, centralnotice, centralnotice translation, deletion template removed, discussiontools, discussiontools-edit, discussiontools-newtopic, discussiontools-reply, discussiontools-source, discussiontools-visual, emoji, ios app edit, massmessage-delivery, meta spam id, mobile app edit, mobile edit, mobile web edit, mw-blank, mw-changed-redirect-target, mw-contentmodelchange, mw-manual-revert, mw-new-redirect, mw-removed-redirect, mw-replace, mw-rollback, mw-undo, possible out of scope, possible vandalism, repeated xwiki CoI abuse, repeating characters, visualeditor, visualeditor-needcheck, visualeditor-switched, visualeditor-wikitext, wikilove
Maximum number of values is 50 (500 for clients allowed higher limits).
Default: (empty)
deletedonly

Show only deleted contributions.

Type: boolean (details)
toponly

Only show edits that are the latest revisions.

Type: boolean (details)
newonly

Only show edits that are page creations.

Type: boolean (details)
hideminor

Hide minor edits.

Type: boolean (details)
showsizediff

Disabled due to miser mode.

Type: boolean (details)
Example:
Return contributions for user Example.
api.php?action=feedcontributions&user=Example [open in sandbox]

GET リクエスト

利用者の投稿を RSS フィードとして表示します。

レスポンス

<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Wikipedia - User contributions [en]</title>
    <link>
      https://en.wikipedia.org/wiki/Special:Contributions/Jimbo_Wales
    </link>
    <description>User contributions</description>
    <language>en</language>
    <generator>MediaWiki 1.27.0-wmf.5</generator>
    <lastBuildDate>Wed, 11 Nov 2015 20:56:27 GMT</lastBuildDate>
    <item>
      <title>User talk:Jimbo Wales</title>
      <link>
        https://en.wikipedia.org/w/index.php?title=User_talk:Jimbo_Wales&diff=###
      </link>
      <guid isPermaLink="false">
        https://en.wikipedia.org/w/index.php?title=User_talk:Jimbo_Wales&diff=###
      </guid>
      <description>
        ...
      </description>
      <comments>
        https://en.wikipedia.org/wiki/User_talk:Jimbo_Wales
      </comments>
    </item>
  </channel>
</rss>

サンプル コード

Python

#!/usr/bin/python3

"""
    get_user_contributions_feed.py

    MediaWiki API Demos
    Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.

    MIT License
"""

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

PARAMS = {
    "action": "feedcontributions",
    "user": "Jimbo Wales",
    "format": "json"
}

R = S.get(url=URL, params=PARAMS)
DATA = R.content

print(DATA)

PHP

<?php
/*
    get_user_contributions_feed.php

    MediaWiki API Demos
    Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.

    MIT License
*/

$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "feedcontributions",
    "user" => "Jimbo Wales",
    "format" => "json"
];

$url = $endPoint . "?" . http_build_query( $params );

$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );

var_dump( $output );

JavaScript

/*
    get_user_contributions_feed.js

    MediaWiki API Demos
    Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.

    MIT License
*/

var url = "https://en.wikipedia.org/w/api.php"; 

var params = {
    action: "feedcontributions",
    user: "Jimbo Wales",
    format: "json"
};

url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

fetch(url)
    .then(function(response){return response.json();})
    .then(function(response) {console.log(response);})
    .catch(function(error){console.log(error);});

MediaWiki JS

/*
	get_user_contributions_feed.js

	MediaWiki API Demos
	Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.

	MIT License
*/

var params = {
		action: 'feedcontributions',
		user: 'Jimbo Wales',
		format: 'json'
	},
	api = new mw.Api();

api.get( params ).done( function ( data ) {
	console.log( data );
} );

起こりうるエラー

標準のエラー メッセージに加えて:

コード 情報
feed-unavailable フィードの配信は利用できません
feed-invalid フィード形式の指定が正しくありません。
sizediffdisabled Size difference is disabled in Miser Mode.

パラメーターの履歴

  • v1.28: hideminor を導入しました
  • v1.23: newonly を導入しました

追加的な注記

  • 要求が成功した場合、出力が feedformat パラメーターで要求された形式になることに注意してください。 標準のformatパラメーター(JSON)で要求された形式は、エラーが発生した場合にのみ使用されます。

関連項目