I have MW ver. 1.26.2 and become problems with api.php?action=userrights&user=aaTestname3&add=moderator&format=json
Response says: {"userrights":{"user":"AaTestname3","userid":515,"removed":[],"added":[]}}
But no moderator right was added when i look in User-admin. I am currently logged in with a sysop user. I am pretty sure I have enough access in the RestSharp context.
Is that a well known problem in 1.26.2?
The token did not work from the querystring for action=userrights. This was not documentet in API documentation. For other methods it worked direct in querystring.
I got thist result: And in order to remove:
<error code="mustposttoken" info="The token parameter was found in the query string, but must be in the POST body" xml:space="preserve">
...i tried adding the token to request body, but that did not work.
After testing different methods, I found this method that worked:
request.AddParameter("token", userrightstoken.ToLower(), ParameterType.GetOrPost);
Here is also my HTTP Request and Response
-############### = censored
RestSharp request:
Postman-Token=c50a89a4-7738-###############
Cache-Control=no-cache
Accept=application/json, application/xml, text/json, text/x-json, text/javascript, text/xml
Postman-Token=d67f0f62-a98b-4f9b-#################
Cache-Control=no-cache
token=267de0fd01f191498#################
RestSharp response:
X-Content-Type-Options=nosniff
X-Frame-Options=SAMEORIGIN
Content-Encoding=
Vary=Accept-Encoding
Transfer-Encoding=chunked
Cache-Control=private, must-revalidate, max-age=0
Content-Type=application/json; charset=utf-8
Date=Thu, 26 Apr 2018 07:22:15 GMT
Server=Apache