Search code examples
restbitbucketbitbucket-api

Bitbucket API Public Issue Creation


Is it possible for me to have users of my website send bugs to my Bitbucket repo's Issue tracker without redirecting them to the Bitbucket page ?

I know this is possible with authentication but it seems weird that they can add an issue without authentication from the Bitbucket site but not from the API.


Solution

  • I ended up using Basic Authentication with general user.

    The user doesn't have to be part of the team so it can be any user.

    edit: its solved on my post see sending issue to bitbucket using oauth via bitbucket api

    $account_name = 'companyy';    
    $repo_slug = 'issuer';
    
    $oauth_params = array(
        'oauth_consumer_key'      => 'key',
        'oauth_consumer_secret'   => 'secret'
    );
    
    $issue = new issues();
    //this was the missing peace of the puzzle . one single line
    $issue->getClient()->addListener( new OAuthListener($oauth_params) );
    
    $issue->create($account_name, $repo_slug, array(
        'title'     => 'title 123',
        'content'   => 'coententt123 ',
        'kind'      => 'proposal',
        'priority'  => 'blocker'
        ));