Skip to content

Instantly share code, notes, and snippets.

@bolerap
Last active November 8, 2016 06:58
Show Gist options
  • Save bolerap/f4b85fc08dcb40f505d524bcd8e1c92e to your computer and use it in GitHub Desktop.
Save bolerap/f4b85fc08dcb40f505d524bcd8e1c92e to your computer and use it in GitHub Desktop.
# Send GET request to github api to retrieve info of an github user without header
curl https://api.github.com/users/<username>
# Send GET request to github api to retrieve info of an github user with header
curl --include https://api.github.com/users/<username>
# or
curl -i https://api.github.com/users/<username>
# Send GET request with basic auth use user credential to github api to retrieve protected resources
curl --user "<username>:<password>" https://api.github.com/users/<username>
# or more secure with prompt require enter password
curl --user "<username>" https://api.github.com/users/<username>
# Dealing with https: if an api endpoint doesn't have ssl cert but its using https, we can ignore it by --insecure flag
curl --insecure https://api.abc.com/endpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment