I'm using PowerShell's Invoke-WebRequest applet to make a basic authenticated connection to the bitbucket REST API. I Want to get a json snippet file.
Error Message: Access Denied.
__________________________________________________________________________________
$bitBucketUsername = "Email"
$bitBucketPassword = "XXXX"
$pair = "$($bitBucketUsername):$($bitBucketPassword)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$response2 =
Invoke-WebRequest
-Method Get
-Uri 'https://api.bitbucket.org/2.0/snippets/UserID/EncodedID/files/XX.JSON'
-Headers @{ 'Authorization' = $($basicAuthValue)}
_________________________________________________________________________________
I also tried generating a PSCredential Object but it's not working.
If a try to connect to the API via Postman using my $basicAuthValue as an Authorization Header seems to be working fine, so it make me guess that the issue is the connection with powershell and not how I'm generating my credentials.
we use this poweshell module. takes care of most of the interaction with the Atlassian tools:
Hi, thanks for your answer.
It says: Page not found
Do you have access to the readme file?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
looks like i pasted the url with an extra space ... you can either click or copy paste the URL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I've got the project now, but on the Readme file - installation part is empty.
How can I add it to my project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found it, thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Install the module:
Install-Module BitbucketPS
Import in you PS script:
Import-Module BitbucketPS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry but when I try to do
Install-Module BitbucketPS
I'm getting an error, It says no Match was found for the specified search criteria. Also I can't find the BitbucketPS module in PsGallery website. I only found "PS.Bitbucket".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Krishnanand Nayakhi. There is no such known Module for Powershell in PS Gallery, with the name you have provided - 'BitbucketPS'
Either it is removed/revoked, or it have never existed. Or there is an additional module source, that need to be added.
Could you please provide a valid link to the module or answer an initial question, how to correctly connect to BitBucket using Powershell - either API or standard Invoke-RestMethod?
Thanks a lot for answer (i hope it will happen).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you go to the URL that i mentioned above?
i don't own that PS module so if the module is not present in the gallery, you might want to reach out to the group who maintains it.
If you search the gallery, there are other bitbucket modules, have you tried them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes i tried, there is nothing about installation.
I found some in PS Gallery, but none of those modules met my requirements/needs.
P.S. Did you try to install this module by yourself on a clean machine, before supposing it to others?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am user of their other modules, hence i recommended. If none of the solutions work then here is an opportunity to build one :)
and the answer to the other question is No, i use their other modules and hence recommended. Di you try reaching out to atlassianps team?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.