The section number used for an edit action in the Mediawiki API has a flaw, a given section's id will change if a prior sectionApologies, that was already establishedinitial submission mixed up 'level' and 'number', gets a new subsection.my mistake!
Updated:
The section index used for an edit action in the Mediawiki API has a flaw, a given section's index will change if a prior section, that was already established, gets a new subsection.
An improvement would be to make available the 'level''number' value for an edit as well. It will still change if a new section at the same level is added prior to this section, but will not be impacted by new subsections in prior section.
This would also allow an edit request to address a single specific section instead having to account for any possible subsections in an edit.
Example:
== Section 1==
=== sub 1 ===
== Section 2 ==
Section 2 section numberindex is 3. Adding a sub 2 in Section 1 causes Section 2's numberindex to increase to 4. Being able to use levelnumber values instead would help, Section 2's levelnumber remains 2.0.
I think it would be best that an edit request for level includes no subsections, so edit level 1.0 only gets the content of Section 1, stopping at sub 1 header.