How to add services in load balancer through API?

Hey @Adaikal_Raj

So for my stack (project/1a5 in this case), I added the load balancer service by passing in the lb_post_me.json payload, with the following command:

mudboxR:scratch ahmad$ curl -H "Content-Type: application/json" -X POST -d @lb_post_me.json -u APIKEY:SECRETKEY http://RancherServerIP:PORT/v1/projects/1a5/loadbalancerservices?create

Contents of lb_post_me.json, with minimal configuration info to get the LB service going :

{
	"environmentId": "1e1",
	"launchConfig": {
		"ports": [
			"80:8080"
		],
		"restartPolicy": {
			"name": "always"
		},
		"tty": true
	},
	"name": "dd-lbtest",
	"scale": 3,
	"startOnCreate": true,
	"type": "loadBalancerService"
}

I find the developers tools in the chrome browser a great way of reverse engineering API commands. It’s useful for showing the exact commands, as well as sequence of execution, for creating/updating/deleting resources in Rancher.

Hope that helps…