The Get All Users operation returns all the users in the system as a list of user objects
Request
The Get All Users request may be specified as
follows. This API call supports an array of parameters that can be
passed with the request that support paging, sorting, and
filtering. For example, ?skip=x
skips the first
"x"
number of records mentioned, ?take=x
takes only "x"
records from the result set,
?filter=srch
filters the results by the search string
specified, ?sortProperty=username
sorts by the
specific field, and ?sortDirection=descending
sorts
the column mentioned b sortProperty
in ascending or
descending order.
Method | Request URI | HTTP Version |
---|---|---|
GET |
|
HTTP/1.1 |
URI Parameters
None.
Request Headers
The following table describes request headers.
Request Header | Description |
---|---|
Authorization |
Specifies the credentials for this request. The value of this header must be set Negotiate <token>. |
Request Body
None.
Response
The response includes an HTTP status code, a set of response headers, and a response body.
Status Code
The status code is embedded in the response for this operation; if successful, it will be status code 200 (OK).
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
Response Header | Description |
---|---|
None |
None |
Response Body
The format of the response body is as follows:
Copy Code | |
---|---|
http://localhost:777/users?skip=0&take=25&sortProperty=State&sortDirection=descending&filter=o { "items": [ { "Name": "test1@test.com", "Email": "test1@test.com", "State": 1, "CreatedTime": "2012-11-21T22:15:33.153", "SubscriptionCount": 1 } ], "filteredTotalCount": 1, "totalCount": 1 } |
The following table describes the key elements of the response body:
Element Name |
Description |
Name |
A name for the user |
|
The email address of the user |
State |
Whether the user is Active |
Example
Get all users.
Copy Code | |
---|---|
public QueryResult<User> GetAllUsers(string adminServiceEndpoint) { HttpClient httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("AdminPortal:" + ”password”))))); string subscriptionEndpoint = adminServiceEndpoint + "users/"; var response = httpClient.GetAsync(subscriptionEndpoint); var resultsStr = response.Result.Content.ReadAsStringAsync().Result; var result = JsonConvert.DeserializeObject<QueryResult<User>>(resultsStr); return result; } |