API Documentation

Author: Madhushan Udeshike

Email: madushan.u@arpico.com

Phone: 0112564260

Department: IT

Version: 1.0.0

Create Date: 2025-02-05

Overview

This API provides endpoints for retrieving and updating payroll data. It supports both live and sandbox environments. The API uses Digest Authentication for security and requires specific headers for each request.

Authentication

The API uses Digest Authentication to secure endpoints. Clients must provide valid credentials in the Authorization header.

Credentials

Users

Example

Authorization: Digest username="admin", realm="Protected Area", nonce="...", uri="/v1/endpoint", response="..."

Endpoints

1. Retrieve Data

Endpoint

  • Live: POST /v1/endpoint
  • Sandbox: POST /v1/sandbox/endpoint

Headers

Header Description
user The username of the requester. Must be one of the allowed users.
created Timestamp of the request in Asia/Colombo timezone (e.g., 2025-10-09T12:11:10+05:30).

Response

{
  "code": "S200",
  "message": "Success",
  "data": [
    {
      "id": 1,
      "name": "Example SBU"
    }
  ]
}

2. Update Data

Endpoint

  • Live: PUT /v1/update
  • Sandbox: PUT /v1/sandbox/update

Request Body

{
  "status": "S200",
  "data": [
    {
      "payrollno": "12345",
      "sbucod": "SBU001",
      "empno": "EMP001",
      "status": "SUCCESS",
      "reason": "Processed successfully",
      "lockin": 1696156800
    }
  ]
}

Response

{
  "code": "S200",
  "message": "All records inserted successfully",
  "inserted": 1
}

Error Codes

Code Description
E400 Invalid request or missing required fields.
E401 Unauthorized user or invalid credentials.
E403 Missing user header.
E404 Missing created header.
E405 Invalid created header format.
E406 Request time is out of bounds (±60 minutes).
E500 Database error.
S200 Success.
S204 No data found.
S207 Partial success (some records failed to insert).

Examples

1. Retrieve Data Example

POST /v1/endpoint HTTP/1.1
Host: localhost:3000
Authorization: Digest username="admin", realm="Protected Area", nonce="...", uri="/v1/endpoint", response="..."
user: liveuser
created: 2023-10-01T12:00:00+05:30
Content-Type: application/json

Response

{
  "code": "S200",
  "message": "Success",
  "data": [
    {
      "id": 1,
      "name": "Example SBU"
    }
  ]
}

2. Update Data Example

PUT /v1/update HTTP/1.1
Host: localhost:3000
Authorization: Digest username="admin", realm="Protected Area", nonce="...", uri="/v1/update", response="..."
user: liveuser
Content-Type: application/json

{
  "status": "S200",
  "data": [
    {
      "payrollno": "12345",
      "sbucod": "SBU001",
      "empno": "EMP001",
      "status": "SUCCESS",
      "reason": "Processed successfully",
      "lockin": 1696156800
    }
  ]
}

Response

{
  "code": "S200",
  "message": "All records inserted successfully",
  "inserted": 1
}

Notes