Skip to content

API Endpoints

Base URLs

Lunar Stream cung cấp các API endpoints khác nhau cho môi trường development và production.

Môi Trường Production

https://api.xxxxxx.xxx/api/v1

Sử dụng endpoint này cho ứng dụng production.

Môi Trường Development

https://api-dev.lunarstream.kozow.com/api/v1

Sử dụng endpoint này cho development và testing.

Cấu Hình Môi Trường

Environment Variables

Chúng tôi khuyến nghị sử dụng environment variables để cấu hình API URL:

bash
# Production
LUNAR_STREAM_API_URL=https://api.xxxxxx.xxx/api/v1

# Development
LUNAR_STREAM_API_URL=https://api-dev.lunarstream.kozow.com/api/v1

Ví Dụ Code

Node.js:

javascript
const apiUrl = process.env.LUNAR_STREAM_API_URL || 'https://api.xxxxxx.xxx/api/v1';

Python:

python
import os
api_url = os.getenv('LUNAR_STREAM_API_URL', 'https://api.xxxxxx.xxx/api/v1')

PHP:

php
$apiUrl = getenv('LUNAR_STREAM_API_URL') ?: 'https://api.xxxxxx.xxx/api/v1';

Go:

go
apiURL := os.Getenv("LUNAR_STREAM_API_URL")
if apiURL == "" {
    apiURL = "https://api.xxxxxx.xxx/api/v1"
}

Java:

java
String apiUrl = System.getenv().getOrDefault(
    "LUNAR_STREAM_API_URL",
    "https://api.xxxxxx.xxx/api/v1"
);

API Versioning

Phiên bản API hiện tại là v1. Tất cả endpoints đều có prefix /api/v1.

Khi chúng tôi phát hành phiên bản API mới, chúng tôi sẽ:

  • Duy trì backward compatibility ít nhất 12 tháng
  • Cung cấp migration guides
  • Thông báo lịch trình deprecation trước

Rate Limiting

Cả hai môi trường đều có rate limits giống nhau:

  • 100 requests mỗi phút cho mỗi API Key
  • 1000 requests mỗi giờ cho mỗi API Key

Health Check

Kiểm tra tính khả dụng của API:

bash
# Production
curl https://api.xxxxxx.xxx/api/v1/health

# Development
curl https://api-dev.lunarstream.kozow.com/api/v1/health

Bước Tiếp Theo

Released under the MIT License.