Test Eagle Web API
Purpose
This skill installs eagle-cooltils as a global npm package (if npm is available) and provides a testing interface for the Eagle Web API. It lists all available API methods and allows users to test API calls.
Prerequisites
- •Node.js: Required for script execution
- •Eagle Application: Must be running with Web API enabled
- •API Token: Optional - eagle-cooltils automatically handles token from Eagle settings or environment
- •eagle-cooltils: Can be installed locally or used directly if available
Workflow
- •Check npm Availability: Verify npm or pnpm is installed (for local installation)
- •Consult Memory Bank: Reference
memory-bank/details/api_web_api.mdfor available methods - •List Available Methods: Display all Web API methods organized by module
- •Create Test Script: Generate Node.js script using eagle-cooltils
- •Test API: User can run the generated script to test API calls
Implementation Details
Script Language
This skill uses JavaScript/Node.js for execution:
- •No Python dependency required
- •Uses Node.js built-in modules (fs, path, child_process)
- •Can use eagle-cooltils directly if installed locally
- •Creates test scripts that use eagle-cooltils
Available Web API Methods
Based on memory-bank/details/api_web_api.md, the Eagle Web API provides:
Application Module
- •
api.application.info()- Get application information
Library Module
- •
api.library.info()- Get library information - •
api.library.history()- Get library history - •
api.library.switch(path)- Switch to a different library - •
api.library.icon(path)- Get library icon
Item Module
- •
api.item.list(params)- List items with filters (limit, offset, name, ext, tags, folders) - •
api.item.getInfo(itemId)- Get item information - •
api.item.getThumbnail(itemId)- Get item thumbnail - •
api.item.update(itemId, updates)- Update item (tags, annotation, star, etc.) - •
api.item.refreshThumbnail(itemId)- Refresh item thumbnail - •
api.item.refreshPalette(itemId)- Refresh item color palette - •
api.item.moveToTrash(itemIds[])- Move items to trash - •
api.item.addFromUrl(params)- Add item from URL - •
api.item.addFromPath(params)- Add item from file path - •
api.item.addBookmark(params)- Add bookmark - •
api.item.addFromUrls(params)- Add multiple items from URLs
Folder Module
- •
api.folder.list()- List all folders - •
api.folder.listRecent()- List recent folders - •
api.folder.create(name, parentId)- Create new folder - •
api.folder.rename(folderId, newName)- Rename folder - •
api.folder.update(folderId, updates)- Update folder (name, description, color)
Implementation Details
Global Installation
bash
# Install eagle-cooltils globally npm install -g eagle-cooltils # or pnpm add -g eagle-cooltils
API Connection
typescript
import { EagleWebApi } from 'eagle-cooltils/universal';
// Token is automatically handled by eagle-cooltils
const api = new EagleWebApi({
baseUrl: 'http://localhost:41595',
});
Testing Pattern
- •Create API instance with token
- •List available methods by module
- •Allow user to select method to test
- •Execute test call with appropriate parameters
- •Display results
Parameters
- •
method: Specific method to test (optional, lists all if not provided) - •
base_url: Base URL for API (default: http://localhost:41595)
Error Handling
- •Check npm/pnpm availability
- •Handle installation failures gracefully
- •Handle connection errors (Eagle not running, wrong port)
- •Provide clear error messages for API failures
- •Verify API endpoint is accessible
Output
- •Installation status of eagle-cooltils
- •List of all available Web API methods organized by module
- •Test results for selected API methods
- •Error messages if API calls fail
Documentation Reference
- •Web API Documentation:
memory-bank/details/api_web_api.md - •eagle-cooltils Package:
memory-bank/details/package_eagle_cooltils.md - •Default Port:
41595 - •Base URL:
http://localhost:41595