I am trying to create a new job by triggering the jenkins' createItem 
endpoint, using the following code: 

$(document).ready(function() {
      $("#create").click(function (e) {
        e.preventDefault();
        var newJobName = $("#jobname").val();
        //console.log(newJobName);
        jQuery.ajax({
            type: "POST",
            url: "http://robot:<api1>@host/jenkins/createItem?name="+
newJobName,
            dataType:"xml",
            contentType: "application/xml",
            success:function(response){
                console.log("success");
            },
            error:function (xhr, ajaxOptions, thrownError){
                alert(thrownError);
            }
        });
      });
    });

But i am getting 500 server error. I know I should post the 
config.xml

file also but i don't really know how to extend this code to be able to 
post the file also. 

I am using a self-written client to interact with jenkins and the API is 
works well for build triggering. 

Any help would be really appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/00cec890-3689-44ef-b056-81b4ee332098%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to