360 Secure SkillHub
360 安全技能中心

API Tester

该 Skill 用于测试和监控 REST/GraphQL API,支持状态码校验、JSON Schema 验证、运行 YAML 测试套件及 uptime 检查,并输出 JSON 测试结果。文件列表仅有 SKILL.md,多处引用的 scripts/api_test.py 缺失,当前无法实际执行。

jpengcheng523-netizen
jpengcheng523-netizen
热度 54.35
最近更新 2026-05-11 17:35:58
分类:开发依赖:代码执行 / 读写文件 / 第三方 API应用场景:API 集成 / 调试排错 / DevOps / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add jpeng-api-tester
Metadata
name
jpeng-api-tester
description
API testing and monitoring skill. Test REST and GraphQL APIs, validate responses, and monitor uptime.
version
1.0.0
author
jpeng
tags
["api","testing","rest","graphql","monitoring","http"]

API Tester

Test and monitor REST and GraphQL APIs with validation.

When to Use

  • User wants to test an API endpoint
  • Validate API responses
  • Monitor API uptime
  • Run API test suites

Features

  • REST APIs: GET, POST, PUT, DELETE, PATCH
  • GraphQL: Queries and mutations
  • Validation: JSON Schema, assertions
  • Monitoring: Uptime checks, alerts

Usage

Test REST endpoint

python3 scripts/api_test.py \
  --method GET \
  --url "https://api.example.com/users" \
  --expect-status 200

POST with body

python3 scripts/api_test.py \
  --method POST \
  --url "https://api.example.com/users" \
  --header "Content-Type: application/json" \
  --body '{"name": "Alice"}' \
  --expect-status 201

Validate response

python3 scripts/api_test.py \
  --method GET \
  --url "https://api.example.com/users/1" \
  --validate '{
    "type": "object",
    "required": ["id", "name"],
    "properties": {
      "id": {"type": "integer"},
      "name": {"type": "string"}
    }
  }'

Test GraphQL

python3 scripts/api_test.py \
  --graphql \
  --url "https://api.example.com/graphql" \
  --query '{ users { id name } }'

Run test suite

python3 scripts/api_test.py \
  --suite ./tests/api_tests.yaml

Monitor uptime

python3 scripts/api_test.py \
  --monitor \
  --url "https://api.example.com/health" \
  --interval 60

Output

{
  "success": true,
  "status_code": 200,
  "response_time_ms": 145,
  "response": {"id": 1, "name": "Alice"},
  "validation_passed": true
}