mcpField
R
rocket-net-api

rocket-net-api

github.com/jezwebCloud & DevOps1.1k109 installsUpdated 3w ago
Repository

About rocket-net-api

rocket-net-api is an integration guide for developers working with the Rocket.net managed WordPress hosting API. It documents JWT authentication and endpoints for sites, backups, domains, plugins, reporting, accounts, and billing.

Key features

  1. 01JWT-based API authentication
  2. 02Create and manage WordPress sites
  3. 03Configure domains and CDN cache
  4. 04Manage plugins, themes, and files
  5. 05Create, download, and restore backups
  6. 06Access reporting and account endpoints

Use cases

  1. 01Automating site creation and updates
  2. 02Publishing a staging site to production
  3. 03Managing backups and restoring a site
  4. 04Reviewing CDN, visitor, or bandwidth reports

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/jezweb/claude-skills --skill rocket-net-api

After installing, type/rocket-net-apiin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
.claude-plugin/
plugin.json
references/
endpoints.md

Details

From the project README

Rocket.net API Integration

Build integrations with Rocket.net's managed WordPress hosting platform API. This skill covers authentication, site management, domain configuration, backups, plugins/themes, CDN cache control, and all 200+ API endpoints.

API Overview

Base URL: https://api.rocket.net/v1

Authentication: JWT token-based

  • Obtain token via POST /login with email/password
  • Token expires in 7 days
  • Include in requests as Authorization: Bearer <token>

Content Type: JSON API

  • Required header: Content-Type: application/json
  • Recommended header: Accept: application/json

Documentation: https://rocketdotnet.readme.io/reference/introduction

Authentication

Get JWT Token
const response = await fetch('https://api.rocket.net/v1/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  },
  body: JSON.stringify({
    username: '[email protected]',
    password: 'your-password'
  })
});

const { token } = await response.json();
// Use token in subsequent requests
Authenticated Request Pattern
async function rocketApiRequest(
  endpoint: string,
  options: RequestInit = {}
): Promise<any> {
  const response = await fetch(`https://api.rocket.net/v1${endpoint}`, {
    ...options,
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'Authorization': `Bearer ${token}`,
      ...options.headers
    }
  });

  if (response.status === 401) {
    // Token expired, re-authenticate
    throw new Error('Token expired - request new token');
  }

  return response.json();
}

API Endpoints by Category

