Not signed in (Sign In)
  • What is Intervals?

    Intervals is online time, task and project management software built by and for web designers, developers and creatives. Learn more…

The Intervals Forum is Closed.
This forum has been replaced with a help section located at
We recommend checking the help section, as the forums are no longer being updated. If you have any questions, please don't hesitate to contact our support team.


Accessing intervals api through java but getting 401 error

Bottom of Page

1 to 2 of 2

    • poonamc
    • Oct 3rd 2012 edited @ 10/03/2012 8:32 am
    Editor's note: As this is a public forum, we have redacted this user's API token.

    Code i am using for accessing is as below

    import org.apache.commons.codec.binary.Base64;

    public class urlConnection{
    public static void main(String args[]) throws Exception {

    String token= API_TOKEN;
    String encoded = new String(Base64.encodeBase64(token.getBytes()));
    URL url = new URL("");
    System.setProperty("", "true");
    HttpsURLConnection httpsCon = (HttpsURLConnection) url.openConnection();
    httpsCon.addRequestProperty("Host", "");
    httpsCon.addRequestProperty("Accept", "application/xml");
    httpsCon.addRequestProperty("Authorization","Basic "+encoded);

    /*InputStream inStrm = httpsCon.getInputStream();
    System.out.println("nContent at " + url);
    int ch;
    while (((ch = != -1)){
    System.out.print((char) ch);
    System.out.println("Response Message is " + httpsCon.getResponseCode());


    What is wrong in authentication?
    • jprado
    • Oct 3rd 2012 edited @ 10/03/2012 8:33 am


    Try changing this line:

    String token= API_TOKEN;

    to this:

    String token= API_TOKEN + ":X";


Comments are closed.
For more Intervals help documentation, please visit