65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Keitaro API Test Examples
|
|
# Demonstrates various API operations
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
CLI="$SCRIPT_DIR/keitaro-cli.sh"
|
|
|
|
echo "========================================="
|
|
echo "Keitaro API Skill - Test Examples"
|
|
echo "========================================="
|
|
echo ""
|
|
|
|
# Test 1: List affiliate networks
|
|
echo "1. Listing affiliate networks..."
|
|
echo "Command: $CLI networks:list"
|
|
$CLI networks:list | jq -r '.[] | "\(.id): \(.name)"' | head -5
|
|
echo ""
|
|
|
|
# Test 2: Get specific network
|
|
echo "2. Getting specific network (ID: 77)..."
|
|
echo "Command: $CLI networks:get 77"
|
|
$CLI networks:get 77 | jq '{id, name, postback_url}'
|
|
echo ""
|
|
|
|
# Test 3: List offers
|
|
echo "3. Listing offers..."
|
|
echo "Command: $CLI offers:list"
|
|
$CLI offers:list | jq -r 'if type == "array" then .[] | "\(.id): \(.name)" else "No offers found" end' | head -5
|
|
echo ""
|
|
|
|
# Test 4: List campaigns
|
|
echo "4. Listing campaigns..."
|
|
echo "Command: $CLI campaigns:list"
|
|
$CLI campaigns:list | jq -r 'if type == "array" then .[] | "\(.id): \(.name) (\(.alias))" else "No campaigns found" end' | head -5
|
|
echo ""
|
|
|
|
# Test 5: List domains
|
|
echo "5. Listing domains..."
|
|
echo "Command: $CLI domains:list"
|
|
$CLI domains:list | jq -r 'if type == "array" then .[] | "\(.id): \(.name) - \(.state)" else "No domains found" end' | head -5
|
|
echo ""
|
|
|
|
# Test 6: Get server IP
|
|
echo "6. Getting server IP..."
|
|
echo "Command: $CLI domains:ip"
|
|
$CLI domains:ip | jq .
|
|
echo ""
|
|
|
|
# Test 7: List groups
|
|
echo "7. Listing campaign groups..."
|
|
echo "Command: $CLI groups:list campaigns"
|
|
$CLI groups:list campaigns | jq -r 'if type == "array" then .[] | "\(.id): \(.name)" else "No groups found" end' | head -5
|
|
echo ""
|
|
|
|
echo "========================================="
|
|
echo "All tests completed successfully!"
|
|
echo "========================================="
|
|
echo ""
|
|
echo "You can now use the Keitaro API skill with Claude Code."
|
|
echo "Try asking: 'List all affiliate networks in Keitaro'"
|
|
echo ""
|