Set VCS root username & password via REST API Follow
How can i set the VCS root username and password via REST API?
I can see there is the call to set properties:
http://teamcity:8111/httpAuth/app/rest/vcs-roots/<vcsRootLocator>/properties/<property_name>
I can see the user property in list of properties returned from:
http://teamcity:8111/httpAuth/app/rest/vcs-roots/<vcsRootLocator>/properties/
So i can set the user with:
http://teamcity:8111/httpAuth/app/rest/vcs-roots/id:2/properties/user using http PUT
How can i set the password?
I'm using TeamCity 7 RC1 build 21209
Please sign in to leave a comment.
John,
Good question.
Password fields are not served on request for VCS root details as a security measure.
However, you can PUT passwords to the properties with appropriate names. e.g. these are "secure:svn-password" for SVN and "secure:passwd" for Perforce.
There is an internal (read "can change in further releases without special notice") internal property to serve password properties via REST so that you can get their names: "rest.listSecureProperties=true".
I would not recommend to set it on your production server, however.
"you can PUT passwords to the properties with appropriate names. e.g. these are "secure:svn-password" for SVN and "secure:passwd" for Perforce."
How do I do this for a mercurial password?
The API documentation is a bit lacking. Can you give an example?
Anthony,
You can use my earlier suggestion:
> There is an internal (read "can change in further releases without special notice") internal property to serve password properties via REST so that you can get their names: "rest.listSecureProperties=true".
Or look up the property name in the HTML page source, or int he vcs-roots.xml file under the TeamCity data directory.
In case of Mercurial, the property name is "secure:password".
FYI - About internal properties. The article for the current TeamCity version is not up-to-date (check paths and file names). https://confluence.jetbrains.com/display/TCD10/TeamCity+Internal+Properties