{"id":3663,"date":"2018-10-16T10:38:26","date_gmt":"2018-10-16T10:38:26","guid":{"rendered":"http:\/\/34.238.172.127\/?page_id=28"},"modified":"2021-11-25T10:11:22","modified_gmt":"2021-11-25T10:11:22","slug":"add-remove-users","status":"publish","type":"page","link":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/user-groups\/add-remove-users\/","title":{"rendered":"Add\/Remove Users"},"content":{"rendered":"<div class=\"method-copy\">\n<div class=\"method-copy-padding\">\n<h2> Add\/Remove Users <\/h2>\n<p>Add or remove users to\/from a user group.<\/p>\n<div class=\"table-responsive\">\n<table id=\"table_61516733\" width=\"100%\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th width=\"12%\"> <strong>Arguments<\/strong> <\/th>\n<th width=\"12%\"> <strong>Type<\/strong> <\/th>\n<th width=\"20%\"> <strong>Description<\/strong> <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> add_users <\/td>\n<td> Integer array <\/td>\n<td> Required. An array of user IDs to be added into the group <\/td>\n<\/tr>\n<tr>\n<td> remove_users <\/td>\n<td>Integer array<\/td>\n<td>Required. Array of user IDs to be removed from the group<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>NOTE:<\/strong> If add_users and remove_users contain the same IDs, then those IDs will be added to the group.<\/p>\n<\/div>\n<\/div>\n<div class=\"method-example\">\n<div class=\"curl-text\">curl<\/div>\n<div class=\"code-curl code-div active-code\">\n<div class=\"method-example-part\">\nHTTP Request:<\/p>\n<pre class=\"lang:default decode:true\">POST https:\/\/<portal>.hexnodemdm.com\/api\/v1\/usergroups\/{USERGROUP_ID}\/ \r\nheaders:-\r\nAuthorization: <api key>\r\nContent-Type: application\/json\r\nSample Post Data:-\r\n[{\r\n\"add_users\":[1,2,3],\r\n\"remove_users\":[4],\r\n}]\r\n<\/pre>\n<p>Shell Command:<\/p>\n<pre class=\"lang:default decode:true\">curl -H \"Authorization:<your API key>\"  -H \"Content-Type: application\/json\" -d '{ \"add_users\":[1,2,3],\"remove_users\":[4]}' https:\/\/<portal>.hexnodemdm.com\/api\/v1\/usergroups\/{USERGROUP_ID}\/\r\n<\/pre>\n<\/div>\n<\/div>\n<div class=\"code-curl code-div active-code\">\n<div class=\"method-example-part\">\nHTTP Response:<\/p>\n<pre class=\"lang:default decode:true\">HTTP_201_CREATED\r\n{  \r\n\"id\": 6, \r\n\"groupname\":\"example\" , \r\n\"description\":\"ios usergroup\",  \r\n\"users\":[ \r\n{  \r\n\"id\":  1, \r\n\"name\":\"neil\" \r\n\"email\":\"neil@hexnode.com\",  \r\n\"domain\": \"local\", \r\n\"phoneno\": \"18664989407\" \r\n}, \r\n...\r\n]\r\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Add\/Remove Users Add or remove users to\/from a user group. Arguments Type Description add_users Integer array Required. An array of user IDs to be added into the group remove_users Integer array Required. Array of user IDs to be removed from the group NOTE: If add_users and remove_users contain the same IDs, then those IDs will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3658,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-3663","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/3663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/comments?post=3663"}],"version-history":[{"count":6,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/3663\/revisions"}],"predecessor-version":[{"id":4656,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/3663\/revisions\/4656"}],"up":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/pages\/3658"}],"wp:attachment":[{"href":"https:\/\/www.hexnode.com\/mobile-device-management\/developers\/wp-json\/wp\/v2\/media?parent=3663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}