Not adding the location filed in newly created Organization

Hi Guys,
I am trying to create new Organization using API and successfully it is created.
but when I am passing the input parameter to add the location_id in the organization then it is not getting added.

{"organization":{"name":"hp-contoso","smart_proxy_ids":[1,2],"config_template_ids":[1],"provisioning_template_ids":[118],"domain_ids":[1],"environment_ids":[1],"subnet_ids":[1]},"locations_id":4}

and when I am manually adding and teh using GET api fetching the newly created org then it shows the location.

Even same thing I have tried using hammer

hammer organization create --name hp-contoso --location-id 4

but it is also not adding the location in organization.

Thanks

As an organization can have multiple locations, you should be using plural location_ids similar to the other resources. It should also be part of the organization object and not outside it. Otherwise, it is used as a scope for the request (similar to selecting a location in the UI drop down). So, in all, the api request should be:

{"organization":{"name":"hp-contoso","smart_proxy_ids":[1,2],"config_template_ids":[1],"provisioning_template_ids":[118],"domain_ids":[1],"environment_ids":[1],"subnet_ids":[1],"location_ids":[4]}}