How to get the Branch for POSTing a Atlassian Connect request

Joost Lammers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 30, 2018

I wrote a HTML + Javascript add-on that uses Atlassian Connect v2 to retrieve files from and write them to my repository.
The addon consists of a fileview module which can edit the file you click on.

It links to the HTML page using the URL 

/index.html?repo_uuid={repo_uuid}&file_cset={file_cset}&file_path={file_path}

it can retrieve the file using

var url = '/2.0/repositories/{}/' + repoUuid + '/src/' + cset + '/' + filePath;

but according to all examples when saving I need a 'Branch' :

var formData = new FormData();
formData.append(filePath, blob);
formData.append('message', 'Comments of commit');
formData.append('parents', cset);
formData.append('branch', "?");
url: '/2.0/repositories/{}/' + repoUuid + '/src/'

When filling in a hardcoded 'Master', the file is written to the Master, but obviously I'm not always editing a file on the Master branch.

How can I get the branch from the file I'm currently editing?
I have the cset, but that's not enough...

I tried adding these, but they remain undefined.

&revision={revision}&branch={branch}&branch_name={branch_name}&branch_resolved_hash={branch_resolved_hash}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events