Page 1 of 3
YouTrack rest API
Posted: Thu Dec 13, 2012 3:40 pm
by Jon Crump
Trying to build an app using the YouTrack rest API, the service works as tested in the builder, when I come to run in it the browser, it returns a failed response, however using the inspector in Chrome, I can see the call was successful (status code 200) with a little green icon. Why is the successful call interpreted as a failure?
YouTrack rest API
Posted: Thu Dec 13, 2012 3:50 pm
by Maryna Brodina
Hello! Could you send us your app link or clarify how we can define the service to test.
YouTrack rest API
Posted: Thu Dec 13, 2012 3:54 pm
by Jon Crump
This is my project:
http://project.tiggzi.com/project/93f...
Username: rest_api_user
Password: VMPGroup1234
And youtrack documentation on the login call:
http://confluence.jetbrains.net/displ...
Thanks for your help
YouTrack rest API
Posted: Thu Dec 13, 2012 4:14 pm
by Maryna Brodina
YouTrack rest API
Posted: Fri Dec 14, 2012 8:52 am
by Maryna Brodina
Hello! In settings please set Data type to xml instead of json.
YouTrack rest API
Posted: Mon Dec 17, 2012 3:52 pm
by Jon Crump
Thanks for your help, that part is working now.
So when I login a cookie is returned which I need for the next step, this isn't part of the XML response though, how can I capture this to a Local Storage Variable?
I created a parameter in the response and mapped it to a Local Storage Variable, but it's always empty as the cookie is in the header not in the XML response.
YouTrack rest API
Posted: Mon Dec 17, 2012 5:13 pm
by Maryna Brodina
Read the cookie value with JavaScript
YouTrack rest API
Posted: Tue Dec 18, 2012 3:18 pm
by Jon Crump
Sounds simple, I tried using Jquery code to access the cookie.
($.cookie) but that doesn't work.
I tried to include the Jquery cookie plugin as a JavaScript file but that causes errors too. (https://github.com/carhartl/jquery-co...)
Seems like that could be a useful library to have included.
Can you offer any more assistance on the JavaScript and the best place to put it? Currently on the completed event of the service.
YouTrack rest API
Posted: Tue Dec 18, 2012 3:48 pm
by Jon Crump
So I can read the cookies for the page, but it seems it's different to read the cookies returned from the rest api, that they are separate.
YouTrack rest API
Posted: Tue Dec 18, 2012 4:18 pm
by Maryna Brodina
To make your service send and get Cookie while HTTP request use "Run Javascript" instead of "Invoke Service"
restservice1.execute({xhrFields: {
withCredentials: true
}})
restservice1 - name of data sourse component in "Data" tab
This parameter withCredentials: true will allow send and get Cookie automatically