content = args[3];
/**
* Create a new instance of the API
*/
Buzz buzz = new Buzz();
/**
* Get the url to authenticated the user. <br/>
* The user has to grant access to this application, to manage Buzz Content.
*/
String verificationUrl = buzz.getAuthenticationUrl( Buzz.BUZZ_SCOPE_WRITE, consumerKey, consumerSecret );
/**
* Redirect the user to the verificationUrl and read the verification code. <br/>
* The new application should implement a similar method in order to get the verification
* code from the google authentication website.<br/>
* For development, we are lunching a browser locally and manually pasting the verification
* code in the example console.
*/
String verificationCode = ExampleUtils.getVerificationCode( verificationUrl );
/**
* Set the verificationCode (A.K.A. access token) to the API to be used on the request
* signature, for authenticated requests.
*/
buzz.setAccessToken( verificationCode );
/**
* Create the content of the post
*/
BuzzContent buzzContent = new BuzzContent();
buzzContent.setText( content );
/**
* Execute API method to post an entry.
*/
BuzzFeedEntry entry = buzz.createPost( userId, buzzContent );
/**
* Print creation results
*/
System.out.println( "Entry created: " );
System.out.println( "Title: " + entry.getTitle() );
System.out.println( "Published date: " + entry.getPublished() );
System.out.println( "Updated date: " + entry.getUpdated() );
System.out.println( "Id: " + entry.getId() + "\n" );
/**
* Update values of the returned entry object
*/
entry.setTitle( entry.getTitle() + ". UPDATED!" );
entry.getContent().setText( entry.getContent().getText() + ". UPDATED!" );
/**
* Execute API method to post an entry.
*/
BuzzFeedEntry entryUpdated = buzz.updatePost( userId, entry.getId(), entry.getContent() );
/**
* Print update results
*/