Teamcity login http authentication post parameters?

Hi, 

I am writing some performance monitoring script, in which I have to log in to teamcity and and check how long does it take?

I am not sure what post parameters has to be added.

I am using curl.

Any help?

0
13 comments

Hello!

Can you please detail the task? Do you need to get a build duration from TeamCity?

0

Hi,

I am writing a perl script using Nagios, in which we are calculating the performance management of our Teamcity.

So our script logs in to the teamcity with out UI more precise through the url in the script and searches for the "Welcome" string in the page after login and retruns the time it took.

I need to create that url inside my perl script. I tried using curl also. But apart from username and password there are some hidden parameters also send to server for authentication.

I am not able to find the exact url to login.

Thanks,

Riya

0

Thank you for the details, but I guess I will need more inforamtion to fully understand the case.

Do you try to measure performance of TeamCity UI?

What page of TeamCity do you want to open? Can you give an URL?

I guess you can try to use HTTP basic authorization sending your normal TeamCity username and password. A non-secure, but "should be working" approach.

0

Thanks for the reply.

I have a script and in the script I have variable say url- which is pointing to our teamcity for example:  http://tc-00-blr:8111/login.html

now I want to login to the teamcity and go to http://tc-00-blr:8111/overview.html, so from the UI point I will have to add username, password and submit it.

But the login form on the teamcity takes username and password and POSTS it for authentication.

I want to find exact curl from which I can log in to team city from commandline.

For example: curl "http://tc-00-blr:8111/ httpAuth/action.html" -d "username={ourusername}&password={ourpassword}" or something similar.

I short I would like to login to team city using command line.

Thanks for all your help,

Riya

0

Hi,

I was just curious to know if you have any hints regarding my issue.

Thanks in advance,

Riya

0

If you want to try HTTP basic auth, this would map to something like:

curl "http://username:password@tc-00-blr:8111/overview.html"

0

Hi,

I tried using below curl options and none of this helps.

1. curl --user username:password http://tc-00-blr:8111/overview.html

It show nothing.

2. curl --user username:password http://tc-00-blr:8111/login.html

It opens the html src file of login.html

3. curl --data-urlencode "username=username&password=password"  http://tc-00-blr:8111/overview.html

It show nothing.

4. curl "http://username:password@tc-00-blr:8111/overview.html"

It show nothing.

Can you point me to any documentation where I might get this information and also is there any other approach.

Is there anything wrong with above options.

Thanks again,

Riya

0

Hi,

Can you let me know if the above tried attempts and correct.

Also our Organnization has purchased an Enterprise license of Teamcity is there any other alternative for us to get support.

Thanks,

Riya

0

Hello,

4. curl "http://username:password@tc-00-blr:8111/overview.html"

It show nothing.

Try adding "-v" option to curl.

What HTTP code is returned?

Do you specify correct username and password (like you enterin on login page int he browser)?

What TeamCIty version do you use?

Can you point me to any documentation where I might get this information

You should send HTTP basic authentication to TeamCity. The documentation on how to send it is client-dependent (in this case it's documentation on curl).

Also our Organnization has purchased an Enterprise license of Teamcity is there any other alternative for us to get support.

Enterprise license owners can also use teamcity-feedback@jetbrains.com email address. But I'd appreciate if you can post generic questions here in the forum so that other users can both participate and benefit from the answers.

Right now we are preparing for TeamCity 6.5 release and may lag a bit with the answers, so please bear with us. You may "ping" us if you need the answer sooner.

0

Hi,

Thanks a lot for your help.

I tried : curl -v "http://username:password@tc-00-blr:8111/overview.html"

And below is the output:

1. It says about to connect, trying and then connected to (ip address) and port number.

Server auth using Basic with user ‘username’

2. GET /overview.html HTTP/1.1 ******** and Accept: */*

And then I get:

< HTTP/1.1 302 Moved Temporarily

< Server: Apache-Coyote/1.1

<Set-Cookie ***

<Set-Cookie ***

< Set-Cookie ***

< Content-Length: 0

< Date: Mon, 09 May 2011 16:09:46 GMT

<

* Connection #0 to host tc-00-blr left intact

* Closing connection #0

I am not sure if this correct.

Thanks Again,

Priyanka

0

The command works OK for me for TeamCity 6.0+ provided I specify correct username and password instead of "username:password".

Do you run TeamCity without proxies before it?

Can you try the command from localhost for the server?

0

Hi,

I tried : curl -L -v "http://username:password@tc-00-blr:8111/overview.html"

When I try to do above:

1. It says about to connect, trying and then connected to (ip address) and port number.

Server auth using Basic with user ‘username’

2. GET /overview.html HTTP/1.1 ******** and Accept: */*

And then I get

< HTTP/1.1 302 Moved Temporarily

< Server: Apache-Coyote/1.1

<Set-Cookie ***

<Set-Cookie ***

< Set-Cookie ***

< Content-Length: 0

< Date: Mon, 09 May 2011 16:09:46 GMT

<

* Connection #0 to host tc-00-blr left intact

* Issue another request to this URL: 'http://tc-00-blr:8111/login.html'

* Re-using existing connection! (#0) with host tc-00-blr

* Connected to tc-00-blr (ip) port 8111 (#0)

> GET /login.html HTTP/1.1

> User-Agent: curl/7.18.2 (x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18

> Host: tc-00-blr:8111

> Accept: */*

>

< HTTP/1.1 200 OK

< Server: Apache-Coyote/1.1

< Pragma: No-cache

< Expires: Thu, 01 Jan 1970 00:00:00 GMT

< Cache-Control: no-cache

< Cache-Control: no-store

< Set-Cookie: ********** Path=/

< Set-Cookie: __test=1; Expires=Mon, 09-May-2011 17:43:15 GMT; Path=/

< Content-Type: text/html;charset=UTF-8

< Content-Language: en-US

< Content-Length: 4152

< Date: Mon, 09 May 2011 17:33:14 GMT

<

Looks like I am able to login is it correct? Also after logging in teamcity through UI we are taken to overview.html page where we see Meassage " Hello Username"

Now after logging through curl can we search for the  "Hello Username" String?

Also we are using: Version- 3.1.2


Thanks for all yoru help,

Priyanka

0

Seems you are not logged, just successful request for login.html page.

> Also we are using: Version- 3.1.2

This is a bit outdated version and it is probbaly the reason. Proper HTTP Basic authorization handling for every request was added sometime in between 3.x and 6.0.

I'd recommend to upgrade to the latest TeamCity version as we are not not planning to release any updates for versions earlier then 6.0.x

0

Please sign in to leave a comment.