Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use API and get errors: "errors":"Please click "Test and Save Password" button first." #83

Open
7visij7 opened this issue Mar 24, 2022 · 4 comments

Comments

@7visij7
Copy link

7visij7 commented Mar 24, 2022

Hello,
Firstly i want say - thanks for you work!
Trying to work with bitbucket api using this manual https://docs.atlassian.com/bitbucket-server/rest/7.6.3/bitbucket-rest.html, especially try to set hook with method (/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/com.trimble.tekla:teamcity-trigger-hook/settings)

And when i send data to server, get errors:
{
"errors": [
{
"context": "teamCityPassword",
"message": "Please click "Test and Save Password" button first.",
"exceptionName": null
}]}

Please, can you explain how i can avoid errors about Please click button, when using bitbucket api.
Thanks
BR visij

@jmecosta
Copy link
Collaborator

jmecosta commented Mar 24, 2022 via email

@7visij7
Copy link
Author

7visij7 commented Mar 24, 2022

Hi It's likely not supported. I've never coded any support for api change hooks. Basically for this to work we would need to have a general password in the server and then you would be able to just make changes saying the ID of the credentials So at the moment not supported

On Thu, Mar 24, 2022, 12:20 7visij7 @.> wrote: Hello, Firstly i want say - thanks for you work! Trying to work with bitbucket api using this manual https://docs.atlassian.com/bitbucket-server/rest/7.6.3/bitbucket-rest.html, especially try to set hook with method (/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings) And when i send data to server, get errors: { "errors": [ { "context": "teamCityPassword", "message": "Please click "Test and Save Password" button first.", "exceptionName": null }]} Please, can you explain how i can avoid errors about Please click button, when using bitbucket api. Thanks BR visij — Reply to this email directly, view it on GitHub <#83>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH6HSCNAB7TBZJGD5KZUALVBQ6YTANCNFSM5RQVRQWA . You are receiving this because you are subscribed to this thread.Message ID: @.>

Thanks for you answer!

@kabalerror
Copy link

@7visij7, not sure if you need this still 1.5 year later, but...
I was facing similar issue, lots of vcs roots to configure TC hook and pressing "Test and Save Password" manually is boring. Looking into source code I found that hook creates "testconnection" API endpoint.
src/main/java/com/trimble/tekla/rest/TeamctiyRest.java:446
That's the one you need to avoid using manual button press each time.
Here's a snippet of Python code , yes it's plain/text =\

import requests
r = requests.get("https://[bitbucketurl]/rest/teamcity/latest/projects/[project]/repos/[reponame]/testconnection?url=[teamcity_host]:[port]&username=[username]&password=****")

@jmecosta
Copy link
Collaborator

Nice workaroubd thanks for sharing. Likewise you can also upload thw configuration json and save from so script. Nice when u need to rotate the passworss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants