...
Code Block | ||||
---|---|---|---|---|
| ||||
curl -u userid:password http://www.example.com/user.html |
...
HTTP Bearer token 인증
OAuth 나 JWT 등에 사용하는 Bearer token 을 사용하려면 -H 옵션뒤에 'Authorization: Bearer {TOKEN}' 를 추가하며 {TOKEN} 은 실제 토큰으로 변경하면 되며 아래는 12345 라는 token 에 서버에 전송하는 예제입니다.
Code Block | ||||
---|---|---|---|---|
| ||||
curl -L -X POST -H 'Accept: application/json' -H 'Authorization: Bearer 12345' 'https://www..example.com/api/myresource' |
POST 로 data 전송
데이타 파일을 보내는 -d 옵션 뒤에 전송할 json 데이타를 적어주고 헤더를 추가하는 -H 옵션으로 "Accept: application/json" 와 "Content-Type: application/json" 를 기술합니다.
...