2

I am using Scribe Java API and restFB to work on facebook. Here my requirement is to post on user wall once he is registered. I wanted to show some good looking posts as here. enter image description here

I want to share our logo instead of that image containing (100,000) and the title and description should be added by myself through java. I googled it and I got some suggestions to use this kind of stuff in html page and share that link. Here is the link what i expects in Java. But its in PHP. We can add our own image, title, description etc.., Similar I am looking in Java.

<meta property="og:title" content="YOUR TITLE HERE" />
<meta property="og:description" content="YOUR DESCRIPTION HERE" />
<meta property="og:image" content="YOUR THUMBNAIL URL HERE" />

I dont want to add the above mentioned stuff to jsp page and share that page. But I wanted to all stuff and share it through java code. So can anyone help me.

Vignesh Gopalakrishnan
  • 1,962
  • 9
  • 31
  • 53
  • _“my requirement is to post on user wall once he is registered”_ – sounds rather spam-y. Anyway, the parameters for making a post on the user’s wall via API are described here: https://developers.facebook.com/docs/reference/api/user/#posts If you have no idea how to use the API from within Java, then please go research that topic yourself first. – CBroe Nov 04 '13 at 12:38
  • I Know that. Once user registered, I will create one UI which asks his permission to post on user wall. Then only I will post. Just now testing with my account, how to do that.? – Vignesh Gopalakrishnan Nov 04 '13 at 12:47
  • After going through docs I didn't understand. That is why I am asking here and that is why this website is for.. I mentioned that I googled and I got some answer which is in PHP. So Could you please help me or give some idea how to do that. – Vignesh Gopalakrishnan Nov 04 '13 at 12:55
  • https://www.google.com/search?q=facebook+api+java – CBroe Nov 04 '13 at 12:56

1 Answers1

0

I think there are a couple of parts to this questions:

  1. How do you define a post such that it gets formatted nicely (i.e. correct icon, title, description)
  2. How do you actually post it / does it get onto the user's timeline

Re 1:

  • Facebook gets summary information to show about a page based on Open Graph tags, exactly as shown in the question, defined in their Open Graph documentation here
  • You might not want to add these type of tags to your JSP... but one way or another, you need to get those tags to show up in the HTML of the page you want to share on Facebook (with the type of nice summary you show)
  • You can check what meta data facebook sees on one of your pages using their debugger
  • I think you're saying you want to have a link to some document without actually having an underlying object (i.e. a page on your website) - you just want to "do it via Java". You can share / post a page using Java, you just have to have an underlying "object" (i.e. a page) that is pointed to by your post - and that has to have the meta data tags in it!

Re 2:

  • In terms of actually posting something to somebody's wall via Java, I think you will need to do something like this, using an Open Graph "Like" (click on the Create tab, and select HTTP platform)
  • You can use Scribe to create a POST like that, assuming you have already got a long-life token from the user!
  • Here's a Scribe facebook example - although you will need to change from using a GET to a POST, with the appropriate URL / query parameters obviously per the first bullet this section
  • If are using Open Graph, even just a Like, you will need to get your Open Graph post (the Like) approved by Facebook... which is pretty easy process, as long as you follow their instructions / guidelinee, here. They say it takes several days to get reviewed / approved, but I have found that they get approved (or rejected) within 24 hours
nickpharris
  • 385
  • 5
  • 17