Subscription Management API Documentation

Base Path

/subscriptions

Endpoints

Get Subscriptions List

GET /

Query Parameters

{
  searchValue?: string,  // Search keyword
  ids?: string          // JSON-encoded ID array, e.g. "[1,2]"
}

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
}

Update Subscription

PUT /

The body requires id: number, type: string, url: string and alias: string. Other fields follow the create request, but schedule_type is optional when updating. On creation, interval_schedule.value must be at least 1.

Delete Subscriptions

DELETE /

The body is an array of subscription IDs, such as [1, 2]. The optional query parameter force=true also deletes associated cron tasks, script directories and repository directories. Omitting it removes only the subscriptions.

Get Subscription Details

GET /:id

id is a numeric subscription ID. The response data contains the subscription object.

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

Query parameters accept offset (non-negative integer byte offset), limit (1–1048576 bytes) and tail (boolean). The response includes log text in data, plus offset, nextOffset, total and truncated. Use nextOffset to continue reading, rather than counting characters. See the Log API.

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.)