---
title: "Developer guide to get employee data from Oracle HCM API"
description: "Learn how to retrieve employee data from Oracle Cloud HCM using REST API. This step-by-step guide with Python code explains authentication, API endpoints, common errors, and best practices for seamless Oracle HCM integrations."
source_url: "https://www.getknit.dev/blog/developer-guide-to-get-employee-data-from-oracle-hcm-api"
page_type: "blog"
---

_This is an educational blog post from Knit's blog: “Developer guide to get employee data from Oracle HCM API”._

# Developer guide to get employee data from Oracle HCM API

Oracle Cloud HCM (Human Capital Management) offers a robust REST API that allows organizations to access, manage, and synchronize employee data efficiently. Whether you’re automating HR workflows, integrating with third-party tools, or building analytics dashboards, the Oracle HCM API provides the flexibility to do it all.

This article walks you through how to **get employee data from the** [**Oracle Cloud HCM API**](https://www.getknit.dev/integration/oracle-hcm), both for a single employee and for all employees, using Python. It’s part of our in-depth [Oracle HCM API series](https://www.getknit.dev/blog/oracle-hcm-api-directory), which also covers authentication, rate limits, and advanced integrations.

## Prerequisites

Before you start, ensure you have:

*   Access to **Oracle Cloud HCM** with the required API permissions.
*   **Client ID** and **Client Secret** for authentication.
*   A Python environment with libraries like `requests` installed.

### 1\. Get Data for One Employee

To retrieve data for a specific employee, use the endpoint below:

`GET /hcmRestApi/resources/latest/emps/{employeeId}   `

Replace `{employeeId}` with the actual employee’s ID.

### 2\. Get Data for All Employees

To fetch information for all employees, use:

`GET /hcmRestApi/resources/latest/emps   `

### 1\. Authentication

```
import requests

def get_access_token(client_id, client_secret):
    url = "https://your-instance.oraclecloud.com/oauth2/v1/token"
    payload = {'grant_type': 'client_credentials'}
    headers = {
        'Authorization': f'Basic {client_id}:{client_secret}',
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    response = requests.post(url, data=payload, headers=headers)
    return response.json().get('access_token')
```

### 2\. Get Data for One Employee

```
def get_employee(employee_id, access_token):
    url = f"https://your-instance.oraclecloud.com/hcmRestApi/resources/latest/emps/{employee_id}"
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(url, headers=headers)
    return response.json()
```

### 3\. Get Data for All Employees

```
def get_all_employees(access_token):
    url = "https://your-instance.oraclecloud.com/hcmRestApi/resources/latest/emps"
    headers = {'Authorization': f'Bearer {access_token}'}
    response = requests.get(url, headers=headers)
    return response.json()
```

## Common Pitfalls

Integrating with Oracle Cloud HCM can be tricky if you overlook small details. Here are some common pitfalls to avoid:

1.  Using incorrect or incomplete endpoint URLs.
2.  Failing to refresh **expired access tokens**.
3.  Lacking sufficient API access permissions.
4.  Using invalid or malformed employee IDs.
5.  Ignoring **pagination** for large datasets.
6.  Hitting **rate limits** during bulk operations.
7.  Network or SSL configuration issues.

**Pro Tip:** Always test endpoints in Oracle’s sandbox environment before moving to production.

## Frequently Asked Questions

**1\. How do I find my Oracle Cloud HCM instance URL?**  
You can check your Oracle Cloud dashboard or contact your system administrator.

**2\. What if I get a 401 Unauthorized error?**  
Your access token may be invalid or expired. Regenerate the token and ensure your credentials are correct.

**3\. Can I filter employee data?**  
Yes, you can add query parameters (e.g., `?q=department=IT`) to filter responses.

**4\. How do I handle pagination?**  
Use the `next` link in the API response to fetch additional pages of employee records.

**5\. Is the data returned in JSON format?**  
Yes, Oracle Cloud HCM APIs return structured JSON responses.

**6\. Does Oracle provide a sandbox environment?**  
Yes, you can request access to a sandbox for safe testing and development.

## Knit for Oracle Cloud HCM API Integration

Manually managing authentication, data mapping, and maintenance for Oracle Cloud HCM API can quickly become complex. **Knit API** simplifies this process through a unified integration layer.

By integrating once with [`Knit HRIS API`](https://www.getknit.dev/integration-categories/hrms-api), you can:

*   Access Oracle HCM data without managing tokens or rate limits.
*   Automate employee data syncs with other HR and payroll systems.
*   Reduce engineering effort and integration downtime.

With Knit, teams can focus on innovation while we handle the integration complexity, making your [Oracle Cloud HCM](https://www.getknit.dev/integration/oracle-hcm) data accessible, secure, and reliable.


## Related pages

- [How Knit works](https://md.getknit.dev/how-knit-works)
- [Unified API product](https://md.getknit.dev/products/unified-api)
