Modify configuration of existing Jenkins pipeline - via any programming language

Hi Jenkins community members,
Hope all are doing good !!

Till now I have been creating the different pipelines on Jenkins but never modified the existing pipeline from outside. My question is regarding modifying the configuration of an existing Jenkins pipeline using any programming language (powershell, Java, python etc).
For example in below image, I want to modify current configuration via calling a powershell script (or some other program) and add new ‘branch3’ in Discover branches section (e.g. branch1|branch2|branch3 ) , which I am creating via different pipeline. All these branches are part of BitBucket repository.

Has anyone done this before? If so then how it can be done? Some references will be highly appreciated.


The remote access API page describes several different alternatives that can create jobs. As far as I understand it, a job can be modified through the same API that creates it.

The Python wrappers mentioned on that page are all reasonably current (2 with last releases in 2021, 1 with last release in 2020, 1 with last release in 2019). The ruby wrapper looks like it has not been released since 2017.