انتقل إلى المحتوى الرئيسي

Transactions API

Base URL: /api/transactions Module: Inventory Authentication: Required Content-Type: application/json

Overview

The Transactions API provides read-only access to the complete transaction history across all transaction types (Movement, Adjustment, Assembly, Sale, Purchase). This API enables querying, filtering, and retrieving transaction details for audit trails, reporting, and operational analysis.

Key Features:

  • Query transaction history with flexible filtering
  • Retrieve complete transaction details including line items
  • Filter by type, date range, location, item, or user
  • Support for pagination and sorting
  • Hierarchical location filtering (includes descendants)

Endpoints

1. Get Paginated Transaction Summaries

Retrieves a paginated list of transaction summaries with flexible filtering.

Endpoint: GET /api/transactions

Query Parameters

ParameterTypeRequiredDescription
pageNumberintegerNoPage number (default: 1)
pageSizeintegerNoItems per page (default: 20, max: 100)
sortBystringNoField to sort by (default: "Timestamp")
sortDirectionstringNo"asc" or "desc" (default: "desc")
typeintegerNoTransaction type ID (1=Purchase, 2=Sale, 3=Movement, 4=Adjustment, 5=Assembly)
startDatedatetimeNoStart of date range (ISO 8601)
endDatedatetimeNoEnd of date range (ISO 8601)
locationIdguidNoFilter by location (includes child locations)
itemIdguidNoFilter by item
userIdguidNoFilter by user who created transaction
searchstringNoText search across reason and external reference

Success Response (200 OK)

{
"items": [
{
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "Movement",
"type_id": 3,
"timestamp": "2024-10-23T10:30:00Z",
"user_id": "user-123",
"user_name": "John Doe",
"reason": "Weekly restocking",
"external_reference": "TRANSFER-2024-001",
"line_item_count": 5,
"total_quantity": 150.00,
"locations": {
"source": "Main Warehouse",
"destination": "Retail Store 01"
}
},
{
"transaction_id": "4gb96g75-6828-5673-c4gd-3d074g77bgb7",
"type": "Adjustment",
"type_id": 4,
"timestamp": "2024-10-23T09:15:00Z",
"user_id": "user-456",
"user_name": "Jane Smith",
"reason": "Cycle count correction",
"external_reference": "CC-2024-Q4-001",
"line_item_count": 1,
"total_quantity": 5.00,
"location": "Main Warehouse - Zone A"
}
],
"page_number": 1,
"page_size": 20,
"total_count": 156,
"total_pages": 8,
"has_previous": false,
"has_next": true
}

Request Example

GET /api/transactions?type=3&startDate=2024-10-01&pageSize=50&sortDirection=desc
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

2. Get Transaction Details by ID

Retrieves complete details of a specific transaction including all line items and type-specific information.

Endpoint: GET /api/transactions/{id}

Path Parameters

ParameterTypeRequiredDescription
idguidYesTransaction unique identifier

Success Response (200 OK)

Movement Transaction:

{
"transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "Movement",
"type_id": 3,
"timestamp": "2024-10-23T10:30:00Z",
"user_id": "user-123",
"user_name": "John Doe",
"reason": "Weekly restocking",
"external_reference": "TRANSFER-2024-001",
"created_date": "2024-10-23T10:30:00Z",
"modified_date": "2024-10-23T10:30:00Z",
"movement_details": {
"source_location_id": "loc-source-123",
"source_location_name": "Main Warehouse",
"destination_location_id": "loc-dest-456",
"destination_location_name": "Retail Store 01",
"movement_reference": "TRANSFER-2024-001",
"notes": "Urgent delivery requested"
},
"line_items": [
{
"line_item_id": "line-1",
"item_id": "item-abc",
"item_number": "WIDGET-001",
"item_name": "Premium Widget",
"quantity": 50.00,
"unit_of_measure_id": "unit-each",
"unit_symbol": "EA",
"notes": "Handle with care"
},
{
"line_item_id": "line-2",
"item_id": "item-def",
"item_number": "GADGET-002",
"item_name": "Standard Gadget",
"quantity": 100.00,
"unit_of_measure_id": "unit-each",
"unit_symbol": "EA",
"notes": null
}
]
}

Adjustment Transaction:

{
"transaction_id": "4gb96g75-6828-5673-c4gd-3d074g77bgb7",
"type": "Adjustment",
"type_id": 4,
"timestamp": "2024-10-23T09:15:00Z",
"user_id": "user-456",
"user_name": "Jane Smith",
"reason": "Cycle count correction",
"external_reference": "CC-2024-Q4-001",
"adjustment_details": {
"location_id": "loc-warehouse",
"location_name": "Main Warehouse - Zone A",
"is_positive_adjustment": false
},
"line_items": [
{
"line_item_id": "line-adj-1",
"item_id": "item-xyz",
"item_number": "PART-789",
"item_name": "Industrial Part",
"quantity": 5.00,
"unit_of_measure_id": "unit-kg",
"unit_symbol": "kg",
"notes": "Found 5kg less than expected"
}
]
}

Assembly Transaction:

{
"transaction_id": "5hc07hc9-7940-6895-e7jh-6h418j00eje0",
"type": "Assembly",
"type_id": 5,
"timestamp": "2024-10-23T14:00:00Z",
"user_id": "user-789",
"user_name": "Production Manager",
"reason": "Production order #PO-2024-156",
"external_reference": "WO-5678",
"assembly_details": {
"bill_of_material_id": "bom-123",
"bom_name": "Office Chair Assembly v2.0",
"assembly_item_id": "item-chair",
"assembly_item_number": "CHAIR-001",
"assembly_item_name": "Office Chair - Executive",
"quantity_produced": 50.00,
"unit_of_measure_id": "unit-each",
"unit_symbol": "EA",
"assembly_location_id": "loc-production",
"assembly_location_name": "Assembly Line 1"
},
"line_items": [
{
"item_id": "item-seat",
"item_number": "SEAT-001",
"item_name": "Chair Seat",
"quantity": 50.00,
"unit_symbol": "EA"
},
{
"item_id": "item-wheels",
"item_number": "WHEEL-001",
"item_name": "Caster Wheel",
"quantity": 250.00,
"unit_symbol": "EA"
}
]
}

Error Responses

404 Not Found:

{
"message": "Transaction not found with ID: 3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

3. Get Transaction Types

Retrieves all available transaction types for filtering.

Endpoint: GET /api/transactions/types

Success Response (200 OK)

[
{ "id": 1, "name": "Purchase" },
{ "id": 2, "name": "Sale" },
{ "id": 3, "name": "Movement" },
{ "id": 4, "name": "Adjustment" },
{ "id": 5, "name": "Assembly" }
]

Usage Examples

Example 1: Query Recent Movements

curl -X GET "https://api.your-domain.com/api/transactions?type=3&startDate=2024-10-01&pageSize=25" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"

Example 2: Search Transactions by Reference

curl -X GET "https://api.your-domain.com/api/transactions?search=PO-2024" \
-H "Authorization: Bearer YOUR_TOKEN"

Example 3: Get Transaction Details

curl -X GET "https://api.your-domain.com/api/transactions/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
-H "Authorization: Bearer YOUR_TOKEN"


Last Updated: 2025-10-23 | Version: 1.0 | Status: Production Ready