Get users of a group
OVERVIEW
API method to get users from a group. Please note that this method only gets users of an AD group, and not the system groups.
Request
GET /groups/{groupid}/users : To get all users from a specified group
/groups/{groupid}/users/{userid}: To get details of specified users from a specified group
Response
<users>
<user >
<userid>100</userid>
<firstname>Joe</firstname>
<lastname>Blow</lastname>
<email> joe@domain.com</email>
<phone>+44 (0) 207 1111 0000</phone>
<dept>marketing</dept>
<org>ORG001</org>
<location>
<addressline1> 10< addressline1>
<addressline2> some road </ addressline1>
<city> london </city>
<state> london </state>
<country> UK </country>
</location>
<experiences type="list">
<experience>golf</experience>
<experience>Accountancy</experience>
</experiences>
<social type="list">
<social name="linkedIn" value="http://linkedin.com/joeblow" />
<social name="twitter" value="http://twitter.com/joeblow" />
</social>
<img>http://imageurl.com/img</img>
<reportsto>USR001</reportsto>
<metadatalist type="list">
<metadata name="awards" value="employee of the month" />
<metadata name="sports" value="golf" />
/metadatalist>
<groups type="list">
<group>GRP001</groups>
<group> GRP002</groups>
/metadatalist>
</user>
<previouspageurl>../users/pageno=1</previouspageurl>
<nextpageurl>../users/pageno=3</nextpageurl>
<totalusers>102</totalusers>
<currentpagenumber>2</currentpagenumber>
</users>
2xx or 3xx in case of success, 4xx or 5xx in case of failure.
Body content in case of failure
<error>
<ref> Error reference code in at which full stack trace can be obtained</ref>
<summery> Details for the error </summery>
<atom:link rel="self" href="…/errors/200" /> // returns the full strack trace and other details for why the error happened
</error>
@John Hodgson thank you for sharing, appreciate your contribution.
and here is the c# classes
using System;
using System.Xml.Serialization;
using System.Collections.Generic;
namespace Xml2CSharp
{
[XmlRoot(ElementName="location")]
public class Location {
[XmlElement(ElementName="addressline1")]
public string Addressline1 { get; set; }
[XmlElement(ElementName="addressline2")]
public string Addressline2 { get; set; }
[XmlElement(ElementName="city")]
public string City { get; set; }
[XmlElement(ElementName="state")]
public string State { get; set; }
[XmlElement(ElementName="country")]
public string Country { get; set; }
}
[XmlRoot(ElementName="experiences")]
public class Experiences {
[XmlElement(ElementName="experience")]
public List
[XmlAttribute(AttributeName="type")]
public string Type { get; set; }
}
[XmlRoot(ElementName="social")]
public class Social {
[XmlAttribute(AttributeName="name")]
public string Name { get; set; }
[XmlAttribute(AttributeName="value")]
public string Value { get; set; }
}
[XmlRoot(ElementName="metadata")]
public class Metadata {
[XmlAttribute(AttributeName="name")]
public string Name { get; set; }
[XmlAttribute(AttributeName="value")]
public string Value { get; set; }
}
[XmlRoot(ElementName="metadatalist")]
public class Metadatalist {
[XmlElement(ElementName="metadata")]
public List
[XmlAttribute(AttributeName="type")]
public string Type { get; set; }
}
[XmlRoot(ElementName="groups")]
public class Groups {
[XmlElement(ElementName="group")]
public List
[XmlAttribute(AttributeName="type")]
public string Type { get; set; }
}
[XmlRoot(ElementName="user")]
public class User {
[XmlElement(ElementName="userid")]
public string Userid { get; set; }
[XmlElement(ElementName="firstname")]
public string Firstname { get; set; }
[XmlElement(ElementName="lastname")]
public string Lastname { get; set; }
[XmlElement(ElementName="email")]
public string Email { get; set; }
[XmlElement(ElementName="phone")]
public string Phone { get; set; }
[XmlElement(ElementName="dept")]
public string Dept { get; set; }
[XmlElement(ElementName="org")]
public string Org { get; set; }
[XmlElement(ElementName="location")]
public Location Location { get; set; }
[XmlElement(ElementName="experiences")]
public Experiences Experiences { get; set; }
[XmlElement(ElementName="social")]
public Social Social { get; set; }
[XmlElement(ElementName="img")]
public string Img { get; set; }
[XmlElement(ElementName="reportsto")]
public string Reportsto { get; set; }
[XmlElement(ElementName="metadatalist")]
public Metadatalist Metadatalist { get; set; }
[XmlElement(ElementName="groups")]
public Groups Groups { get; set; }
}
[XmlRoot(ElementName="users")]
public class Users {
[XmlElement(ElementName="user")]
public User User { get; set; }
[XmlElement(ElementName="previouspageurl")]
public string Previouspageurl { get; set; }
[XmlElement(ElementName="nextpageurl")]
public string Nextpageurl { get; set; }
[XmlElement(ElementName="totalusers")]
public string Totalusers { get; set; }
[XmlElement(ElementName="currentpagenumber")]
public string Currentpagenumber { get; set; }
}
}
Here is a fixed xml
Comments
3 Comments