Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6341369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:01:13+00:00 2026-05-24T20:01:13+00:00

I want to call assembla apis from my code in android. I am able

  • 0

I want to call assembla apis from my code in android.
I am able to connect to assembla using the code given below, I am getting output in HTMl form.
but not able to understand how to use this data.

Code fragment :

HttpURLConnection conn = null;
try {

        String authentication = "username:password";
        String encoding = Base64.encodeToString(authentication.getBytes(), Base64.NO_WRAP);
        URL url = new URL("https://www.assembla.com/spaces/my_spaces");
        //URL url = new URL("https://www.assembla.com/");
         conn = (HttpURLConnection) url.openConnection();
         conn.setRequestMethod("GET");
         conn.setRequestProperty("Authorization", "Basic " + encoding);
         conn.setDoOutput(true);
         conn.connect();

        System.out.println(conn.getResponseCode()); 
        System.out.println(conn.getResponseMessage());

        InputStreamReader isr =
            new InputStreamReader(conn.getInputStream());
        BufferedReader br = new BufferedReader(isr);

        String inputLine;

        while ((inputLine = br.readLine()) != null)
            System.out.println(inputLine);

        br.close();

I am very new to android so no idea the approach i m using to call rest api is correct or not.
Please advice.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:01:15+00:00Added an answer on May 24, 2026 at 8:01 pm

    This is how I mostly make my api requests.

            HttpClient c = new DefaultHttpClient();
            HttpPost post = new HttpPost("URL");
    
            post.addHeader("ContentType","application/x-www-form-urlencoded;charset=UTF-8");
            List<NameValuePair> httpparams = new ArrayList<NameValuePair>();
    
            httpparams.add(new BasicNameValuePair("password", password));
    
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(httpparams);
            post.setEntity(entity);
    
            HttpResponse resp = c.execute(post);
    
    
            InputStream i = resp.getEntity().getContent();
            InputStreamReader ir = new InputStreamReader(i);
            BufferedReader br = new BufferedReader(ir);
    
            StringBuilder sb = new StringBuilder();
            String line = null;
    
            while ((line = br.readLine()) != null) {
                sb.append(line);
            }
    
            ir.close();
            br.close();
    
            JSONObject user = new JSONObject(sb.toString());
    

    You can add or remove parameters if you want.
    And I asume you receive a JSON Object (sb.toString())

    Edit: In this case it’s a POST , you can easily change it to GET (HttpGet)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call my .NET code from unmanaged C++. My process entrypoint is
Can you call a vb.net api function using reflection from javascript code? I just
I want to create an assembly using IronPython can call it from C#. Here
I want to call a function from a .NET DLL (coded in C#) from
I want to call a c# function from my javascript function. I have a
I want to call some RESTful web services from a J2ME client running on
I want to call an ASHX file and pass some query string variables from
If you want to call a C/C++ function from inline assembly, you can do
I want to call managed code if and only if the currently executing assembly
my application want to call a method of a class that is from another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.