Sites Management
MethodEndpointDescription
GET/sitesList all sites
POST/sitesCreate new site
GET/sites/{id}Get site details
PATCH/sites/{id}Update site properties
DELETE/sites/{id}Delete site
POST/sites/{id}/cloneClone a site (background task)
GET/sites/{id}/credentialsGet site credentials
GET/sites/{id}/usageGet site usage statistics
POST/sites/{id}/lockLock site (prevent modifications)
DELETE/sites/{id}/lockUnlock site
GET/sites/{id}/pma_loginGet phpMyAdmin SSO link
GET/sites/{id}/settingsGet site settings
PATCH/sites/{id}/settingsUpdate site settings
GET/sites/locationsList available site locations
Staging Sites
MethodEndpointDescription
POST/sites/{id}/stagingCreate staging site
DELETE/sites/{id}/stagingDelete staging site
POST/sites/{id}/staging/publishPublish staging to production
Site Templates
MethodEndpointDescription
GET/sites/templatesList site templates
POST/sites/templatesCreate site template
GET/sites/templates/{id}Get template details
DELETE/sites/templates/{id}Delete template
POST/sites/templates/{id}/sitesCreate site from template
Domains
MethodEndpointDescription
GET/sites/{id}/domainsList domain aliases
POST/sites/{id}/domainsAdd domain alias
DELETE/sites/{id}/domains/{domainId}Remove domain alias
GET/sites/{id}/maindomainGet main domain info
POST/sites/{id}/maindomainSet main domain
PUT/sites/{id}/maindomainReplace main domain
PATCH/sites/{id}/maindomainUpdate domain validation/SSL
GET/sites/{id}/maindomain/statusCheck domain status
GET/sites/{id}/maindomain/recheckForce validation recheck
GET/sites/{id}/domains/{domainId}/edge_settingsGet edge settings
PATCH/sites/{id}/domains/{domainId}/edge_settingsUpdate edge settings
CDN Cache
MethodEndpointDescription
POST/sites/{id}/cache/purgePurge specific files
POST/sites/{id}/cache/purge_everythingPurge all cache
Plugins
MethodEndpointDescription
GET/sites/{id}/pluginsList installed plugins
POST/sites/{id}/pluginsInstall plugins
PATCH/sites/{id}/pluginsActivate/deactivate plugins
PUT/sites/{id}/pluginsUpdate plugins
DELETE/sites/{id}/pluginsDelete plugins
GET/sites/{id}/plugins/searchSearch available plugins
GET/sites/{id}/featured_pluginsList featured plugins
Themes
MethodEndpointDescription
GET/sites/{id}/themesList installed themes
POST/sites/{id}/themesInstall themes
PATCH/sites/{id}/themesActivate theme
PUT/sites/{id}/themesUpdate themes
DELETE/sites/{id}/themesDelete themes
GET/sites/{id}/themes/searchSearch available themes
Backups
MethodEndpointDescription
GET/sites/{id}/backupList backups
POST/sites/{id}/backupCreate backup
GET/sites/{id}/backup/{backupId}Download backup
DELETE/sites/{id}/backup/{backupId}Delete backup
POST/sites/{id}/backup/{backupId}/restoreRestore backup
GET/sites/{id}/backup/automatedList automated backups
POST/sites/{id}/backup/automated/{restoreId}/restoreRestore automated backup
Cloud Backups
MethodEndpointDescription
GET/sites/{id}/cloud_backupsList cloud backups
POST/sites/{id}/cloud_backupsCreate cloud backup
GET/sites/{id}/cloud_backups/{backupId}Get cloud backup
DELETE/sites/{id}/cloud_backups/{backupId}Delete cloud backup
GET/sites/{id}/cloud_backups/{backupId}/downloadGet download link
POST/sites/{id}/cloud_backups/{backupId}/restoreRestore cloud backup
Files
MethodEndpointDescription
GET/sites/{id}/file_manager/filesList files
POST/sites/{id}/filesUpload file
PUT/sites/{id}/filesSave file contents
DELETE/sites/{id}/filesDelete file
GET/sites/{id}/files/viewView file contents
GET/sites/{id}/files/downloadDownload file
POST/sites/{id}/files/folderCreate folder
POST/sites/{id}/files/extractExtract archive
POST/sites/{id}/files/compressCompress files
PATCH/sites/{id}/files/chmodChange permissions
FTP Accounts
MethodEndpointDescription
GET/sites/{id}/ftp_accountsList FTP accounts
POST/sites/{id}/ftp_accountsCreate FTP account
PATCH/sites/{id}/ftp_accountsUpdate FTP account
DELETE/sites/{id}/ftp_accountsDelete FTP account
SSH Keys
MethodEndpointDescription
GET/sites/{id}/ssh_keysList SSH keys
POST/sites/{id}/ssh_keysImport SSH key
DELETE/sites/{id}/ssh_keysDelete SSH key
POST/sites/{id}/ssh_keys/authorizeActivate SSH key
POST/sites/{id}/ssh_keys/deauthorizeDeactivate SSH key
GET/sites/{id}/ssh_keys/{name}View SSH key info
WordPress
MethodEndpointDescription
GET/sites/{id}/wp_loginGet WordPress SSO link
GET/sites/{id}/wp_statusGet WordPress status
POST/sites/{id}/wpcliExecute WP-CLI command
Reporting
MethodEndpointDescription
GET/reporting/sites/{id}/cdn_requestsCDN requests report
GET/reporting/sites/{id}/cdn_cache_statusCache status report
GET/reporting/sites/{id}/cdn_cache_contentCache content report
GET/reporting/sites/{id}/visitorsVisitors report
GET/reporting/sites/{id}/waf_eventlistWAF events list
GET/reporting/sites/{id}/waf_events_sourceWAF events by source
GET/reporting/sites/{id}/waf_firewall_eventsFirewall events
GET/reporting/sites/{id}/bandwidth_usageBandwidth usage
GET/reporting/sites/{id}/bandwidth_top_usageTop bandwidth usage
GET/sites/{id}/access_logsAccess logs
Account Management
MethodEndpointDescription
GET/account/meGet user information
PATCH/account/meUpdate account settings
GET/account/usageGet account usage stats
POST/account/passwordChange password
GET/account/tasksList account tasks
GET/account/hosting_planGet current plan
PUT/account/hosting_planChange hosting plan
POST/account/billing_ssoGet billing SSO cookie
Account Users
MethodEndpointDescription
GET/usersList account users
POST/usersCreate account user
GET/users/{userId}Get user details
PATCH/users/{userId}Update user
DELETE/users/{userId}Remove user
POST/users/{userId}/reinviteResend invite
Site Users
MethodEndpointDescription
GET/sites/{id}/usersList site users
POST/sites/{id}/usersInvite site user
DELETE/sites/{id}/users/{userId}Remove site user
POST/sites/{id}/users/{userId}/reinviteResend invite
Billing
MethodEndpointDescription
GET/billing/addressesList billing addresses
POST/billing/addressesCreate billing address
GET/billing/addresses/{addressId}Get billing address
PATCH/billing/addresses/{addressId}Update billing address
DELETE/billing/addresses/{addressId}Delete billing address
GET/billing/invoicesList invoices
GET/billing/invoices/{invoiceId}Get invoice
GET/billing/invoices/{invoiceId}/pdfDownload invoice PDF
POST/billing/invoices/{invoiceId}/credit_card_paymentPay with card
GET/billing/payment_methodsList payment methods
POST/billing/payment_methodsAdd payment method
DELETE/billing/payment_methods/{methodId}Delete payment method
GET/billing/productsList available products
Additional Features
MethodEndpointDescription
GET/sites/{id}/password_protectionGet password protection status
POST/sites/{id}/password_protectionEnable password protection
DELETE/sites/{id}/password_protectionDisable password protection
GET/sites/{id}/shopshieldList ShopShield URIs
POST/sites/{id}/shopshieldEnable ShopShield
DELETE/sites/{id}/shopshield/{id}Disable ShopShield
GET/account/visitorsAccount visitor stats
GET/account/bandwidthAccount bandwidth stats

