-
Notifications
You must be signed in to change notification settings - Fork 10
Home
- create PlurkOAuth instance with arguments: appKey, appSecret, token and tokenSecret.
- invoke module by using method.
- 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);
}
}
After registering your application in the Plurk App, the unique key pair will generate for your application.
Using Plurk OAuth test console:
- Input your app key and app secret, and issue the Get Request Toekn command
- 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.
- Enter the verification code in the Get Access Token checking dialog.
We try to make it as simple as possible. There are some rules we keep in mind:
-
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.
-
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.
-
If access failure, the exception will contains the http status and messages from the Plurk Server Side.