Using the Rally API to change the rank of an item

190 Views Asked by At

I am trying to use the Rally web service API to reorder 2 items.

From looking at the documentation i should be able to do:

    $.ajax({
        url: https://rally1.rallydev.com/slm/webservice/v2.0/task/12345?rankAbove=/slm/webservice/v2.0/task/56789,
        type: 'PUT',
        headers: { Authorization: Basic mytoken },
        success: function(data) {

          //do something

        }
    });

but i'm getting an error:

Cannot parse input stream due to I/O error as JSON document: Parse error: expected '{' but saw '' [ chars read = \u003E\u003E\u003E\u003C\u003C\u003C ]"

The documentation doesn't seem to reveal what I could be doing wrong.

Cheers for your help

1

There are 1 best solutions below

7
On BEST ANSWER

You won't be able to use basic auth to do this because there is an additional CSRF token you need to pass. I think you can make it work with an api key though:

headers: { zsessionid: myToken }

You didn't have any issues with reading data because the CSRF protection only kicks in when attempting to modify data.

For what it's worth, the App SDK generally handles most of this complexity for you. It looks like you're using jquery in your app here instead, which is why you need to do this low level stuff...