Problems posting issues to a private project via the REST API

I refer to this blog post Creating an alternative UI for YouTrack which I was using as a starting point hwoever the project I need to post to is not a public project so I therefore get 401 (Unauthorized) errors when attempting to post a new issue.


  1. Can I post issues into a private project from a designated domain without passing login credentials? The reason for this is that for our users it is likely to be a barrier to them reporting issues if they have to login first.

Thanks, Simon
2 comments
Comment actions Permalink
On the assumption that it is not possible to anonymously report issues for a private project I've set about trying to login via the REST API first. I can login and the cookies are set however when I now try and post the issue via the API I get a 403 Forbidden error.

My code is as follows:

    function createIssue() {

        $.ajax({
            url: "http://example.myjetbrains.com/youtrack/rest/user/login",
            dataType: "json",
            type: "POST",
            data: {
 login: $("#username").val(),
 password: $("#password").val()
            }
        });

        $.ajax({
            url: "http://example.myjetbrains.com/youtrack/rest/issue",
            dataType: "json",
            type: "POST",
            data: {
 project: 'PROJECT_NAME',
 summary: $("#summary").val(),
 description: $("#description").val()
            },
            xhrFields: {
 withCredentials: true
            }
        }).done(function(data) {
            $("#result").show();
            $("#summary").val('');
            $("#description").val('');
        });
    }

prettyPrint();
0
Comment actions Permalink
For the benefit of others it turns out that the 403 error was being thrown because the Project name entered was the name and not the Project ID!
0

Please sign in to leave a comment.