How to create jobs on Jenkins with credentials enabled?

admin

Administrator
Staff member
I have code to create/update jobs on Jenkins without credentials enabled.

Code:
const string FORMAT = "http://{0}:{1}/createItem?name={2}";
var path =
    string.Format(
        FORMAT,
        this.config.JenkinsServer,
        this.config.JenkinsPort,
        buildName);

this.http.UploadString(
    path,
    definition,
    new Header(HttpRequestHeader.ContentType, "text/xml"));

Now, I want to move one step forward by enable credentials and specify username/password when creating a new job. I found <a href="https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients" rel="nofollow">an article about Authenticating scripted clients on Jenkins</a> but there is no code example in C# and couldn't figure it out how to do it.

How to create/update jobs on Jenkins with credentials enabled?

<strong>[UPDATE]</strong>
Specify username and password on the url like in <a href="http://benkiew.wordpress.com/2012/0...kins-via-rest-and-curl-a-very-small-cookbook/" rel="nofollow">this link</a> also doesn't work.