Adding a post to blogger using Google API
How to create a post on blogger using Google API.
Google API jar file required : gdata-core1.0.jar . Download this jar and add to the class library.
-->How to create a post on blogger using Google API.
Google API jar file required : gdata-core1.0.jar . Download this jar and add to the class library.
A sample Code here...
import com.google.gdata.client.GoogleService;
import com.google.gdata.data.Entry;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.util.ServiceException;
import java.io.IOException;
import java.net.URL;
public class Blogger{
public static void createPost(GoogleService myService) throws ServiceException, IOException {
// Create the entry to insert
Entry myEntry = new Entry();
// POST Title
myEntry.setTitle(new PlainTextConstruct("INDIA DEFEATED PAKISTAN "));
// Post description
myEntry.setContent(new PlainTextConstruct("INDIA Defeated pakistan in only 4 seconds . Hindustan Jindabad "));
// Blogger URL
URL postUrl = new URL("http://allindiatelevision.blogspot.in");
myService.insert(postUrl, myEntry);
}
public static void main(String ar[]) throws ServiceException, IOException {
//creating Google service required to access and update Blogger post
GoogleService myService = new GoogleService("blogger", "http://allindiatelevision.blogspot.in/");
myService.setUserCredentials("gmail username", "password");
createPost(myService );
}
}