Ching Yi, Chan edited this page Mar 15, 2016 · 6 revisions
Clone this wiki locally

Welcome to the jplurk-oauth wiki!

Using JPlurk-OAuth

  1. create PlurkOAuth instance with arguments: appKey, appSecret, token and tokenSecret.
  2. invoke module by using method.
  3. call module action documented in the Plurk API 2.0

There is a executable example:

package com.google.jplurk_oauth.example;

import java.util.Properties;

import com.google.jplurk_oauth.Qualifier;
import com.google.jplurk_oauth.module.Timeline;
import com.google.jplurk_oauth.skeleton.PlurkOAuth;
import com.google.jplurk_oauth.skeleton.RequestException;

public class Example {
    public static void main(String[] args) throws RequestException {
        Properties prop = System.getProperties();
        /* create oauth config */
        PlurkOAuth auth = new PlurkOAuth(
                prop.getProperty("appkey"), prop.getProperty("appsecret"), 
                prop.getProperty("token"), prop.getProperty("tokensecret"));
        auth.using(Timeline.class).plurkAdd("Hello JPlurk-OAuth", Qualifier.SAYS);

How to get appKey and appSecret ?

After registering your application in the Plurk App, the unique key pair will generate for your application.

How to get access-token and its secret ?

Using Plurk OAuth test console:

  1. Input your app key and app secret, and issue the Get Request Toekn command
  2. If request-token is back, you can click the Open Authorization URL button. You must authorize the access right for this application. Finally, it shows the verification code to you.
  3. Enter the verification code in the Get Access Token checking dialog.

Design Notes

We try to make it as simple as possible. There are some rules we keep in mind:

  1. API break into the different module. Each module is a section documented in the Offical API Documentation. Such as Timeline module, it resides in the com.google.jplurk_oauth.module.Timeline class.

  2. The method naming should be the same as the named action in the Offical API Documentation. It will be the great benefit to the developer who read Offical API Documentation and won't get confuse with each other.

  3. If access failure, the exception will contains the http status and messages from the Plurk Server Side.