curl

created : 2022-09-02T12:47:51+00:00
modified : 2022-09-02T12:59:14+00:00

curl tool

참고자료

  • https://www.lesstif.com/software-architect/curl-http-get-post-rest-api-14745703.html
  • 간단한것만 기술, 더 자세한건 참고자료에서 확인

파일 다운

curl -o <filename> <url>
curl -O <url>

For REST API

  • -L : follow redirect, -v : verbose, -H : Header

Basic

curl -L <url> | jq .

With Auth

curl -v -L -H 'Authorization: Bearer <token>' <url>

Change method

curl -v -L -X POST <url>

File

curl -T <filename> <url> # method 랑 조합해서 사용할것

Form

curl -d "foo=bar&x=y" <url> # 자동으로 POST 로 처리