Get User
Retrieves detailed information about a specific user by their User ID.
Endpoint
GET /v2/users/{id}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | The unique User ID to retrieve |
Response
Returns a UserIDInfo object for the specified user.
{
"success": true,
"data": {
"userId": 1042,
"login": "jsmith",
"email": "jsmith@example.com",
"firstName": "John",
"lastName": "Smith",
"networkId": 1,
"mailboxId": 101,
"authLevel": "MailboxAdmin",
"status": "Active",
"created": "2024-03-15T10:22:00Z"
}
}
ENUMs
This endpoint uses the following ENUMs in its response. See Appendix: ENUMs for full value lists.
AuthLevel— permission level of the user (e.g.,NetworkAdmin,MailboxAdmin,MailboxUser)Status— lifecycle state of the user (e.g.,Active,Suspended,Terminated)
Code Examples
- cURL
- C#
- Java
- Node.js
- Python
curl -X GET "https://rest.ecgrid.io/v2/users/$ID" \
-H "X-API-Key: $ECGRID_API_KEY"
// .NET 10 — Retrieve a user by ID using IHttpClientFactory
public async Task<UserIdInfo?> GetUserAsync(IHttpClientFactory httpClientFactory, int userId)
{
var http = httpClientFactory.CreateClient("ECGridRest");
var response = await http.GetAsync($"https://rest.ecgrid.io/v2/users/{userId}");
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<ApiResponse<UserIdInfo>>();
return result?.Data;
}
import java.net.URI;
import java.net.http.*;
String apiKey = System.getenv("ECGRID_API_KEY");
String id = "0"; // replace with actual id
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(String.format("https://rest.ecgrid.io/v2/users/%s", id)))
.header("X-API-Key", apiKey)
.GET()
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
const apiKey = process.env.ECGRID_API_KEY;
const url = `https://rest.ecgrid.io/v2/users/${id}`;
const response = await fetch(url, {
method: 'GET',
headers: { 'X-API-Key': apiKey },
});
const data = await response.json();
console.log(data);
import os, requests
api_key = os.environ["ECGRID_API_KEY"]
headers = {"X-API-Key": api_key}
id = 0 # replace with actual id
url = f"https://rest.ecgrid.io/v2/users/{id}"
response = requests.get(url, headers=headers)
response.raise_for_status()
print(response.json())
See Also
- List Users — search and filter all users
- Get Me — retrieve the currently authenticated user
- Create User — add a new user
- Update User — modify user details