← Back to team overview

openstack team mailing list archive

how to give security group in REST json request to create server

 

I am trying to create instance from REST client. I want to give security group in json request so that the instance gets created in some specified security group. I didn't find any document regarding this. I have tried giving security_group paramater as

http://10.102.153.51:8774/v2/f24b19b2b81c433ab9598bdb184ff12d/servers?security_group=pehlasg
"server": {"name": "teesra",  "imageRef": "082aa3ea-26dc-44bd-89db-c540e202bfce",  "flavorRef": "42",  "key_name": "firstkeypair" } 
I have tried some other ways also

http://10.102.153.51:8774/v2/f24b19b2b81c433ab9598bdb184ff12d/servers

"server": {"name": "teesra",  "imageRef": "082aa3ea-26dc-44bd-89db-c540e202bfce",  "flavorRef": "42",  "key_name": "firstkeypair",
        "security_groups": [{"name": "default" } ] 
    }

and 

"server": {"name": "teesra",  "imageRef": "082aa3ea-26dc-44bd-89db-c540e202bfce",  "flavorRef": "42",  "key_name": "firstkeypair",
        "security_group": "default"
    }


but all this is resulting in some error.

What is the correct way to give security groups(multiple ) in json request?


Thanks,
Anshul