使用 mediawiki api 上传文件需要哪些权限?
Which permissions are needed to upload files with mediawiki api?
我正在使用 mediawiki api 上传文件。我正在向
发送一个多部分 POST 请求
https://commons.wikimedia.org/w/api.php?format=json&action=upload&filename=xxx
在 header 中,我包含了我的 Autherzation: Bearer accessToken123
,在 body 中,我包含了我的 CSRF 令牌,以及我的多部分文件,所有这些都按照文档。
但是,我从服务器得到的响应如下:
{
"error": {
"code": "permissiondenied",
"info": "The action you have requested is limited to users in one of the groups: *, [[Commons:Users|Users]].",
"*": "See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
},
"servedby": "mw1448"
}
这本身就相当 self-explainatory,但是当我用
检查我的 rights/groups 时
https://commons.wikimedia.org/w/rest.php/oauth2/resource/profile
我得到以下信息:
{"sub":xxxx,"username":"xxxxx","editcount":7,"confirmed_email":true,"blocked":false,"registered":"xxxx",
"groups":["*","user","autoconfirmed"],
"rights":["read","writeapi","viewmyprivateinfo","abusefilter-view","abusefilter-log","upload","upload_by_url","reupload-own","purge","reupload","autoconfirmed","editsemiprotected","skipcaptcha","abusefilter-log-detail","transcode-reset"],
"grants":["basic","uploadfile","uploadeditmovefile","privateinfo"],"realname":"","email":"xxxx"}
如您所见,我既是必需组的一部分,也具有必要的 upload
权利。错误信息很清楚,所以我不知道我错过了什么。它不是 CSRF 令牌或访问令牌,在不同的错误消息中提供这些错误结果。感谢任何帮助。
好吧,我终于明白了:当从 mediawiki 请求应用程序密钥时,您可以 select 应用程序代表用户拥有的权利。如果你想上传图片到维基共享资源,你不仅需要`
Interact with media: Upload new files; Upload, replace, and move
files
没错,也是
Create, edit, and move pages
对,因为每次上传都会创建一个新页面。我希望这对以后的其他人有帮助:`)
我正在使用 mediawiki api 上传文件。我正在向
发送一个多部分 POST 请求https://commons.wikimedia.org/w/api.php?format=json&action=upload&filename=xxx
在 header 中,我包含了我的 Autherzation: Bearer accessToken123
,在 body 中,我包含了我的 CSRF 令牌,以及我的多部分文件,所有这些都按照文档。
但是,我从服务器得到的响应如下:
{
"error": {
"code": "permissiondenied",
"info": "The action you have requested is limited to users in one of the groups: *, [[Commons:Users|Users]].",
"*": "See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes."
},
"servedby": "mw1448"
}
这本身就相当 self-explainatory,但是当我用
检查我的 rights/groups 时https://commons.wikimedia.org/w/rest.php/oauth2/resource/profile
我得到以下信息:
{"sub":xxxx,"username":"xxxxx","editcount":7,"confirmed_email":true,"blocked":false,"registered":"xxxx",
"groups":["*","user","autoconfirmed"],
"rights":["read","writeapi","viewmyprivateinfo","abusefilter-view","abusefilter-log","upload","upload_by_url","reupload-own","purge","reupload","autoconfirmed","editsemiprotected","skipcaptcha","abusefilter-log-detail","transcode-reset"],
"grants":["basic","uploadfile","uploadeditmovefile","privateinfo"],"realname":"","email":"xxxx"}
如您所见,我既是必需组的一部分,也具有必要的 upload
权利。错误信息很清楚,所以我不知道我错过了什么。它不是 CSRF 令牌或访问令牌,在不同的错误消息中提供这些错误结果。感谢任何帮助。
好吧,我终于明白了:当从 mediawiki 请求应用程序密钥时,您可以 select 应用程序代表用户拥有的权利。如果你想上传图片到维基共享资源,你不仅需要`
Interact with media: Upload new files; Upload, replace, and move files
没错,也是
Create, edit, and move pages
对,因为每次上传都会创建一个新页面。我希望这对以后的其他人有帮助:`)