HTTPie CLI 설치: GET·POST 예제, 헤더·JSON body, curl 비교
http 설치 후 GET/POST·JSON 요청과 curl 대응 이해.
REST API를 터미널에서 볼 때 curl은 강력하지만 플래그가 많습니다. HTTPie(http)는 GET/POST·헤더·JSON body를 읽기 쉬운 문법으로 보내고 JSON 응답을 기본 포맷합니다. macOS/Linux/Windows 설치, GET·POST 예제, 헤더·JSON, curl 비교를 hereink 독자용으로 정리합니다.
검색어: HTTPie CLI 설치와 GET POST JSON 요청. http 설치 후 공개 API GET·JSON POST·curl 대응을 이해하면 됩니다.
설치brew · pip · apt
요청GET · POST · JSON
비교http vs curl
HTTPie가 해결하는 것
읽기 쉬운 CLI HTTP
http GET api.example.com/users — JSON 색상·들여쓰기 기본.
jq와 조합
http GET … | jq '.data'. jq 글은 변환, HTTPie는 전송.
공식:
github.com/httpie/cli,httpie.io/docs/cli.http --version.
설치
- 1macOS
brew install httpie. - 2Linux
sudo apt install httpie또는pip install --user httpie. - 3Windows
winget install httpie.httpie또는 pip. - 4첫 GET
http GET https://httpbin.org/get.
GET·쿼리
http GET https://httpbin.org/get
http GET https://httpbin.org/get page==2 limit==10
http --body GET https://httpbin.org/uuidPOST·JSON
http POST https://httpbin.org/post name=Ada role=admin
http POST https://httpbin.org/post tags:='["go","rust"]'
http --form POST https://httpbin.org/post email=test@example.com헤더
http GET https://httpbin.org/headers Authorization:"Bearer TOKEN"HTTPie vs curl
| 목표 | HTTPie | curl |
|---|---|---|
| GET JSON | http GET url | curl -s url | jq . |
| POST JSON | http POST url name=Ada | curl -X POST -H 'Content-Type: application/json' -d '…' url |
- 맞음
- 수동 API 탐색, README 예제, jq와 JSON 디버깅.
- 안 맞음
- 복잡 OAuth, 클라이언트 인증서, 브라우저 쿠키 재현.
http vs httpie?
패키지 httpie, 실행 파일 http.
스크립트 출력?
--body, --print=b, --check-status.
curl 완전 대체?
일상 JSON REST는 HTTPie, 레거시·저수준은 curl 병행.