How to use Rest web service to add members to a group
search cancel

How to use Rest web service to add members to a group

book

Article ID: 200699

calendar_today

Updated On:

Products

CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager

Issue/Introduction

This tech doc gives detail info regarding how to use Service Desk Rest web service API to add members to a group

Environment

Release : 17.1, 17.2, 17.3

Component : Svc Desk Web Services

Resolution

You can use a POST action to add one member to the group and repeat that for all new members.

The following java script example shows what the URI and payload looks like for adding one member

  String baseURI = "http://my-server-name:8050/caisd-rest";

  String endpointPOST = baseURI + "/grpmem";

  PostMethod post = new PostMethod(endpointPOST);
  post.addRequestHeader("X-AccessKey", accessKey);
  post.addRequestHeader("Accept" , "application/xml");
  post.addRequestHeader("Content-Type", "application/xml; charset=UTF-8");
  post.setRequestBody(
    "<grpmem>" +
    "<group COMMON_NAME=\"group-name\"/>" +
                      "<member COMMON_NAME=\"Joe, Ling\"/>" +
                      "<manager_flag>0</manager_flag>" +
                      "<notify_flag>0</notify_flag>" +
    "</grpmem>"
  );

Please notice that for member tag with COMMON_NAME, you should use the combo_name of the member.