9

I've just started to experiment with the TeamCity REST API. I've been some of the documentation about what types of commands I can call, etc, but one thing which is not mentioned is how to pass a username and password to the API.

I've not been able to find examples of this; so can someone help me out please?

Jason Evans
  • 28,906
  • 14
  • 90
  • 154

2 Answers2

12

like this:

http://user:pass@server:port/app/rest/..... etc

I found that on the EAP Docs Site

Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
  • Many thanks for that. Hmmm, not sure if I like the idea of including the username and password in the url like that. Will ask the team if they have a https: available for the TeamCity server. – Jason Evans Jun 13 '12 at 15:16
  • I think you can use SSL on Team city. – Preet Sangha Jun 13 '12 at 15:17
  • Even with SSL (https), does that not still mean I need to pass username and password in the url, which means I'm not better off? Sorry for sounding such a newbie here, this stuff is new to me. – Jason Evans Jun 13 '12 at 16:00
  • Cheers for that explanation, much appreciated :) – Jason Evans Jun 13 '12 at 16:15
  • updated docs here: https://confluence.jetbrains.com/display/TCD10/Accessing+Server+by+HTTP – brntsllvn Jan 27 '17 at 00:01
2

Thanks for Sangha's answer. Just one more supplement.

Please remember to encode user id and password using Base64.

Eugene
  • 10,627
  • 5
  • 49
  • 67