VMware Networking Community
salmanksfu
Contributor
Contributor
Jump to solution

NSX-T API adding group

I am trying to add a group into the inventory as I see on the web interface using the REST API:

PUT /global-manager/api/v1/global-infra/domains/default/groups

{
"expression" : [ {
"ip_addresses" : [ "1.1.1.1" ],
"resource_type" : "IPAddressExpression"
} ],
"resource_type" : "Group",
"display_name" : "00test11",
"description" : "test api call",
"_system_owned" : false,
"_protection" : "NOT_PROTECTED",
"_revision" : 0
}

 

I keep getting the response:
{ "module_name" : "common-services",

"error_message" : "Method is not allowed",

"error_code" : 282 }

 

When I do GET /global-manager/api/v1/global-infra/domains/default/groups, I do get all the groups. is there a step that I am missing before making a PUT method call? the docs mention put PUT /global-manager/api/v1/global-infra/domains/default/groups/<group-id> but how do I get the <group-id> before I create it? Any help would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
salmanksfu
Contributor
Contributor
Jump to solution

So, after being stuck on this issue for long with no success, I tried to use method PATCH and use the URL ..domains/default/groups/00test11 and that works!

View solution in original post

0 Kudos
3 Replies
ssanthoshkum
VMware Employee
VMware Employee
Jump to solution

Hi,

if you are creating a new group based on IP address Expression, display name "00test11" is going to group-id. Try like this 

PUT /global-manager/api/v1/global-infra/domains/default/groups/00test11

https://developer.vmware.com/apis/1230/nsx-t-global-manager

 

HTH

Sandy

 

 

0 Kudos
salmanksfu
Contributor
Contributor
Jump to solution

I have tried that by following the URL mentioned in the docs as you described and then the error comes back as:

{ "httpStatus" : "NOT_FOUND",

"error_code" : 500090,

"module_name" : "Policy", "error_message" : "Policy object path=[/global-infra/domains/default/groups/00test11] does not exist." }

0 Kudos
salmanksfu
Contributor
Contributor
Jump to solution

So, after being stuck on this issue for long with no success, I tried to use method PATCH and use the URL ..domains/default/groups/00test11 and that works!

0 Kudos