curl-http

GitHub

提供 curl 和 HTTPie 命令行工具的 API 测试指南,涵盖 GET/POST 请求、认证、文件上传及调试技巧。

data/skills-md/1mangesh1/dev-skills-collection/curl-http/SKILL.md NeverSight/learn-skills.dev

Trigger Scenarios

test API make HTTP request curl POST send request test endpoint debug API

Install

npx skills add NeverSight/learn-skills.dev --skill curl-http -g -y
More Options

Non-standard path

npx skills add https://github.com/NeverSight/learn-skills.dev/tree/main/data/skills-md/1mangesh1/dev-skills-collection/curl-http -g -y

Use without installing

npx skills use NeverSight/learn-skills.dev@curl-http

指定 Agent (Claude Code)

npx skills add NeverSight/learn-skills.dev --skill curl-http -a claude-code -g -y

安装 repo 全部 skill

npx skills add NeverSight/learn-skills.dev --all -g -y

预览 repo 内 skill

npx skills add NeverSight/learn-skills.dev --list

SKILL.md

Frontmatter
{
    "name": "curl-http",
    "description": "API testing with curl and httpie for HTTP requests. Use when user asks to \"test API\", \"make HTTP request\", \"curl POST\", \"send request\", \"test endpoint\", \"debug API\", or make any HTTP calls from command line."
}

curl & HTTPie

Command-line HTTP clients for API testing.

curl Basics

GET Request

curl https://api.example.com/users
curl -s https://api.example.com/users  # Silent
curl -i https://api.example.com/users  # Include headers

POST Request

# JSON body
curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"John","email":"john@example.com"}'

# From file
curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d @data.json

Headers & Auth

# Custom header
curl -H "Authorization: Bearer token123" https://api.example.com

# Basic auth
curl -u username:password https://api.example.com

# Multiple headers
curl -H "Content-Type: application/json" \
     -H "X-API-Key: key123" \
     https://api.example.com

Other Methods

# PUT
curl -X PUT https://api.example.com/users/1 \
  -H "Content-Type: application/json" \
  -d '{"name":"Updated"}'

# PATCH
curl -X PATCH https://api.example.com/users/1 \
  -d '{"status":"active"}'

# DELETE
curl -X DELETE https://api.example.com/users/1

File Upload

# Form upload
curl -X POST https://api.example.com/upload \
  -F "file=@photo.jpg" \
  -F "description=My photo"

# Binary
curl -X POST https://api.example.com/upload \
  --data-binary @file.bin \
  -H "Content-Type: application/octet-stream"

Useful Options

-v          # Verbose (debug)
-s          # Silent
-o file     # Output to file
-O          # Save with remote filename
-L          # Follow redirects
-k          # Ignore SSL errors
-w '\n'     # Add newline after output
--max-time 10  # Timeout in seconds

HTTPie (Friendlier Alternative)

GET Request

http https://api.example.com/users
http GET api.example.com/users  # Explicit GET

POST Request

# JSON (default)
http POST api.example.com/users name=John email=john@example.com

# String vs other types
http POST api.example.com/users name=John age:=30 active:=true

Headers & Auth

# Header
http api.example.com Authorization:"Bearer token"

# Basic auth
http -a user:pass api.example.com

# Bearer auth
http api.example.com "Authorization: Bearer token"

Output Control

http -h api.example.com   # Headers only
http -b api.example.com   # Body only
http -p Hh api.example.com  # Request headers

Common Patterns

Test Response Code

# curl
status=$(curl -s -o /dev/null -w "%{http_code}" https://api.example.com)
echo "Status: $status"

# Check if successful
if curl -s -f https://api.example.com > /dev/null; then
  echo "Success"
fi

Pretty Print JSON

curl -s https://api.example.com | jq .
curl -s https://api.example.com | python -m json.tool

Save Response & Headers

curl -D headers.txt -o response.json https://api.example.com

Retry on Failure

curl --retry 3 --retry-delay 2 https://api.example.com

Timing Info

curl -w "Time: %{time_total}s\n" -o /dev/null -s https://api.example.com

GraphQL

curl -X POST https://api.example.com/graphql \
  -H "Content-Type: application/json" \
  -d '{"query": "{ users { id name } }"}'

Debug

# Verbose output
curl -v https://api.example.com

# Trace (very detailed)
curl --trace - https://api.example.com

# Show only response headers
curl -I https://api.example.com

Version History

  • e0220ca Current 2026-07-05 20:42

Same Skill Collection

data/skills-md/00prabalk00/claude-skills/knowledge-base-gap-finder/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-agile/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-auth/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-issues/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-project-management/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-projects/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-safe/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-search/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-spaces/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-transitions/SKILL.md
data/skills-md/0731coderlee-sudo/wechat-publisher/wechat-publisher/SKILL.md
data/skills-md/0froq/skills/conventionalcommits/SKILL.md
data/skills-md/0froq/skills/nuxt/SKILL.md
data/skills-md/0froq/skills/oq/SKILL.md
data/skills-md/0froq/skills/pinia/SKILL.md
data/skills-md/0froq/skills/pnpm/SKILL.md
data/skills-md/0froq/skills/slidev/SKILL.md
data/skills-md/0froq/skills/tsdown/SKILL.md
data/skills-md/0froq/skills/turborepo/SKILL.md
data/skills-md/0froq/skills/unocss/SKILL.md
data/skills-md/0froq/skills/vitepress/SKILL.md
data/skills-md/0froq/skills/vitest/SKILL.md
data/skills-md/0froq/skills/vue-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-router-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-testing-best-practices/SKILL.md
data/skills-md/0froq/skills/vue/SKILL.md
data/skills-md/0froq/skills/vueuse-functions/SKILL.md
data/skills-md/0froq/skills/web-design-guidelines/SKILL.md
data/skills-md/0juano/agent-skills/bondterminal-x402/SKILL.md
data/skills-md/0juano/agent-skills/edgeone-pages-deploy/SKILL.md
data/skills-md/0juano/agent-skills/ley-ar/SKILL.md
data/skills-md/0juano/agent-skills/ticktick/SKILL.md
data/skills-md/0juano/agent-skills/x-image-cards/SKILL.md
data/skills-md/0juano/x-image-cards/x-image-cards/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/generate2dsprite/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/video2dsprite/SKILL.md
data/skills-md/0x2e/superpowers/brainstorming/SKILL.md
data/skills-md/0x2e/superpowers/dispatching-parallel-agents/SKILL.md
data/skills-md/0x2e/superpowers/executing-plans/SKILL.md
data/skills-md/0x2e/superpowers/finishing-a-development-branch/SKILL.md
data/skills-md/0x2e/superpowers/receiving-code-review/SKILL.md
data/skills-md/0x2e/superpowers/requesting-code-review/SKILL.md
data/skills-md/0x2e/superpowers/subagent-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/systematic-debugging/SKILL.md
data/skills-md/0x2e/superpowers/test-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/using-git-worktrees/SKILL.md
data/skills-md/0x2e/superpowers/using-superpowers/SKILL.md
data/skills-md/0x2e/superpowers/verification-before-completion/SKILL.md
data/skills-md/0x2e/superpowers/writing-plans/SKILL.md
data/skills-md/0x2e/superpowers/writing-skills/SKILL.md

Metadata

Files
0
Version
e4a0f95
Hash
a6cda0e7
Indexed
2026-07-05 20:42

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-05 02:23
浙ICP备14020137号-1 $Гость$