Automate Team City operations
Hi,
I am relatively new to Team City and I would like to know if it is possible to automate Team City operations like "Archive Project" using some API or by any other means. Any help in this regard would be highly appreciated.
Thanks,
Paul
Please sign in to leave a comment.
Hi Paul
TeamCity provides REST interface for such tasks.
Also there are a few actions can be performed by Accessing Server by HTTP.
Hi Michael,
Thanks for the quick response. REST api seems like the way to go. I will have a look at it.
Thanks,
Paul
Hi,
I had a look at the REST api documentation but I don't see a way to perform "Archive Project" operation. Can anyone please let me know if this particular operation can be automated?
Thanks,
Paul
It's mentioned in Project Settings section.
You can send PUT requests to http://<teamcity>/app/rest/projects/<id>/archived resource.
Hi Michael,
Thanks again for the quick response. Based on the information provided in the Project settings section, I tried the following command
"curl -v --request PUT http://<user>:<password>@<teamcityserver>/httpAuth/app/rest/projects/id:<ProjectId>/archived"
It runs without any error but the project isn't archived. May be I am missing something or the syntax isn't right. Could you please help?
The delete works fine though with the following command
"curl -v --request DELETE http://<user>:<password>@<teamcityserver>/httpAuth/app/rest/projects/id:<ProjectId>"
Thanks,
Paul
You also need explicitly set Content-Type HTTP header:
curl --request PUT http://user:password@host/httpAuth/app/rest/projects/projectN/archived -d true --header "Content-Type: text/plain"
Hi Michael,
Fantastic! that worked like a charm. Thank you very much for your timely help. Much appreciated.
Thanks,
Paul