I am using XML-RPC and Jwordpress to view my site posts.
When I Use the following code:
Wordpress wp = new Wordpress(Username, Password, XMLRPCURL);
List<Page> recentPost = wp.getRecentPosts(10);
It returns only Drafts. How can I retrieve my Published Posts with JWordpress?
Best Thing to do is to Use Json API.
easily Install JSON on Your WordPress Site or Blog and with JSON Library for Java (Or Gson) You can get Posts and Many more stuff From Your site/Blog.
That's the Easiest way to do that I Think.
Related
Iam using restfb to get in touch with Facebook from our application.
I have link to the conversation
https://www.facebook.com/prasannapatireddy/posts/234992897106899?comment_id=263969987542523
Now what I need is using above link I have to find out the Attachments if any in this conversation.
How can we do this in Java.
I tried below but didn't work
'
Connection myFeed = facebookClient
.fetchConnection("https://www.facebook.com/prasannapatireddy/posts/234992897106899?comment_id=263969987542523",Comment.class);
Please Help.
Thanks & Regards,
Prasanna
You have to provide the information in your call which fields you need. And you cannot use the perma link of a comment you see on Facebook, this is all about the Graph API.
Connection<Comment> commentConnection = facebookClient.fetchConnettion("<comment_id>",
Comment.class, Parameter.with("fields", "attachment"));
The comment id should be fetched via graph api or with some luck you can try to build it by hand.
I'm a Java Developer and couldn't find many resources to develop facebook apps on Java. Well I'm developing a Facebook app on Java which at some point, reads the inbox of a user. I was able to create a Login flow and get a long term access token. But as I'm very new to the JSON concepts, I could not able to parse the facebook response to get the required data.
I've read some tutorials and got to know basics of JSON and could able to write the code for parsing Simple JSON structures like:
{
"id": 1,
"firstname": "Brad",
"languages": [
{ "lang":"en" , "knowledge":"proficient" },
{ "lang":"fr" , "knowledge":"advanced" },
]
"job":{
"place":"Silicon Valley",
"name":"Microsoft",
} }
But, I was unable to parse the Facebook response as it looks so complex, and I have referred various places for any example or sample code to Parse the Facebook's response for /me/inbox request and couldn't find any.Here I'm looking for any sample code to parse the inbox JSON Object to get the required information for my App. Any effort is highly appreciated. Thank You.
Edit: I'm looking for a sample code in plain JSPs or Servelts.
Spring Social is your friend. Don't get bogged down in integrating with Spring Security (although there are a lot of examples) as the JavaScript login process will be sufficient to get an auth token for the user that you can then query Facebook's API with - just use Spring Social as a library to hide the complexity of the JSON and given you java objects to work with directly.
I ended up having to do it myself. The parent JSON element 'data' contained the data I was looking for. Then I used this tutorial to format it and display it in a Facebook-like way.
I had to actually pick out the data I actually needed. Hope this helps!
You have to use JSONObject and JSONArray, which you can get from getJSONObject() and getJSONArray(). Once you've gotten the JSONObject or JSONArray you need, use getJSONString() to get the desired value.
The tutorial mentioned above is for Android, but the general idea is still there. Let me know if you have any questions. I've done a bit in JSP and Java servlets as well.
this is my java code using resfb lib to post something on my facebook groups feed:
FacebookClient fb=new DefaultFacebookClient(token);
FacebookType message=fb.publish(pid+"/feed",FacebookType.class,Parameter.with("message", description));
now what do i do to share posted article?
thanks a lot for your help!
Graph API doesn't provide an explicit share operation, but you can create a post which is a link to another post, which should be displayed as a share. Something like this:
fb.publish("me/feed", FacebookType.class, Parameter.with("link", "https://www.facebook.com/10152237769155733"));
I want to get my Weibo (www.weibo.com - china sns) tweet list by api.
I am using https://code.google.com/p/weibo4j/ library.
But their sample source only contains web auth.
If i want to their accessToken, their sample source shows tutorial using web browser.
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
Weibo weibo = new Weibo();
RequestToken requestToken = weibo.getOAuthRequestToken();
...
BareBonesBrowserLaunch.openURL(requestToken.getAuthorizationURL());
I want to login weibo api using my account directly and get my timeline post list.
But I think their document does not contain this method. Is anybody already resolved its problem?
So i want to code library for using weibo api as below code.
Weibo weibo = new Weibo();
weibo.setUserAndPassword('john', 'johnpassword'); // weibo4j does not support this method.
....
Paging pag = new Paging();
pag.setSinceId(3343021761165196l);
pag.setCount(200);
List<Status> statuses = weibo.getUserTimeline("john", pag);
Is there any java library for using weibo api?
I think there aren't any library can get weibo timeline via plaint username and password!
A short history:
Weibo api has two version, namely V1 and V2.
In V1 version api, they actually support this kind of login, check this example.
However, after V2 version api was created, all app must use oauth2.
I'm working on a Java application using Seam and I need to forward to a page on a different site, sending some POST data along with it. It needs to occur from the backend.
Any ideas how I can accomplish this?
EDIT: I don't merely need to receive the response - I need to actually direct the user to the new page.
Take a look at HttpClient, you should be able to generate your POST request programatically from the backend, e.g:
PostMethod post = new PostMethod("http://myserver/page.jsp");
post.addParameter("parameter1", "value1");
post.addParameter("parameter2", "value2");
More details here:
http://weblogs.java.net/blog/2006/11/01/quick-intro-httpclient