I am an Outreachy applicant and I am working on documenting the result values and their structure of API:Edit. I read a possible result value could be redirects but i do not understand how this API creates redirects using batched params. What role does prependtext, appendtext and section parameters have to play here? Its confusing, please can someone clarify me.
Resolving redirects using action=edit API


Creating a redirect page with the api is the same as creating a redirect page using the normal text editor from the web interface. It requires to replace the contents of the page with #REDIRECT [[pagename]]
For more information about redirects, see: https://www.mediawiki.org/wiki/Help:Redirects

Not sure I understand your question - the edit API does not do any batching.
The redirect
input parameter tells the API that when the page specified via the title
or pageid
parameter is a redirect, it should edit the target of the redirect, not the redirect page itself. When that happens, there will be a redirects
output field which contains something like { "from": <title provided by the user>, "to": <redirect target> }
.
I guess you are asking about the
if ( $params['prependtext'] === null && $params['appendtext'] === null
&& $params['section'] !== 'new'
) {
$this->dieWithError( 'apierror-redirect-appendonly' );
}
code block here? What would you like to know, exactly, beyond what the error message already tells you?
How redirects are represented depends on the content type. For wikitext pages, a redirect is
#REDIRECT [[SomePage]]
For Javascript pages, a redirect is
/* #REDIRECT */ mw.loader.load( 'https://my.domain/w/index.php?title=SomePage.js&action=raw&ctype=text/javascript' );
Etc. But that’s not what the edit API’s redirect
parameter or redirects
output field is about; the API actually does not provide any support for constructing redirects. (Granted, the web interface doesn’t either. So yeah, it’s basically the same.)