Created
November 8, 2016 04:20
-
-
Save bolerap/221e834872b9313886ae82baac662ef8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Send POST request with data to github api to create a gist | |
curl --user "<username>" --request POST --data '{"description": "Test create a github gists via api", "public": "true", "files": {"test.txt": {"content": "Hello"}}}' https://api.github.com/gists | |
# or in short | |
curl -u "<username>" -X POST -d '{"description": "Test create a github gists via api", "public": "true", "files": {"test.txt": {"content": "Hello"}}}' https://api.github.com/gists | |
# or more short, if supplied -d (data) POST method can ommited as below | |
curl -u "<username>" -d '{"description": "Test create a github gists via api", "public": "true", "files": {"test.txt": {"content": "Hello"}}}' https://api.github.com/gists | |
# Send POST request with multiple data | |
curl --data "login=<username>" --data "token=<token_string>" https://github.com/api/v2/json/user/show/<username> | |
# or combine into single --data | |
curl --data "login=<username>&token=<token_string>" https://github.com/api/v2/json/user/show/<username> | |
# Send POST request with data read from a file (@/@-) | |
curl --user "<username>" --data @file.txt https://api.github.com/gists | |
# or read from STDIN -> ctrl+d to finish enter data | |
curl --user "<username>" --data @- https://api.github.com/gists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment