Last active
August 29, 2015 14:26
-
-
Save yin/6011ed38f186b0af9cce to your computer and use it in GitHub Desktop.
This file contains 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
# Add a SSH-Key | |
curl -r POST -u <user[:passwd]> https://bitbucket.org/api/1.0/users/<user>/ssh-keys --data-urlencode "key=$(cat ~/.ssh/id_rsa.pub)" --data-urlencode "label=<label>" | |
# JSON object, or HTML list of errors | |
# Get list of current ssh-keys | |
curl -X GET -u <user[:passwd]> https://bitbucket.org/api/1.0/users/<user>/ssh-keys | |
# JSON array of objects, attribute 'pk' is <sshkey-id> | |
# Delete key | |
curl -X DELETE -u <user[:passwd]> https://bitbucket.org/api/1.0/users/<user>/ssh-keys/<sshkey-id> | |
# Empty response, or HTML list of arrays, formatted: <ul><li></li>...</ul> | |
# Get specific SSH-Key details | |
curl -X GET -u <user[:passwd]> https://bitbucket.org/api/1.0/users/<user>/ssh-keys/<sshkey-id> | |
# JSON object, or string "Resource not found" |
This file contains 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
# Add a SSH-Key (type "user:passwd ^D") | |
xargs curl -X POST -u '{}' https://api.github.com/user/keys --data "{\"title\": \"<title>\", \"key\": \"$(cat $HOME/.ssh/id_rsa.pub)\"}" | |
# OR | |
curl -X POST -u <user[:passwd]> https://api.github.com/user/keys --data "{\"title\": \"<title>\", \"key\": \"$(cat $HOME/.ssh/id_rsa.pub)\"}" | |
# JSON object, or JSON error | |
# Get list of given user SSH-Keys | |
curl https://api.github.com/users/<user>/keys | |
# JSON array of objects, or JSON error | |
# Get list of current SSH-Keys | |
curl -X GET -u <user[:passwd]> https://api.github.com/user/keys | |
# JSON array of objects, or JSON error | |
# Delete key | |
curl -X DELETE -u <user[:passwd] https://api.github.com/user/keys/<sshkey-id> | |
# Empty response 204 No content, or JSON error | |
# Get specific SSH-Key details | |
curl -X GET -u <user[:passwd]> https://api.github.com/user/keys/<sshkey-id> | |
# JSON object, or JSON error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment