bitbucket-api-client-lib

SshApi

All URIs are relative to https://api.bitbucket.org/2.0

Method HTTP request Description
usersSelectedUserSshKeysGet GET /users/{selected_user}/ssh-keys  
usersSelectedUserSshKeysKeyIdDelete DELETE /users/{selected_user}/ssh-keys/{key_id}  
usersSelectedUserSshKeysKeyIdGet GET /users/{selected_user}/ssh-keys/{key_id}  
usersSelectedUserSshKeysKeyIdPut PUT /users/{selected_user}/ssh-keys/{key_id}  
usersSelectedUserSshKeysPost POST /users/{selected_user}/ssh-keys  

usersSelectedUserSshKeysGet

PaginatedSshUserKeys usersSelectedUserSshKeysGet(selectedUser)

Returns a paginated list of the user's SSH public keys. Example: ``` $ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys { \"page\": 1, \"pagelen\": 10, \"size\": 1, \"values\": [ { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"nickname\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ] } ```

Example

// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiClient;
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.invoker.Configuration;
//import com.rappi.bitbucket.client.invoker.auth.*;
//import com.rappi.bitbucket.client.api.SshApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

SshApi apiInstance = new SshApi();
String selectedUser = "selectedUser_example"; // String | This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID. 
try {
    PaginatedSshUserKeys result = apiInstance.usersSelectedUserSshKeysGet(selectedUser);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling SshApi#usersSelectedUserSshKeysGet");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
selectedUser String This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID.  

Return type

PaginatedSshUserKeys

Authorization

api_keybasicoauth2

HTTP request headers

usersSelectedUserSshKeysKeyIdDelete

usersSelectedUserSshKeysKeyIdDelete(keyId, selectedUser)

Deletes a specific SSH public key from a user's account Example: ``` $ curl -X DELETE https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} ```

Example

// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiClient;
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.invoker.Configuration;
//import com.rappi.bitbucket.client.invoker.auth.*;
//import com.rappi.bitbucket.client.api.SshApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

SshApi apiInstance = new SshApi();
String keyId = "keyId_example"; // String | The SSH key's UUID value.
String selectedUser = "selectedUser_example"; // String | This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID. 
try {
    apiInstance.usersSelectedUserSshKeysKeyIdDelete(keyId, selectedUser);
} catch (ApiException e) {
    System.err.println("Exception when calling SshApi#usersSelectedUserSshKeysKeyIdDelete");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
keyId String The SSH key's UUID value.  
selectedUser String This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID.  

Return type

null (empty response body)

Authorization

api_keybasicoauth2

HTTP request headers

usersSelectedUserSshKeysKeyIdGet

SshAccountKey usersSelectedUserSshKeysKeyIdGet(keyId, selectedUser)

Returns a specific SSH public key belonging to a user. Example: ``` $ curl https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3} { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"nickname\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ```

Example

// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiClient;
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.invoker.Configuration;
//import com.rappi.bitbucket.client.invoker.auth.*;
//import com.rappi.bitbucket.client.api.SshApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

SshApi apiInstance = new SshApi();
String keyId = "keyId_example"; // String | The SSH key's UUID value.
String selectedUser = "selectedUser_example"; // String | This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID. 
try {
    SshAccountKey result = apiInstance.usersSelectedUserSshKeysKeyIdGet(keyId, selectedUser);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling SshApi#usersSelectedUserSshKeysKeyIdGet");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
keyId String The SSH key's UUID value.  
selectedUser String This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID.  

Return type

SshAccountKey

Authorization

api_keybasicoauth2

HTTP request headers

usersSelectedUserSshKeysKeyIdPut

SshAccountKey usersSelectedUserSshKeysKeyIdPut(keyId, selectedUser, body)

Updates a specific SSH public key on a user's account Note: Only the 'comment' field can be updated using this API. To modify the key or comment values, you must delete and add the key again. Example: ``` $ curl -X PUT -H \"Content-Type: application/json\" -d '{\"label\": \"Work key\"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} { \"comment\": \"\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"Work key\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"nickname\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ```

Example

// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiClient;
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.invoker.Configuration;
//import com.rappi.bitbucket.client.invoker.auth.*;
//import com.rappi.bitbucket.client.api.SshApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

SshApi apiInstance = new SshApi();
String keyId = "keyId_example"; // String | The SSH key's UUID value.
String selectedUser = "selectedUser_example"; // String | This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID. 
SshAccountKey body = new SshAccountKey(); // SshAccountKey | The updated SSH key object
try {
    SshAccountKey result = apiInstance.usersSelectedUserSshKeysKeyIdPut(keyId, selectedUser, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling SshApi#usersSelectedUserSshKeysKeyIdPut");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
keyId String The SSH key's UUID value.  
selectedUser String This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID.  
body SshAccountKey The updated SSH key object [optional]

Return type

SshAccountKey

Authorization

api_keybasicoauth2

HTTP request headers

usersSelectedUserSshKeysPost

SshAccountKey usersSelectedUserSshKeysPost(selectedUser, body)

Adds a new SSH public key to the specified user account and returns the resulting key. Example: ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{\"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost\"}' https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/{ed08f5e1-605b-4f4a-aee4-6c97628a673e}\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"nickname\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ```

Example

// Import classes:
//import com.rappi.bitbucket.client.invoker.ApiClient;
//import com.rappi.bitbucket.client.invoker.ApiException;
//import com.rappi.bitbucket.client.invoker.Configuration;
//import com.rappi.bitbucket.client.invoker.auth.*;
//import com.rappi.bitbucket.client.api.SshApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

SshApi apiInstance = new SshApi();
String selectedUser = "selectedUser_example"; // String | This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID. 
SshAccountKey body = new SshAccountKey(); // SshAccountKey | The new SSH key object. Note that the username property has been deprecated due to [privacy changes](https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr/#removal-of-usernames-from-user-referencing-apis).
try {
    SshAccountKey result = apiInstance.usersSelectedUserSshKeysPost(selectedUser, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling SshApi#usersSelectedUserSshKeysPost");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
selectedUser String This can either be the UUID of the account, surrounded by curly-braces, for example: `{account UUID}`, OR an Atlassian Account ID.  
body SshAccountKey The new SSH key object. Note that the username property has been deprecated due to privacy changes. [optional]

Return type

SshAccountKey

Authorization

api_keybasicoauth2

HTTP request headers