Run Teamcity Job Remotely

Create build with rest api

curl --data "@job.json" -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://<teamcity url>/app/rest/buildQueue  
  • The property value in the message body shouldn’t include whitespace if executing with paramters, or use ==Custom Script== instead
  • Sample job.json file
{
	"branchName": "master",
	"buildType": {
		"id": "TestBuild"
	},
	"comment": {
		"text": "Test Build"
	},
	"properties": {
		"property": [
			{
				"name": "Environment",
				"value": "SIT"
			}
		]
	}
}

Check build status

curl -H "Authorization: Bearer <token>" http://<teamcity url>/app/rest/builds/?locator=buildType:TestBuild

Reference