public Group updateGroupAsJSON(string gid, Group group) { return updateGroup(gid, group); }
public Group createGroupAsJSON(Group group) { return createGroup(group); }
public Group updateGroup(string gid, Group group) { return null; }
public Group createGroupAsXML(Group group) { return createGroup(group); }
public Group createGroup(Group group) { return null; }
public WebResponse updateGroup(Group group, string requestType, string responseType) { // create a resource to update the group Uri uri = new Uri(url + "/Group/" + group.id); WebRequest request = WebRequest.Create(uri); // set the request & response media types request.ContentType = requestType; request.Headers.Add("Accept: " + responseType); // get the request stream to write the group Stream stream = request.GetRequestStream(); // create a user serializer XmlSerializer serializer = new XmlSerializer(typeof(Group)); // serialize the group object to xml serializer.Serialize(stream, group); // send the create group request to the rest resource request.Method = "POST"; WebResponse response = request.GetResponse(); return response; }
public WebResponse updateGroup(Group group) { return updateGroup(group, APPLICATION_XML_TYPE, APPLICATION_XML_TYPE); }
public static String createGroupTest(Client client) { // create a test group Group group = new Group(); group.id = "gid=nerds,ou=groups,dc=hackerypokery,dc=com"; // send the request to create the group WebResponse response = client.createGroup(group); // verify the response code indicates success //int status = response.getStatusCode(); //assert(status == 201); // retrieve the location of the group //String location = response.getHeaders().getFirst("Location"); // get the response stream to read the group Stream stream = response.GetResponseStream(); // create a group deserializer XmlSerializer deserializer = new XmlSerializer(typeof(Group)); // retrieve the returned group entry group = (Group)deserializer.Deserialize(stream); Console.WriteLine("created group - " + group.id); return group.id; }