API:Edit
| MediaWiki Eylem API'si |
|---|
| Temeller |
| Doğrulama |
| Hesaplar ve Kullanıcılar |
| Sayfa İşlemleri |
|
| Ara |
| Geliştirici Araçları |
| Eğitimler |
| g · t · d |
Bir sayfayı düzenlemek için POST isteği.
API belgesi
action=edit
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: MediaWiki
- License: GPL-2.0-or-later
Create and edit pages.
- title
Title of the page to edit. Cannot be used together with pageid.
- pageid
Page ID of the page to edit. Cannot be used together with title.
- Type: integer
- section
Section identifier. 0 for the top section, new for a new section. Often a positive integer, but can also be non-numeric.
- sectiontitle
The title for a new section when using section=new.
- text
Page content.
- summary
Edit summary.
When this parameter is not provided or empty, an edit summary may be generated automatically.
When using section=new and sectiontitle is not provided, the value of this parameter is used for the section title instead, and an edit summary is generated automatically.
Change tags to apply to the revision.
- Values (separate with | or alternative): AWB, convenient-discussions
- minor
Mark this edit as a minor edit.
- Type: boolean (details)
- notminor
Do not mark this edit as a minor edit even if the "Mark all edits minor by default" user preference is set.
- Type: boolean (details)
- bot
Mark this edit as a bot edit.
- Type: boolean (details)
- baserevid
ID of the base revision, used to detect edit conflicts. May be obtained through action=query&prop=revisions. Self-conflicts cause the edit to fail unless basetimestamp is set.
- Type: integer
- basetimestamp
Timestamp of the base revision, used to detect edit conflicts. May be obtained through action=query&prop=revisions&rvprop=timestamp. Self-conflicts are ignored.
- Type: timestamp (allowed formats)
- starttimestamp
Timestamp when the editing process began, used to detect edit conflicts. An appropriate value may be obtained using curtimestamp when beginning the edit process (e.g. when loading the page content to edit).
- Type: timestamp (allowed formats)
- recreate
Override any errors about the page having been deleted in the meantime.
- Type: boolean (details)
- createonly
Don't edit the page if it already exists.
- Type: boolean (details)
- nocreate
Throw an error if the page doesn't exist.
- Type: boolean (details)
- watch
- Deprecated.
Add the page to the current user's watchlist.
- Type: boolean (details)
- unwatch
- Deprecated.
Remove the page from the current user's watchlist.
- Type: boolean (details)
- watchlist
Unconditionally add or remove the page from the current user's watchlist, use preferences (ignored for bot users) or do not change watch.
- One of the following values: nochange, preferences, unwatch, watch
- Default: preferences
- watchlistexpiry
Watchlist expiry timestamp. Omit this parameter entirely to leave the current expiry unchanged.
- Type: expiry (details)
- md5
The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated. If set, the edit won't be done unless the hash is correct.
- prependtext
Add this text to the beginning of the page or section. Overrides text.
- appendtext
Add this text to the end of the page or section. Overrides text.
Use section=new to append a new section, rather than this parameter.
- undo
Undo this revision. Overrides text, prependtext and appendtext.
- Type: integer
- The value must be no less than 0.
- undoafter
Undo all revisions from undo to this one. If not set, just undo one revision.
- Type: integer
- The value must be no less than 0.
- redirect
Automatically resolve redirects.
- Type: boolean (details)
- contentformat
Content serialization format used for the input text.
- One of the following values: application/json, application/octet-stream, application/unknown, application/vue+xml, application/x-binary, text/css, text/javascript, text/plain, text/unknown, text/x-wiki, unknown/unknown
- contentmodel
Content model of the new content.
- One of the following values: GadgetDefinition, Graph.JsonConfig, Json.JsonConfig, JsonSchema, MassMessageListContent, NewsletterContent, Scribunto, SecurePoll, css, flow-board, javascript, json, sanitized-css, text, translate-messagebundle, unknown, vue, wikitext, worklist
- token
A "csrf" token retrieved from action=query&meta=tokens
The token should always be sent as the last parameter, or at least after the text parameter.
- This parameter is required.
- returnto
Page title. If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to the given page, instead of the page that was edited.
- Type: page title
- Accepts non-existent pages.
- returntoquery
URL query parameters (with leading ?). If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to a page with the given query parameters.
- Default: (empty)
- returntoanchor
URL fragment (with leading #). If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to a page with the given fragment.
- Default: (empty)
- captchaword
Answer to the CAPTCHA
- captchaid
CAPTCHA ID from previous request
- wgConfirmEditForceShowCaptcha
Whether the shown hCaptcha CAPTCHA was force shown, such as by an AbuseFilter extension consequence (and so used a more restrictive sitekey). Set this if the JS configuration variable with the same name is true or if the first attempt to use this API returned a 'forcecaptcha' error with a specified sitekey.
- Type: boolean (details)
- editorinterface
Name of the editor interface used (such as MobileFrontend-SourceEditor)
- discussiontoolsautosubscribe
Automatically subscribe the user to any new talk page threads created by the edit. Use 'yes' or 'no' to override a user's preference (the default).
- One of the following values: no, preferences, yes
- Default: preferences
- Edit a page.
- api.php?action=edit&title=Test&summary=test%20summary&text=article%20content&baserevid=1234567&token=123ABC [open in sandbox]
- Prepend __NOTOC__ to a page.
- api.php?action=edit&title=Test&summary=NOTOC&minor=&prependtext=__NOTOC__%0A&basetimestamp=2007年08月24日T12:34:54Z&token=123ABC [open in sandbox]
- Undo revisions 13579 through 13585 with autosummary.
- api.php?action=edit&title=Test&undo=13585&undoafter=13579&basetimestamp=2007年08月24日T12:34:54Z&token=123ABC [open in sandbox]
Örnek
Bu örnekteki örnek kod Python'dadır. Ajax içindeki örnekler ve yanıtlar için API:Edit/Editing with Ajax sayfasına bakın.
POST isteği
Düzenlemeler ve gerçekten de herhangi bir POST isteği yapmak çok adımlı bir süreçtir.
- 1. API:Oturum aç üzerinde açıklanan yöntemlerden birini kullanarak oturum açın. Düzenlemeyi yazarına doğru bir şekilde atfetmek için gerekli olsa da, birçok viki kullanıcının bir hesaba kaydolmadan veya bir hesaba giriş yapmadan düzenleme yapmasına izin verdiğini unutmayın.
- 2. CSRF anahtar GET'i:
- 3. Bir sayfada işlem yapmak için CSRF anahtarıyla bir POST isteği gönderin:
Aşağıdaki Yanıt bölümü, son POST isteği için sayfada işlem yapılması içindir. Önceki adımlara verilen JSON aracı yanıtları için API:Oturum aç ve API:Tokens sayfalarına bakın.
Ayrıca, bu sayfadaki sorgulardaki anahtarlarını örnek değerler olduğunu unutmayın. Gerçek anahtarlar her oturum açma oturumu ve siteler arası istek için benzersizdir. Bunlar yalnızca sorguların nasıl düzgün biçimlendirileceğini göstermek için dahil edilmiştir.
Yanıt
{ "edit":{ "result":"Success", "pageid":94542, "title":"Wikipedia:Sandbox", "contentmodel":"wikitext", "oldrevid":371705, "newrevid":371707, "newtimestamp":"2018年12月18日T16:59:42Z" } }
Örnek kod
Python
#!/usr/bin/python3 """ edit.py MediaWiki API Demos Demo of `Edit` module: POST request to edit a page MIT license """ importrequests S = requests.Session() URL = "https://test.wikipedia.org/w/api.php" # Step 1: GET request to fetch login token PARAMS_0 = { "action": "query", "meta": "tokens", "type": "login", "format": "json" } R = S.get(url=URL, params=PARAMS_0) DATA = R.json() LOGIN_TOKEN = DATA['query']['tokens']['logintoken'] # Step 2: POST request to log in. Use of main account for login is not # supported. Obtain credentials via Special:BotPasswords # (https://www.mediawiki.org/wiki/Special:BotPasswords) for lgname & lgpassword PARAMS_1 = { "action": "login", "lgname": "bot_user_name", "lgpassword": "bot_password", "lgtoken": LOGIN_TOKEN, "format": "json" } R = S.post(URL, data=PARAMS_1) # Step 3: GET request to fetch CSRF token PARAMS_2 = { "action": "query", "meta": "tokens", "format": "json" } R = S.get(url=URL, params=PARAMS_2) DATA = R.json() CSRF_TOKEN = DATA['query']['tokens']['csrftoken'] # Step 4: POST request to edit a page PARAMS_3 = { "action": "edit", "title": "Project:Sandbox", "token": CSRF_TOKEN, "format": "json", "appendtext": "Hello" } R = S.post(URL, data=PARAMS_3) DATA = R.json() print(DATA)
PHP
<?php /* edit.php MediaWiki API Demos Demo of `Edit` module: POST request to edit a page MIT license */ $endPoint = "https://test.wikipedia.org/w/api.php"; $login_Token = getLoginToken(); // Step 1 loginRequest( $login_Token ); // Step 2 $csrf_Token = getCSRFToken(); // Step 3 editRequest($csrf_Token); // Step 4 // Step 1: GET request to fetch login token function getLoginToken() { global $endPoint; $params1 = [ "action" => "query", "meta" => "tokens", "type" => "login", "format" => "json" ]; $url = $endPoint . "?" . http_build_query( $params1 ); $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_COOKIEJAR, "cookie.txt" ); curl_setopt( $ch, CURLOPT_COOKIEFILE, "cookie.txt" ); $output = curl_exec( $ch ); curl_close( $ch ); $result = json_decode( $output, true ); return $result["query"]["tokens"]["logintoken"]; } // Step 2: POST request to log in. Use of main account for login is not // supported. Obtain credentials via Special:BotPasswords // (https://www.mediawiki.org/wiki/Special:BotPasswords) for lgname & lgpassword function loginRequest( $logintoken ) { global $endPoint; $params2 = [ "action" => "login", "lgname" => "bot_user_name", "lgpassword" => "bot_password", "lgtoken" => $logintoken, "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( $params2 ) ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_COOKIEJAR, "cookie.txt" ); curl_setopt( $ch, CURLOPT_COOKIEFILE, "cookie.txt" ); $output = curl_exec( $ch ); curl_close( $ch ); } // Step 3: GET request to fetch CSRF token function getCSRFToken() { global $endPoint; $params3 = [ "action" => "query", "meta" => "tokens", "format" => "json" ]; $url = $endPoint . "?" . http_build_query( $params3 ); $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_COOKIEJAR, "cookie.txt" ); curl_setopt( $ch, CURLOPT_COOKIEFILE, "cookie.txt" ); $output = curl_exec( $ch ); curl_close( $ch ); $result = json_decode( $output, true ); return $result["query"]["tokens"]["csrftoken"]; } // Step 4: POST request to edit a page function editRequest( $csrftoken ) { global $endPoint; $params4 = [ "action" => "edit", "title" => "Project:Sandbox", "appendtext" => "Hello", "token" => $csrftoken, "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( $params4 ) ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_COOKIEJAR, "cookie.txt" ); curl_setopt( $ch, CURLOPT_COOKIEFILE, "cookie.txt" ); $output = curl_exec( $ch ); curl_close( $ch ); echo ( $output ); }
JavaScript
/* edit.js MediaWiki API Demos Demo of `Edit` module: POST request to edit a page using OAuth MIT license */ varapiEndpoint='https://test.wikipedia.org/w/api.php'; varoauthToken="OAuth2AccessToken";// Replace with actual OAuth 2 token // Helper function asyncfunctionperformFetch(queryURL,options={}){ options.headers={'Authorization':'Bearer '+oauthToken}; constresponse=awaitfetch(queryURL,options); consttext=awaitresponse.text(); try{ returnJSON.parse(text); }catch(e){ console.error(e); returntext } } // Step 1: GET request to fetch CSRF token functiongetCsrfToken(){ varparams_0={ action:'query', meta:'tokens', format:'json', formatversion:'2', crossorigin:'' }; varqueryURL=newURL(apiEndpoint); queryURL.search=newURLSearchParams(params_0); performFetch(queryURL,{method:'GET'}) .then(function(data){ varcsrf_token=data?.query?.tokens?.csrftoken; if(csrf_token){ editRequest(csrf_token) }else{ console.error("Error retrieving CSRF token!"); } }); } // Step 2: POST request to edit a page // Action API requires data be posted as application/x-www-form-urlencoded (URLSearchParams) // or multipart/form-data, rather than application/json (T212988) functioneditRequest(csrf_token){ varparams_1={ action:'edit', title:'Project:Sandbox', appendtext:'test edit', summary:'test edit', format:'json', formatversion:'2', token:csrf_token, crossorigin:'' } varqueryURL=newURL(apiEndpoint); varpostBody=newURLSearchParams(); Object.keys(params_1).forEach(key=>{ if(key=='action'||key=='origin'||key=='crossorigin'){ queryURL.searchParams.append(key,params_1[key]); }else{ postBody.append(key,params_1[key]); } }); performFetch(queryURL,{method:'POST',body:postBody}) .then(function(data){ varresult=data?.edit?.result; if(result){ console.log(result); }else{ console.error("Error posting edit!"); } }); } // Start from Step 1 getCsrfToken();
Node.js
/* edit.js MediaWiki API Demos Demo of `Edit` module: POST request to edit a page using Bot Passwords MIT license */ varrequest=require('request').defaults({jar:true}), url="https://test.wikipedia.org/w/api.php"; // Step 1: GET request to fetch login token functiongetLoginToken(){ varparams_0={ action:"query", meta:"tokens", type:"login", format:"json" }; request.get({url:url,qs:params_0},function(error,res,body){ if(error){ return; } vardata=JSON.parse(body); loginRequest(data.query.tokens.logintoken); }); } // Step 2: POST request to log in. // Use of main account for login is not // supported. Obtain credentials via Special:BotPasswords // (https://www.mediawiki.org/wiki/Special:BotPasswords) for lgname & lgpassword functionloginRequest(login_token){ varparams_1={ action:"login", lgname:"bot_username", lgpassword:"bot_password", lgtoken:login_token, format:"json" }; request.post({url:url,form:params_1},function(error,res,body){ if(error){ return; } getCsrfToken(); }); } // Step 3: GET request to fetch CSRF token functiongetCsrfToken(){ varparams_2={ action:"query", meta:"tokens", format:"json" }; request.get({url:url,qs:params_2},function(error,res,body){ if(error){ return; } vardata=JSON.parse(body); editRequest(data.query.tokens.csrftoken); }); } // Step 4: POST request to edit a page functioneditRequest(csrf_token){ varparams_3={ action:"edit", title:"Project:Sandbox", appendtext:"test edit", token:csrf_token, format:"json" }; request.post({url:url,form:params_3},function(error,res,body){ if(error){ return; } console.log(body); }); } // Start From Step 1 getLoginToken();
MediaWiki JS
/* edit.js MediaWiki API Demos Demo of `Edit` module: POST request to edit a page MIT License */ varparams={ action:'edit', title:'Project:Sandbox', appendtext:'Hello', format:'json' }, api=newmw.Api(); api.postWithToken('csrf',params).done(function(data){ console.log(data); });
bash (curl)
#!/usr/bin/env bash # target wiki settings # get this from Special:BotPassword exportMW_USER="" exportMW_PASS="" # the url for the target wiki to import pages, end with / exportMW_URL="" # bot info, to be embeded in the page comments exportBOT_INFO="mwpm" # source wiki settings # the source wiki url, for wikitext exportSRC_URL="" # file list for plain wikitext FILE="1ドル" # 0ドル <token type> # mainly csrf and login functionget-token(){ API_URL="api.php" RESULT=$(curl-fsSL-XPOST\ -daction=query\ -dmeta=tokens\ -dtype="1ドル"\ -dformat=json\ -ccookie.txt\ -bcookie.txt\ "${MW_URL}${API_URL}") #RESULT=${RESULT/*token\":\"} #TOKEN=${RESULT%\\\"*} TOKEN=$(jq-r".query.tokens[\"${1}token\"]"<<<"$RESULT") echo"$TOKEN" } # 0ドル <wiki-url> <username> <password> functionmw-login(){ API_URL="api.php" curl-fsSL-XPOST\ --data-urlencodeaction=login\ -dlgname="2ドル"\ -dlgpassword="3ドル"\ --data-urlencodelgtoken=$(get-tokenlogin)\ -dformat=json\ -ccookie.txt\ -bcookie.txt\ "${1}${API_URL}" } # 0ドル <file> <command> # every line is in the $trimmed_line variable functionbatch-process(){ whileIFS=read-rline;do trimmed_line=$(echo"$line"|sed-e's/^[[:space:]]*//'-e's/[[:space:]]*$//') if[[-z"$trimmed_line"]];then continue fi if[["$trimmed_line"=~^#]];then continue fi eval2ドル done<"1ドル" } # Check if the file exists if[[!-f"$FILE"]];then echo"Error: File '$FILE' not found." exit1 fi functionplain-import(){ page_name="1ドル" content_file="2ドル" page_content="$(cat$content_file)" echo"+++ writting page $page_name +++" API_URL="api.php?action=edit&format=json" curl-fsSL-XPOST\ -d"summary=$BOT_INFO$MW_PREF"\ -d"title=$page_name"\ --data-urlencode"text=${page_content}"\ -d"bot=true"\ --data-urlencode"token=$(get-tokencsrf)"\ -ccookie.txt\ -bcookie.txt\ "${MW_URL}${API_URL}" echo } # login to $MW_URL echo"logging into $MW_URL" mw-login"$MW_URL""$MW_USER""$MW_PASS" echo if[[$private_src=="true"]];then echo"logging into $SRC_URL" mw-login"$SRC_URL""$SRC_USER""$SRC_PASS" echo fi SITE_NAME=${SRC_URL%/} SITE_NAME=${SITE_NAME/https:\/\/} FILE_NAME=$(basename"$FILE") exportEXPORT_DIR="cache/$SITE_NAME/${FILE_NAME%.txt}" echo"Processing lines from '$FILE'" batch-process"$FILE"'plain-import "$trimmed_line" $EXPORT_DIR/"$trimmed_line".wikitext' echo"Finished processing."
Kullanım örnekleri
Düzenleme çakışması
Python örneği, kayıtlı bir kullanıcının düzenleme isteğinin temel bir uygulamasıdır. Gerçek dünya senaryolarında, düzenleme çatışmalarını önlemek için özen gösterilmelidir. Bunlar, iki veya daha fazla kullanıcı aynı sayfayı aynı anda düzenlemeye çalıştığında ortaya çıkar.
Bir CSRF jetonu istediğimizde, son revizyon zaman damgası alınarak çakışmalar önlenebilir.
3. Adım'daki CSRF anahtarı isteğine prop=info|revisions eklemek, son revizyonun zaman damgasına erişmemizi sağlar.
Düzenleme isteğimizi yaptığımızda bu zaman damgası basetimestamp olarak kullanılacak.
Ayrıca düzenlememize başladığımız zamanın tam zamanı.
Bu, CSRF isteğine curtimestamp eklenerek de elde edilebilir.
Bu değer starttimestamp olarak hizmet edecektir.
Son olarak, gerçek düzenleme isteğinde, basetimestamp ve starttimestamp parametrelerini ayarlayın, şöyle:
Büyük düzenlemeler
Çok miktarda metin içeriği (8000+ karakter) içeren POST istekleri başlığında belirtilen Content-Type: multipart/form-data ile gönderilmelidir.
multipart/form-data HTML çıkış karakterleri eklemesi gerekmediğinden (yani, yüzde kodlama) boşluklar ve noktalama işaretleri için, iletilen veri miktarı daha sonra yüzde kodlanmış eşdeğerinden çok daha küçük olacaktır.
Bununla birlikte, hala multipart/form-data eklenmiş bazı yükler vardır, kabaca parametre başına 160 bayt.
Çok sayıda kaçış karakteri eklemeyi gerektirmeyen kısa mesajlar için bu ek yük miktarı verimsiz olabilir ve yüzde kodlama tercih edilir.[1]
Python örnek kodumuzda, isteğin varsayılan olarak yüzde olarak kodlandığını unutmayın.
İçerik türü ve POST istekleri hakkında daha teknik tartışma için web belgelerine bakın
Python örnek kodumuza benzer bir sözdizimini kullanarak multipart/form-data ile nasıl geçireceğinizi öğrenmek için Python İstekleri belgelerine bakınız.
CAPTCHA'lar
Hedeflediğiniz viki CAPTCHAs kullanıyorsa, isteğiniz bir kimlik numarası ve bir resme soru, matematik sorunu veya URL gibi basit bir test içeren bir hata döndürebilir.
Düzenlemenizi tamamlamak için testi tamamlamanız ve ardından isteğinizi kimlikle ve orijinal sorgu dizesine eklenmiş doğru yanıtlarla yeniden denemeniz gerekir: captchaid=sampleId&captchaword=answer
Diğer CAPTCHA sistemleri ve uzantıları benzer kullanım için farklı parametreler kullanabilir. Genel olarak, kimlik ve test soruları için alan adlarını ikinci isteğinizdeki parametreler olarak kullanın.
Olası hatalar
| Kod | Bilgi |
|---|---|
| notitle | title parametresi ayarlanmalıdır. |
| missingparam | text, appendtext ve undo parametrelerden en az biri gerekli. |
| notoken | token parametresi ayarlanmalıdır. |
| invalidsection | section parametresi geçerli bir bölüm kimliği veya new olmalıdır. |
| protectedpage | Bu sayfa değişiklik ya da diğer eylemlerin yapılmasını engellemek için koruma altına alınmıştır. |
| cantcreate | Yeni sayfalar oluşturmaya yetkiniz yok. |
| cantcreate-anon | Anonim kullanıcılar yeni sayfa oluşturamaz |
| articleexists | Oluşturmaya çalıştığınız sayfa zaten oluşturuldu. |
| noimageredirect-anon | Anonim kullanıcılar resim yönlendirmeleri oluşturamaz. |
| noimageredirect | Görüntü yönlendirmeleri oluşturma izniniz yok. |
| spamdetected | Düzenlemeniz bir spam parçası içerdiği için reddedildi: Wikitext.
|
| abusefilter-warning | Bu eylem otomatik olarak zararlı olarak tanımlandı. |
| abusefilter-disallowed | Bu eylem otomatik olarak zararlı olarak tanımlanmıştır ve bu nedenle izin verilmemiştir. |
| contenttoobig | ⧼Apierror-contenttoobig⧽ Where bytes is the value of $wgMaxArticleSize . |
| noedit-anon | Anonim kullanıcılar sayfaları düzenleyemez. |
| noedit | Sayfa değiştirme izniniz yok. |
| pagedeleted | Sayfa, zaman damgasını getirdiğiniz için silindi. |
| emptypage | Yeni, boş bir sayfa oluşturmaya izin verilmez. |
| emptynewsection | Boş yeni bölümler oluşturmak mümkün değildir. |
| editconflict | Değişiklik çakışması. |
| revwrongpage | rrevid, pagename bir düzeltme değildir.undo veya undoafter için geçersiz revizyon kimliği verilirse atılır
|
| undofailure | Değişikliklerin çakışması nedeniyle geri alma işlemi başarısız oldu. |
| missingtitle | Belirttiğiniz sayfa mevcut değil. ( nocreate parametre yukarıya bakın)
|
| mustbeposted | edit modülü bir POST isteği gerektirir. |
| readapidenied | Bu modülü kullanmak için okuma iznine ihtiyacınız var. |
| writeapidenied | Bu vikiyi API aracılığıyla düzenlemenize izin verilmiyor. |
| noapiwrite | Bu vikinin API aracılığıyla düzenlenmesi devre dışı bırakıldı. |
| badtoken | Geçersiz CSRF anahtarı. |
| missingparam | title, pageid parametresi ayarlanmalıdır. |
| invalidparammix | Parametreleri title, pageid birlikte kullanılamaz. |
| invalidtitle | Kötü başlık "title". |
| invalid-content-data | Geçersiz içerik verisi occurs when trying to edit a JSON page with non-conforming data, or while trying to edit a MassMessageListContent page |
| nosuchpageid | pageid kimliğine sahip sayfa yok. |
| pagecannotexist | Ad alanı gerçek sayfalara izin vermez. |
| nosuchrevid | undo kimliğine sahip bir düzeltme yok. |
| nosuchrevid | undoafter kimliğine sahip bir düzeltme yok. |
| badmd5 | Sağlanan MD5 karması yanlış. |
| hookaborted | Yapmaya çalıştığınız değişiklik bir uzantı çengeliyle iptal edildi. |
| parseerror | İçerik serileştirme başarısız oldu: parseerror |
| summaryrequired | ⧼apierror-summaryrequired⧽ |
| blocked | Düzenlemeniz engellendi. |
| ratelimited | Gönderme sınırını aştınız. Lütfen bir süre sonra tekrar deneyin. |
| unknownerror | Bilinmeyen hata: "retval". |
| nosuchsection | Bölüm 1ドル yok. |
| sectionsnotsupported | Bölümler, içerik modeli 1ドル için desteklenmiyor. |
| editnotsupported | Bu tür bir sayfanın düzenlenmesi, metin tabanlı düzenleme API'si kullanılarak desteklenmez. |
| appendnotsupported | 1ドル içerik modelini kullanan sayfalara eklenemez. |
| redirect-appendonly | section=new, prependtext veya prependtext ile birlikte kullanılması gereken yönlendirme takip modunu kullanarak düzenlemeye çalıştınız. |
| edit-invalidredirect | 2ドル hedefi geçerli olmadığından, yönlendirmeleri izlerken 1ドル düzenlenemez. |
| badformat | İstenen 1ドル biçimi, 3ドル tarafından kullanılan 2ドル içerik modeli için desteklenmiyor. |
| customcssprotected | Başka bir kullanıcının kişisel ayarlarını içerdiği için bu CSS sayfasını düzenleme izniniz yok. |
| customjsprotected | Başka bir kullanıcının kişisel ayarlarını içerdiği için bu JavaScript sayfasını düzenleme izniniz yok. |
| taggingnotallowed | Değişiklik etiketlerini ayarlama izniniz yok |
| badtags | "Tag" etiketi elle uygulanamaz. Bu etiketler elle uygulanamaz: Tag1, Tag2 |
| tpt-target-page | Bu sayfa elle güncellenemez.
Bu sayfa 1ドル sayfasının bir çevirisidir ve çeviri, [2ドル çeviri aracı] kullanılarak güncellenebilir. |
Parametre geçmişi
- v1.35: Introduced
baserevid - v1.25:
tagstanıtıldı - v1.21:
contentformat,contentmodeltanıtıldı - v1.20:
pageidtanıtıldı - v1.19:
sectiontitletanıtıldı - v1.18:
captchaid,captchawordkullanımdan kaldırıldı - v1.17:
redirecttanıtıldı - v1.16:
watch,unwatchkullanımdan kaldırıldı - v1.16:
watchlisttanıtıldı - v1.15:
undo,undoaftertanıtıldı - v1.14:
starttimestamptanıtıldı
Ek notlar
- Oturum açma API tarafından kesinlikle gerekli değildir, ancak düzenlemenin yazarına doğru bir şekilde atfedilmesi gerekir. Oturum açmamış bir kullanıcının başarılı bir düzenlemesi IP adresleriyle ilişkilendirilir.
- Oturum açmayan botlar, düzenleme ve diğer yazma taleplerinde kısıtlamalarla karşılaşabilir; daha fazla ayrıntı için Manual:Bot oluşturma#Oturum açma sayfasına bakın.
- Oturum açmayan kullanıcılara her zaman boş CSRF anahtarıverilir,
+\. - Bir anahtar isteme süreci çeşitli sürümlerde değişti. Daha fazla bilgi için API:Tokens sayfasına bakın.
- ResourceLoader , bir viki sayfasında kod çalıştırırken düzenleme anahtarlarına erişmenin bir yolunu sunar.
- Tek bir oturum açma oturumu sırasında, aynı viki üzerindeki tüm düzenleme işlemleri için aynı CSRF anahtarı kullanabilirsiniz.
- Sorgu dizesinin sonunda veya en azından text parametresinden sonra isteğinizde herhangi bir anahtarı iletmek iyi bir uygulamadır. Bu şekilde, bağlantı kesilirse jeton iletilmez ve düzenleme başarısız olur. İstek yapmak için mw.Api nesnesini kullanıyorsanız, bu otomatik olarak yapılır.
captchaidvecaptchawordteknik olarak API:Edit v1.18'den beri kaldırılmış olsa da, Extension:ConfirmEdit API:Edit'i CAPTCHA'larla çalışacak şekilde genişletir. Böylece, ConfirmEdit kurulu olduğunda, bu parametreler hala kullanılabilir. ConfirmEdit, MediaWiki yazılımı v1.18 + ile birlikte gelir.
Limitations
- The API does not yet support editing content slots (T200570). You can do so instead with an extension like Extension:WSSlots, which enables the
editslotAPI action.
Ayrıca bakınız
- Help:Düzenleme - maddeleri düzenlemeyle ilgili faydalı bağlantılar içeriyor.
- Manual:Bot passwords - vikilere GUI yerine bir komut dosyası veya uygulama aracılığıyla erişirken basitleştirilmiş bir arabirim kullanarak nasıl oturum açılacağını açıklar.
- Manual:Creating a bot - sayfaları otomatik olarak düzenlemek için bot kullanma hakkında daha fazla ayrıntı.
- ResourceLoader - bir MediaWiki sayfasında JavaScript çalıştırırken düzenleme anahtarına erişmenin bir yolunu sunar.
- API:Tokens - oturum açmak veya POST istekleri yapmak için anahtarları kullanma hakkında daha fazla ayrıntıya sahiptir.
- API:Tokens (eylem) - MediaWiki'nin önceki sürümlerinde anahtar istemek için API:Tokens üzerinden farklı, kullanımdan kaldırılmış bir API.
- API:Compare - bir sayfadaki düzenlemeler arasında değişiklik yapmanızı sağlar.
- API:Managetags - bir sayfadaki etiketleri değiştirir.
- API:Rollback - bir dizi düzenlemeyi geri alır.
- API:Filerevert - dosyaları daha önceki bir duruma geri alır.
- API:Revisiondelete - bir sayfadaki revizyonları siler ve geri yükler.