สร้างสรรค์ด้วย Unity SME Suite API

API และ SDK ที่ทรงพลังสำหรับการพัฒนาแอปพลิเคชันธุรกิจ รองรับ REST API, OAuth 2.0, SAML 2.0 และ TypeScript SDK

ภาพรวม API

API ที่ออกแบบมาเพื่อนักพัฒนา พร้อมเอกสารครบถ้วน

RESTful API

API ที่ออกแบบตามมาตรฐาน REST พร้อม JSON response และ HTTP status codes ที่ชัดเจน

การยืนยันตัวตนที่ปลอดภัย

รองรับ OAuth 2.0, SAML 2.0, และ JWT tokens สำหรับการยืนยันตัวตนที่ปลอดภัย

เอกสาร OpenAPI

เอกสาร API แบบ interactive ด้วย Swagger UI พร้อมตัวอย่างและ schema ครบถ้วน

ขั้นตอนการยืนยันตัวตน

เข้าใจวิธีการทำงานของระบบ SSO

1

เริ่มต้นการยืนยันตัวตน

แอปพลิเคชันของคุณเริ่มต้น OAuth หรือ SAML flow โดยการ redirect ผู้ใช้ไปยัง Unity SSO

2

ผู้ใช้ยืนยันตัวตน

ผู้ใช้เข้าสู่ระบบผ่าน Identity Provider (Google, Microsoft, LINE, หรือ SAML IdP)

3

รับ Authorization Code

หลังจากยืนยันตัวตนสำเร็จ ระบบจะ redirect กลับพร้อม authorization code

4

แลกเปลี่ยน Token

แอปพลิเคชันแลกเปลี่ยน code เป็น access token และ refresh token

5

เข้าถึง API

ใช้ access token เพื่อเรียก Unity SME Suite API endpoints

Unity Open SDK

TypeScript/JavaScript SDK สำหรับการพัฒนาที่รวดเร็วยิ่งขึ้น

ติดตั้ง

npm install @unity-sme/open-sdk

เริ่มต้นอย่างรวดเร็ว

Web Application

import { UnitySsoClient } from '@unity-sme/open-sdk';

const ssoClient = new UnitySsoClient({
  apiUrl: 'https://api.unity-sme-suite.com',
  tenantId: 'your-tenant-id',
});

// เริ่มต้น Google Login
const loginUrl = await ssoClient.initiateOAuthLogin('google');
window.location.href = loginUrl;

// จัดการ callback
const { code, state } = getCallbackParams();
const result = await ssoClient.handleOAuthCallback(code, state);
console.log('ผู้ใช้:', result.user);

React Native

import { UnitySsoClient, SecureStorageAdapter } from '@unity-sme/open-sdk';

const ssoClient = new UnitySsoClient({
  apiUrl: 'https://api.unity-sme-suite.com',
  tenantId: 'your-tenant-id',
  storage: new SecureStorageAdapter(),
});

// เริ่มต้น LINE Login
const loginUrl = await ssoClient.initiateOAuthLogin('line');
const result = await openAuthSessionAsync(loginUrl);

if (result.type === 'success') {
  const auth = await ssoClient.handleOAuthCallback(
    result.params.code,
    result.params.state
  );
}

คุณสมบัติของ SDK

Type-Safe API Client

TypeScript definitions ครบถ้วนสำหรับ IntelliSense

Single Sign-On (SSO)

รองรับ SAML 2.0, OAuth 2.0 (Google, Microsoft, LINE)

Automatic Token Refresh

จัดการ session และ refresh tokens อัตโนมัติ

CORS & Credentials

กำหนดค่า cross-origin requests อัตโนมัติ

Request Interceptors

Customize requests และ responses

Rate Limiting

Built-in rate limit handling

Webhook Validation

ตรวจสอบ webhook signatures

Custom Storage

รองรับ localStorage, SecureStorage, custom adapters

33+ API Resources

ครอบคลุมทุกความต้องการทางธุรกิจ

Core Resources

  • Auth
    ยืนยันตัวตนและ SSO
  • Tenants
    จัดการผู้เช่า
  • Users
    จัดการผู้ใช้
  • Roles
    บทบาทและสิทธิ์
  • Permissions
    การอนุญาต

Business Resources

  • Products
    จัดการสินค้า
  • Orders
    ออเดอร์และการขาย
  • Customers
    ลูกค้าและที่อยู่
  • Inventory
    คลังสินค้า
  • Invoices
    ใบแจ้งหนี้
  • Payments
    การชำระเงิน

Accounting Resources

  • Accounts
    ผังบัญชี
  • Journal Entries
    รายการบัญชี
  • Tax
    ภาษีและ e-Tax
  • Reports
    รายงานการเงิน

System Resources

  • Subscriptions
    แพ็กเกจและบิล
  • Modules
    โมดูลและฟีเจอร์
  • API Keys
    คีย์ API
  • Webhooks
    เว็บฮุค
  • Audit Logs
    บันทึกการตรวจสอบ

รองรับทุกแพลตฟอร์ม

เวอร์ชัน 1.1.0 • npm install @unity-sme/open-sdk

🌐

Web Applications

Next.js, React, Vue.js, Angular

📱

Mobile Apps

React Native, Expo

⚙️

Backend Services

Node.js, Express, NestJS

Advanced Features

Powerful utilities for common development tasks

Pagination

Built-in pagination helpers with async iterators

import { paginateAll } from '@unity-sme/open-sdk';

for await (const customer of paginateAll(
  (params) => sdk.customers.list(params),
  { pageSize: 100 }
)) {
  console.log(customer.name);
}

Batch Operations

Process multiple items efficiently

import { batchProcess } from '@unity-sme/open-sdk';

await batchProcess(
  customerIds,
  (ids) => sdk.customers.bulkUpdate(ids, { status: 'ACTIVE' }),
  { batchSize: 50 }
);

Error Handling

Type-safe error handling with custom error classes

try {
  const product = await sdk.products.get('prod-123');
} catch (error) {
  if (error.code === 'NOT_FOUND') {
    console.log('Product not found');
  } else if (error.code === 'UNAUTHORIZED') {
    console.log('Invalid API key');
  }
}

สำรวจ API แบบ Interactive

ทดลองใช้ API endpoints ได้ทันทีด้วย Swagger UI

Swagger UI

เอกสาร API แบบ interactive พร้อมตัวอย่างและการทดสอบ endpoints

เปิด API Explorer