apifox
Original:🇨🇳 Chinese
Translated
6 scripts
ABC Medical Cloud API Document Query Tool. Reads and queries the OpenAPI specification documents of ABC API (4209 interfaces), supports searching by module, path, and method, and automatically resolves $ref references. Usage scenarios: (1) Query API interface definitions (2) Search for interfaces with specific functions (3) Export interface document summaries (4) View interface statistics
1installs
Added on
NPX Install
npx skill4agent add abcfed/claude-marketplace apifoxTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Apifox Skill
This skill provides ABC Medical Cloud API document query functionality, which is uniformly called via .
apifox.pyEnvironment Configuration
Required Environment Variables
You need to configure the Apifox Access Token before use:
bash
# Set Apifox Access Token (required)
export APIFOX_ACCESS_TOKEN="Your Apifox Access Token"
# Set Project ID (optional, default is 4105462)
export APIFOX_PROJECT_ID="4105462"Obtain Apifox Access Token
- Log in to Apifox
- Go to Account Settings > API Access Tokens
- Create a new access token
- Copy the Token and configure it into the environment variable
Dependency Installation
bash
# Install Python dependencies
pip3 install requestsHow It Works
apifox directly calls the Apifox API via HTTP requests:
- First Use: Fetch OpenAPI documents from the Apifox API
- Local Cache: Data is saved to the folder under the plugin directory
cache/ - Persistent Cache: The cache is permanently valid, and manual refresh is required to get the latest documents
Configuration Example
bash
# Add to ~/.bashrc or ~/.zshrc
export APIFOX_ACCESS_TOKEN="apt_xxxxxxxxxxxxxxx"
export APIFOX_PROJECT_ID="4105462"
# Reload configuration
source ~/.bashrc # or source ~/.zshrcUsage
bash
./scripts/apifox <command> [parameters]Note:is a shell wrapper that automatically detects and uses the available Python interpreter (python3 or python) in the system../scripts/apifox
All commands return JSON format output by default.
API Module Description
ABC Medical Cloud API documents include the following modules:
| Module | Number of Interfaces | Description |
|---|---|---|
| api | 2506 | HTTP API interfaces |
| rpc | 1338 | RPC service interfaces |
| api-weapp | 294 | Mini Program API interfaces |
| api-device | 29 | Device interfaces |
| api-mp | 17 | Official Account interfaces |
| api-external | 14 | External interfaces |
Command List
Document Management
| Command | Description |
|---|---|
| Read the complete OpenAPI specification (about 5MB JSON) |
| Refresh/update the latest documents (shows cache status) |
| View cache status and version |
| Clear local cache (requires |
Interface Query
| Command | Description |
|---|---|
| List interface paths (supports module and method filtering) |
| Search interfaces (keyword matching) |
| Get details of a single interface (automatically resolves $ref) |
| List all modules and interface statistics |
Data Analysis
| Command | Description |
|---|---|
| Display statistical information (total interfaces, module distribution) |
| Export interface summaries (JSON/Markdown) |
Usage Examples
Query Interface Details
bash
# Get the complete definition of the specified interface
./scripts/apifox get_path \
--path "/api/global-auth/login/sms" \
--method POST
# Get the interface without resolving $ref (faster)
./scripts/apifox get_path \
--path "/api/global-auth/login/sms" \
--method POST \
--include_refs falseSearch Interfaces
bash
# Search for login-related interfaces
./scripts/apifox search_paths --keyword "login"
# Search for user-related interfaces in the api module
./scripts/apifox search_paths --keyword "user" --module api
# List all POST interfaces
./scripts/apifox list_paths --method post --limit 20Module Query
bash
# List all modules and statistics
./scripts/apifox list_modules
# List Mini Program interfaces (first 20)
./scripts/apifox list_paths --module api-weapp --limit 20Statistical Information
bash
# View basic statistics
./scripts/apifox stats
# View detailed statistics (includes module details)
./scripts/apifox stats --detailCache Management
bash
# View cache status
./scripts/apifox cache_status
# Refresh documents (force re-fetch latest data from API)
./scripts/apifox refresh_oas
# Clear cache
./scripts/apifox clear_cache --forceExport Summary
bash
# Export interface summaries of all API modules to Markdown
./scripts/apifox export_summary --module api --output api_summary.md --format markdown
# Export as JSON
./scripts/apifox export_summary --output full_summary.json --format jsonOutput Format
All commands return JSON format:
json
{
"success": true,
"data": "Returned data"
}In case of errors, it returns:
json
{
"success": false,
"error": "Error message"
}Usage with Claude
When users need to query API documents:
- Understand Requirements: Determine the interface or module to query
- Build Command: Select the appropriate command and parameters based on requirements
- Execute Script: Run using Bash tools
- Analyze Results: Parse the returned interface definitions
Example workflow:
User: "View the definition of the SMS login interface"
Claude:
1. ./scripts/apifox search_paths --keyword "login sms"
2. Find the relevant interface path from the results
3. ./scripts/apifox get_path --path "/api/global-auth/login/sms" --method POST
4. Analyze the returned request/response structurePerformance Notes
- HTTP Requests: When used for the first time or manually refreshed, data is fetched from the Apifox API via HTTP requests
- Local Cache: Data is cached in the plugin directory, no network requests are required for subsequent use
- Persistent Cache: The cache is permanently valid, and manual refresh is required to get the latest documents
- Search Performance: Based on in-memory indexing, with millisecond-level response
Data Acquisition Process
First Use
bash
# Run for the first time after configuring environment variables
./scripts/apifox stats
# Example output:
# Fetching OpenAPI documents for project 4105462 from Apifox...
# API endpoint: https://api.apifox.com/v1/projects/4105462/export/openapi
# ✓ Successfully obtained OpenAPI documents
# Number of interfaces: 4274Subsequent Uses
bash
# Load from local cache, with second-level response
./scripts/apifox stats
# Loading OpenAPI data from local cache...Manual Refresh
bash
# Force re-fetch the latest documents from the API
./scripts/apifox refresh_oas
# Example output:
# Refreshing OpenAPI documents...
# Fetching OpenAPI documents for project 4105462 from Apifox...
# ✓ Successfully obtained OpenAPI documents
# Number of interfaces: 4274View Cache Status
bash
./scripts/apifox cache_statusFile Structure
scripts/
├── apifox.py # Unified entry script
├── apifox_client.py # API document client
├── cache_manager.py # Cache manager
└── requirements.txt # Python dependencies
references/
├── openapi-structure.md # OpenAPI structure description
├── common-queries.md # Common query examples
└── api-modules.md # API module classification