Developer Guide

Hướng dẫn và best practices khi phát triển với Cloudjet API và SDK.

Guidelines

🔐

Xác thực và Bảo mật

  • Sử dụng API key trong header Authorization
  • Luôn sử dụng HTTPS cho mọi request
  • Không chia sẻ API key với bên thứ ba
  • Thay đổi API key định kỳ

Rate Limiting

  • Giới hạn 10,000 requests/phút/API key
  • Sử dụng caching để giảm số lượng request
  • Xử lý lỗi 429 (Too Many Requests)
  • Implement retry mechanism với exponential backoff
🚨

Error Handling

  • Luôn kiểm tra HTTP status code
  • Xử lý lỗi một cách graceful
  • Log lỗi chi tiết để debug
  • Implement circuit breaker pattern

Best Practices

Pagination

Sử dụng cursor-based pagination để hiệu suất tốt nhất với dữ liệu lớn.

                    // Example request
GET /api/v1/products?limit=10&cursor=eyJpZCI6MTAwfQ==

// Example response
{
  "data": [...],
  "next_cursor": "eyJpZCI6MTEwfQ==",
  "has_more": true
}
                  

Filtering

Sử dụng query parameters để lọc dữ liệu theo nhiều tiêu chí.

                    // Example request
GET /api/v1/orders?status=processing&from=2024-01-01&to=2024-12-31

// Multiple values
GET /api/v1/products?category[]=electronics&category[]=accessories
                  

Bulk Operations

Sử dụng bulk operations để tối ưu hiệu suất khi xử lý nhiều items.

                    // Example bulk create
POST /api/v1/products/bulk
{
  "items": [
    { "name": "Product 1", "price": 100 },
    { "name": "Product 2", "price": 200 }
  ]
}
                  

Môi trường

Development

https://dev-api.cjs.vn

Môi trường phát triển và test

Staging

https://staging-api.cjs.vn

Môi trường kiểm thử tích hợp

Production

https://api.cjs.vn

Môi trường production

Cần hỗ trợ thêm?

Đội ngũ kỹ thuật của chúng tôi luôn sẵn sàng hỗ trợ bạn trong quá trình tích hợp.