Subscription Management API Documentation

Base Path

/subscriptions

Endpoints

Get Subscriptions List

GET /

Query Parameters

{
  searchValue?: string,  // Search keyword
  ids?: string          // Subscription IDs list
}

Create Subscription

POST /

Request Body

{
  type: string,           // Subscription type
  schedule?: string,      // Schedule
  interval_schedule?: {   // Interval schedule
    type: string,
    value: number
  },
  name?: string,          // Name
  url: string,           // Subscription URL
  whitelist?: string,    // Whitelist
  blacklist?: string,    // Blacklist
  branch?: string,       // Branch
  dependences?: string,  // Dependencies
  pull_type?: string,    // Pull type
  pull_option?: object,  // Pull options
  extensions?: string,   // Extensions
  sub_before?: string,   // Pre-execution script
  sub_after?: string,    // Post-execution script
  schedule_type: string, // Schedule type
  alias: string,        // Alias
  proxy?: string,       // Proxy
  autoAddCron?: boolean, // Auto add cron task
  autoDelCron?: boolean  // Auto delete cron task
}

Run Subscription

PUT /run

Request Body

number[]  // Array of subscription IDs

Stop Subscription

PUT /stop

Request Body

number[]  // Array of subscription IDs

Disable Subscription

PUT /disable

Request Body

number[]  // Array of subscription IDs

Enable Subscription

PUT /enable

Request Body

number[]  // Array of subscription IDs

Get Subscription Log

GET /:id/log

Update Subscription Status

PUT /status

Request Body

{
  ids: number[],     // Array of subscription IDs
  status: string,    // Status
  pid?: string,      // Process ID
  log_path?: string  // Log path
}

Get Subscription Logs List

GET /:id/logs

Error Handling

  • All endpoints follow unified error handling mechanism
  • Successful responses return { code: 200, data: ... }
  • Error logging is handled by Winston logger

Notes

  • Parameter validation using celebrate/Joi
  • Cron expressions are validated through cron-parser
  • Supports batch operations (run, stop, enable, disable, etc.)