Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

API Reference

Ramin Moradi edited this page Jul 20, 2025 · 1 revision

πŸ”Œ API Reference

FCMPanel provides a comprehensive RESTful API for programmatic access to all functionality.

πŸ“± Device Management

Register Device

Register a new FCM device or update existing device information.

POST /api/devices/register
Content-Type: application/json
Authorization: Bearer YOUR_JWT_TOKEN
API-Key: YOUR_DEVICE_API_KEY

{
  "token": "fcm_device_token_here",
  "platform": "android|ios|web",
  "appVersion": "1.0.0",
  "osVersion": "Android 12",
  "deviceModel": "Samsung Galaxy S21",
  "userId": "optional_user_id"
}

Response:

{
  "success": true,
  "device": {
    "id": 123,
    "token": "fcm_device_token_here",
    "platform": "android",
    "isActive": true,
    "registeredAt": "2025-01-01T00:00:00.000Z",
    "lastActiveAt": "2025-01-01T00:00:00.000Z"
  }
}

Get Device Status

Retrieve status and information for a specific device.

GET /api/devices/status/:deviceId
Authorization: Bearer YOUR_JWT_TOKEN

Response:

{
  "success": true,
  "device": {
    "id": 123,
    "token": "fcm_device_token_here",
    "platform": "android",
    "appVersion": "1.0.0",
    "isActive": true,
    "registeredAt": "2025-01-01T00:00:00.000Z",
    "lastActiveAt": "2025-01-01T00:00:00.000Z",
    "topicSubscriptions": ["news", "updates"]
  }
}

πŸ“ SDK Examples

JavaScript/Node.js

const axios = require('axios');

class FCMPanelAPI {
  constructor(baseURL, token) {
    this.client = axios.create({
      baseURL,
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      }
    });
  }


  async registerDevice(deviceData) {
    const response = await this.client.post('/api/devices/register', deviceData);
    return response.data;
  }
}

// Usage
const api = new FCMPanelAPI('http://localhost:3000', 'your_jwt_token');

API Reference last updated: 2025

Clone this wiki locally