🎯 Overview

Sterling Order Management System (OMS) provides powerful REST APIs that enable seamless integration with external systems, e-commerce platforms, and mobile applications. This comprehensive guide covers everything you need to know about developing robust REST APIs for Sterling OMS, including authentication, order management, inventory operations, and real-world examples.

πŸ” Secure Authentication

JWT tokens, OAuth 2.0, and API key management for secure access control.

πŸ“¦ Order Management

Create, update, track, and manage orders through comprehensive REST endpoints.

πŸ“Š Inventory Operations

Real-time inventory checks, updates, and availability management.

⚡ Performance Optimized

Caching strategies, pagination, and efficient data retrieval patterns.

πŸ” Authentication & Authorization

POST /yfs/resources/v1/authenticate

Description: Authenticate user and obtain JWT token for API access.

Request Body (JSON)
{ "loginId": "api_user", "password": "secure_password", "organizationCode": "DEFAULT" }

✅ Success Response (200 OK):

Response Body
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expiresIn": 3600, "tokenType": "Bearer", "organizationCode": "DEFAULT" }
πŸ’‘ Authentication Headers

Include the JWT token in all subsequent API calls:

HTTP Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... Content-Type: application/json Accept: application/json

πŸ“¦ Order Management APIs

POST /yfs/resources/v1/orders

Description: Create a new order in Sterling OMS.

Request Body (JSON)
{ "Order": { "CustomerEmailID": "customer@example.com", "CustomerFirstName": "John", "CustomerLastName": "Doe", "CustomerPhoneNo": "+91-9876543210", "EnterpriseCode": "DEFAULT", "DocumentType": "0001", "OrderDate": "2025-06-12T10:30:00.000Z", "OrderLines": { "OrderLine": [ { "ItemID": "LAPTOP001", "Quantity": 1, "UnitPrice": 75000.00, "PrimeLineNo": 1 } ] }, "PersonInfoBillTo": { "FirstName": "John", "LastName": "Doe", "AddressLine1": "123 Tech Street", "City": "Bangalore", "State": "Karnataka", "ZipCode": "560001", "Country": "IN" } } }

✅ Success Response (201 Created):

Response Body
{ "Order": { "OrderNo": "ORD2025061200001", "OrderHeaderKey": "20250612123456789", "Status": "Created", "TotalAmount": 75000.00, "OrderDate": "2025-06-12T10:30:00.000Z" } }
GET /yfs/resources/v1/orders/{orderNo}

Description: Retrieve order details by order number.

Example Request
GET /yfs/resources/v1/orders/ORD2025061200001 Authorization: Bearer {jwt_token}

✅ Success Response (200 OK):

Response Body
{ "Order": { "OrderNo": "ORD2025061200001", "Status": "In Progress", "OrderDate": "2025-06-12T10:30:00.000Z", "CustomerName": "John Doe", "TotalAmount": 75000.00, "OrderLines": { "OrderLine": [ { "ItemID": "LAPTOP001", "ItemDesc": "Premium Laptop", "Quantity": 1, "Status": "Scheduled" } ] } } }
PUT /yfs/resources/v1/orders/{orderNo}/status

Description: Update order status or cancel order.

Request Body (JSON)
{ "Order": { "Action": "CANCEL", "ReasonCode": "CUST_REQ", "ReasonText": "Customer requested cancellation" } }

πŸ“Š Inventory Management APIs

GET /yfs/resources/v1/inventory/availability

Description: Check real-time inventory availability for items.

Query Parameters
GET /yfs/resources/v1/inventory/availability?ItemID=LAPTOP001&ShipNode=WAREHOUSE_BNG&UnitOfMeasure=EACH

✅ Success Response (200 OK):

Response Body
{ "InventoryAvailability": { "ItemID": "LAPTOP001", "ShipNode": "WAREHOUSE_BNG", "AvailableQuantity": 25, "OnHandQuantity": 30, "ReservedQuantity": 5, "LastUpdated": "2025-06-12T15:30:00.000Z" } }
POST /yfs/resources/v1/inventory/adjust

Description: Adjust inventory quantities for stock updates.

Request Body (JSON)
{ "InventoryAdjustment": { "ItemID": "LAPTOP001", "ShipNode": "WAREHOUSE_BNG", "AdjustmentType": "INCREASE", "Quantity": 10, "ReasonCode": "STOCK_RECEIPT", "ReasonText": "New stock received from supplier" } }

πŸ› ️ Real-World Integration Examples

🌐 E-commerce Platform Integration

Example integration flow for connecting an e-commerce website with Sterling OMS:

JavaScript/Node.js Example
// Sterling OMS API Client class SterlingOMSClient { constructor(baseUrl, credentials) { this.baseUrl = baseUrl; this.credentials = credentials; this.token = null; } async authenticate() { const response = await fetch(`${this.baseUrl}/yfs/resources/v1/authenticate`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(this.credentials) }); const data = await response.json(); this.token = data.token; return this.token; } async createOrder(orderData) { if (!this.token) await this.authenticate(); const response = await fetch(`${this.baseUrl}/yfs/resources/v1/orders`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.token}`, 'Content-Type': 'application/json' }, body: JSON.stringify(orderData) }); return await response.json(); } async checkInventory(itemId, shipNode) { if (!this.token) await this.authenticate(); const response = await fetch( `${this.baseUrl}/yfs/resources/v1/inventory/availability?ItemID=${itemId}&ShipNode=${shipNode}`, { headers: { 'Authorization': `Bearer ${this.token}` } } ); return await response.json(); } } // Usage Example const omsClient = new SterlingOMSClient('https://your-oms-server.com', { loginId: 'api_user', password: 'secure_password', organizationCode: 'DEFAULT' }); // Check inventory before order creation const inventory = await omsClient.checkInventory('LAPTOP001', 'WAREHOUSE_BNG'); if (inventory.InventoryAvailability.AvailableQuantity > 0) { const order = await omsClient.createOrder(orderPayload); console.log('Order created:', order.Order.OrderNo); }
πŸ“± Mobile App Integration

Python example for mobile backend integration:

Python Flask API
import requests from flask import Flask, request, jsonify app = Flask(__name__) class SterlingOMSService: def __init__(self, base_url, credentials): self.base_url = base_url self.credentials = credentials self.token = None def get_headers(self): if not self.token: self.authenticate() return { 'Authorization': f'Bearer {self.token}', 'Content-Type': 'application/json' } def authenticate(self): response = requests.post( f'{self.base_url}/yfs/resources/v

No comments:

Post a Comment