I need to list out the contents of a bitbucket branch. I am able to see the branch when I run the below code but am unable to figure out how to enter the branch. Giving the branch id is also not helping. The code so far:
package com.bitbucket.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
//import com.atlassian.bitbucket.branch.model.*;
public class BitBucketPluginTest {
public static void main(String[] args) throws Exception {
URL bb = new URL("https://api.bitbucket.org/2.0/repositories/{reponame}");
URLConnection bbcon = bb.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
bbcon.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
I have removed the repo name due to security issues. I am getting the data in JSON format currently. Any guidance is appreciated.
Use the start
argument to the GET a list of changesets endpoint:
https://api.bitbucket.org/1.0/repositories/jespern/django-piston/changesets?start=0.2.2-maint