List an employee's direct reports
GET
https://api.testingapis.com/api/Employees/{id}/reportsParameters 1
| Name | Type | Description |
|---|---|---|
idrequired | path · integer (int32) | Manager employee ID. |
Responses
- 200
- Employees whose managerId is this ID (an empty array if none).
- 404
- The employee does not exist.
Example
Request
curl -X GET "https://api.testingapis.com/api/Employees/1/reports"Response200 OK
[
{
"id": 2,
"firstName": "Liam",
"lastName": "Carter",
"email": "liam.carter@nimbuscloud.example.com",
"phone": "+1-555-102-1074",
"department": "Engineering",
"title": "VP of Engineering",
"salary": 225000,
"hireDate": "2010-06-14",
"managerId": 1,
"companyId": 1,
"skills": ["Distributed Systems", "Go", "Kubernetes"],
… (34 more lines)Code examples
JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/Employees/1/reports");
console.log(response.status, await response.text());Python (requests)
import requests
response = requests.request(
"GET",
"https://api.testingapis.com/api/Employees/1/reports",
allow_redirects=False,
)
print(response.status_code, response.text)Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.NEVER)
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.testingapis.com/api/Employees/1/reports"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}