← Back to team overview

launchpad-dev team mailing list archive

Re: Launchpad Web API - Authentication and Current State

 

Hi Colin,
Many thanks for responding.My code is below :
public class tester {
  public static void main(String[] args) throws ClientProtocolException, IOException{
    CloseableHttpClient httpclient = HttpClients.createDefault();
    HttpPost httpPost = new HttpPost("https://launchpad.net/+request-token";);    httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");    // Content-type: application/x-www-form-urlencoded
    List <NameValuePair> nvps = new ArrayList <NameValuePair>();    nvps.add(new BasicNameValuePair("oauth_customer_key", "myHPIClients"));    nvps.add(new BasicNameValuePair("oauth_signature_method", "PLAINTEXT"));    nvps.add(new BasicNameValuePair("oauth_signature", "%26"));    httpPost.setEntity(new UrlEncodedFormEntity(nvps));    CloseableHttpResponse response2 = httpclient.execute(httpPost);
    try {      System.out.println(response2.getStatusLine());      HttpEntity entity2 = response2.getEntity();      // do something useful with the response body      // and ensure it is fully consumed      EntityUtils.consume(entity2);    } finally {      response2.close();    }  }
}


On running the code, I have the following response:
HTTP/1.1 401 Unauthorized
 Regards,
Kennedy
 

    On Friday, January 22, 2016 6:04 PM, Colin Watson <cjwatson@xxxxxxxxxxxxx> wrote:
 
 

 On Fri, Jan 22, 2016 at 01:11:54PM +0000, Kennedy Torkura wrote:
> I am new to this mailing list so kindly forgive me if I ask questions
> that may have been already resolved.Currently, I am building a Java
> application to interact with launchpad web api. Though , there I have
> seen from the documentation that there is a python library, I prefer
> to use Java. My challenge now is with makingauthenticated calls, my
> setup with OAuth has been responding with 401 despite I followed the
>  signing requests guide .
> My questions are: is there any one with some experience I can leverage
> on and if the Web Api documentation is up-to-date.I will also
> appreciate any useful information. 

This hasn't changed for a while, and I believe the documentation is all
up to date.  Could you share some example code that demonstrates the
failure?

-- 
Colin Watson                                    [cjwatson@xxxxxxxxxxxxx]

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to    : launchpad-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~launchpad-dev
More help  : https://help.launchpad.net/ListHelp


 
  

Follow ups

References