Common Patterns

List All Sites
const sites = await rocketApiRequest('/sites');
console.log(sites);
// Returns array of site objects with id, domain, status, etc.
Create a New Site
const newSite = await rocketApiRequest('/sites', {
  method: 'POST',
  body: JSON.stringify({
    name: 'my-new-site',
    location: 'us-east-1',
    // Additional options as needed
  })
});
Purge CDN Cache
// Purge specific URLs
await rocketApiRequest(`/sites/${siteId}/cache/purge`, {
  method: 'POST',
  body: JSON.stringify({
    files: [
      'https://example.com/style.css',
      'https://example.com/script.js'
    ]
  })
});

// Purge everything
await rocketApiRequest(`/sites/${siteId}/cache/purge_everything`, {
  method: 'POST'
});
Create and Restore Backup
// Create backup
const backup = await rocketApiRequest(`/sites/${siteId}/backup`, {
  method: 'POST'
});

// List backups
const backups = await rocketApiRequest(`/sites/${siteId}/backup`);

// Restore backup (background task)
await rocketApiRequest(`/sites/${siteId}/backup/${backupId}/restore`, {
  method: 'POST'
});
Manage Plugins
// List installed plugins
const plugins = await rocketApiRequest(`/sites/${siteId}/plugins`);

// Install plugin
await rocketApiRequest(`/sites/${siteId}/plugins`, {
  method: 'POST',
  body: JSON.stringify({
    plugins: ['wordfence', 'yoast-seo']
  })
});

