REST API Login problem
I'm just starting a development project to write an application where we can import a CSV file data into YouTrack using the REST API. So I'm trying to learn how to use the API calls. I wanted to just test the calls using Fiddler but it doesn't seem to be working for me so I don't know if I'm just not setting it up correctly or if I am missing something.
In Fiddler, I've got the Address set as:
POST: http://xxxx.myjetbrains.com/youtrack/rest/login
I've got the Request Headers set as:
User-Agent: Fiddler
Host: xxxx.myjetbrains.com
Content-Length: 0
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Cookie: login=myusername&password=mypassword
(I also tried setting the Cookie as:
Cookie: login=myusername; password=mypassword
but get the same result)
But when I submit this I get a 404 error with the result as:
15
{"value":"Not Found"}
0
Can anyone help me in letting me know what I'm doing wrong?
I'm hoping that once I get past the initial login and get my first API request to work it will be smooth sailing afterwards.
Thank you,
Mike
In Fiddler, I've got the Address set as:
POST: http://xxxx.myjetbrains.com/youtrack/rest/login
I've got the Request Headers set as:
User-Agent: Fiddler
Host: xxxx.myjetbrains.com
Content-Length: 0
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Cookie: login=myusername&password=mypassword
(I also tried setting the Cookie as:
Cookie: login=myusername; password=mypassword
but get the same result)
But when I submit this I get a 404 error with the result as:
15
{"value":"Not Found"}
0
Can anyone help me in letting me know what I'm doing wrong?
I'm hoping that once I get past the initial login and get my first API request to work it will be smooth sailing afterwards.
Thank you,
Mike
Please sign in to leave a comment.
Here you can find documentation on how to import from CSV and here you can find reference for REST API.
Now about your example. You use wrong URL, it should be http://xxxx.myjetbrains.com/youtrack/rest/user/login. And you should send credentials as POST data, not as cookies. See example in documentation.
I wasn't wanting to use the Python code since that would require that to be setup on any of our users that would need to be doing the imports. But I have since gotten the login (I did finally find the incorrect address) and other API GET's to work and although I couldn't figure out how to get the Insert Issue API to work (couldn't figure out how to properly format the issue data) I finally got the YouTrackSharp library to work for me in creating issues from my CSV file. So as of right now, everything is working great for me.