Get All Employees Details from Freshteam API

Introduction

This article is a part of a series of articles covering the Freshteam API in depth, and covers the specific use case of using the Freshteam API to Get All Employees Details from Freshteam API.
You can find all the other use cases we have covered for the Freshteam API along with a comprehensive deep dive on its various aspects like authentication, rate limits etc here.

Get All Employees Details from Freshteam API

Overview

To retrieve the first name, last name, email ID, and employee ID of all employees from the Freshteam API, you can use the GET /api/employees endpoint. This endpoint allows you to list all employees and filter the response based on various query parameters.

Step-by-Step Guide

1. Set Up Authentication

Ensure you have your Freshteam API key. You will need to include this key in the authorization header of your requests.

2. Make the API Request

Use the GET /api/employees endpoint to retrieve the list of employees. You can filter the response using query parameters if needed.

3. Extract Required Information

From the response, extract the first name, last name, email ID, and employee ID of each employee.

Python Code Snippet
import requests

# Define the API endpoint and headers
url = "https://.freshteam.com/api/employees"
headers = {
    "accept": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

# Make the API request
response = requests.get(url, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    employees = response.json()
    for employee in employees:
        first_name = employee.get('first_name')
        last_name = employee.get('last_name')
        email_id = employee.get('official_email')
        employee_id = employee.get('employee_id')
        print(f"First Name: {first_name}, Last Name: {last_name}, Email ID: {email_id}, Employee ID: {employee_id}")
else:
    print(f"Failed to retrieve employees: {response.status_code}")

Knit for Freshteam API Integration

For quick and seamless access to Freshteam data, the Knit API offers a convenient solution. By integrating with Knit just once, you can streamline the entire process. Knit takes care of all the authentication, authorization, and ongoing integration maintenance, this approach not only saves time but also ensures a smooth and reliable connection to your Freshteam data.

#1 in Ease of Integrations

Trusted by businesses to streamline and simplify integrations seamlessly with GetKnit.