// Update all plugins
await rocketApiRequest(`/sites/${siteId}/plugins`, {
  method: 'PUT',
  body: JSON.stringify({
    plugins: ['all']
  })
});

// Activate/deactivate plugin
await rocketApiRequest(`/sites/${siteId}/plugins`, {
  method: 'PATCH',
  body: JSON.stringify({
    plugins: ['wordfence'],
    action: 'activate' // or 'deactivate'
  })
});
Execute WP-CLI Commands
const result = await rocketApiRequest(`/sites/${siteId}/wpcli`, {
  method: 'POST',
  body: JSON.stringify({
    command: 'user list --format=json'
  })
});
WordPress SSO Login
// Get SSO link for WordPress admin
const { url } = await rocketApiRequest(`/sites/${siteId}/wp_login`);
// Redirect user to url for auto-login

TypeScript Types

interface RocketSite {
  id: number;
  name: string;
  domain: string;
  status: 'active' | 'suspended' | 'pending';
  location: string;
  created_at: string;
  updated_at: string;
}

interface RocketBackup {
  id: number;
  site_id: number;
  type: 'manual' | 'automated' | 'cloud';
  status: 'pending' | 'completed' | 'failed';
  size: number;
  created_at: string;
}

interface RocketPlugin {
  name: string;
  slug: string;
  version: string;
  status: 'active' | 'inactive';
  update_available: boolean;
}

interface RocketDomain {
  id: number;
  domain: string;
  is_main: boolean;
  ssl_status: 'pending' | 'active' | 'failed';
  validation_method: 'dns' | 'http';
}

interface RocketAuthResponse {
  token: string;
  expires_at: string;
}

Error Handling

interface RocketApiError {
  error: string;
  message: string;
  status: number;
}

async function handleRocketRequest(endpoint: string, options?: RequestInit) {
  try {
    const response = await rocketApiRequest(endpoint, options);
    return { data: response, error: null };
  } catch (error) {
    if (error.status === 401) {
      // Re-authenticate and retry
      await refreshToken();
      return handleRocketRequest(endpoint, options);
    }
    if (error.status === 404) {
      return { data: null, error: 'Resource not found' };
    }
    if (error.status === 429) {
      // Rate limited - wait and retry
      await sleep(1000);
      return handleRocketRequest(endpoint, options);
    }
    return { data: null, error: error.message };
  }
}

Background Tasks

Many operations (clone, backup restore, staging publish) run as background tasks. Monitor task status:

// Start a background task
const { task_id } = await rocketApiRequest(`/sites/${siteId}/clone`, {
  method: 'POST',
  body: JSON.stringify({ name: 'cloned-site' })
});

// Check task status
const tasks = await rocketApiRequest(`/sites/${siteId}/tasks`);
const task = tasks.find(t => t.id === task_id);
console.log(task.status); // 'pending', 'running', 'completed', 'failed'

// Cancel task if needed
await rocketApiRequest(`/sites/${siteId}/tasks/${task_id}/cancel`, {
  method: 'POST'
});

Rate Limits

The API has rate limits. Implement exponential backoff:

async function withRetry<T>(
  fn: () => Promise<T>,
  maxRetries = 3,
  delay = 1000
): Promise<T> {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (error.status === 429 && i < maxRetries - 1) {
        await new Promise(resolve => setTimeout(resolve, delay * Math.pow(2, i)));
        continue;
      }
      throw error;
    }
  }
  throw new Error('Max retries exceeded');
}

References

Comments

Markdown supported