My use case is as follows:
1 - A user wants to backup changes (i.e version control) to their work to their Bitbucket Repo
2 - We ask the user to provide us with the necessary credentials and to do this operation on their behalf
3 - We also ask the user for other details like the repository name, branch, etc to which this change needs to be pushed to.
4 - Every time a user does some change and wishes to save the change, we will push those to the configured repo.
My questions - Is the Atlassian Connect framework building an add-on for Bitbucket [1] the correct approach to do this or should I just go ahead an use the REST API with OAuth?
I tried following the guide [1] to build a sample add-on but the addon.authenticate() seems to fail despite providing it with the key from my user account. I get a 401 when it tries to do the JWT auth for the /connect-example endpoint.
@pratik, it doesn’t sound like you have any use for the Connect framework here, if I understand correctly that the user interface you provide is somewhere else, not embedded in bitbucket.org.
You should be able to build this integration using the Bitbucket REST API and OAuth 2.0, as you say.
So I’m going to try OAuth 2 [1] followed by creating a new commit [2]. The only way to commit seems to be with multipart/form-data or application/x-www-form-urlencoded. Would there be any way to send a body with base64 encoded content? The equivalent of
I was able to get this to work by sending the payload of the HTTP POST as x-www-form-urlencoded with the key being the path to the file and the value being the content of the file.
I had to play around the API a bit since I was trying to push to a specific branch and the documentation did not describe a way to do it.
Could you please share me code snippet, As i am unable to store the file contents into Bitbucket Repo. as you have mentioned bitbucket API documentation does not given clarity on this.