Closed GoogleCodeExporter closed 8 years ago
I have developed methods to get and publish to the stream. I will be submitting
a patch
with these methods soon. After that I hope to fully implement all the stream
methods.
Original comment by abdinoor
on 26 May 2009 at 9:33
Here is my patch that implements the stream_get and stream_publish methods.
Original comment by abdinoor
on 28 May 2009 at 10:26
Attachments:
I'll try and review the patch today.
Original comment by david.j....@googlemail.com
on 29 May 2009 at 7:30
Should Permission get a new PUBLISH_STREAM("publish_stream") enum value?
That's what
the docs specify is needed to use Stream.publish:
http://wiki.developers.facebook.com/index.php/Stream.publish
Original comment by zcox...@gmail.com
on 29 May 2009 at 2:51
Yes, good point. I am adding that now. It will also need "read_stream" since
that is a
separate permission.
Original comment by abdinoor
on 29 May 2009 at 2:59
I patched a local svn checkout of the API, rebuilt it with Maven, and the new
stream_publish method works great.
Original comment by zcox...@gmail.com
on 29 May 2009 at 6:23
Great thanks for testing it out. I finished all the other methods last night so
now you
can add/remove stream comments and likes. If anyone needs that stuff
immediately I can
create another patch.
Original comment by abdinoor
on 29 May 2009 at 6:26
Could you please attach a single patch file that can be easily applied in
Eclipse using
Team --> Apply Patch? Thanks.
Original comment by david.j....@googlemail.com
on 30 May 2009 at 5:24
Eclipse formatted patch attached.
Original comment by abdinoor
on 30 May 2009 at 5:37
Attachments:
I'm having trouble applying that patch because I've just moved up to Windows 7
and it's
not playing nicely with Eclipse. Anyway, the patch looks good. I've bumped you
to
member status so please go ahead and commit the change.
Please read http://code.google.com/p/facebook-java-api/wiki/HowToDeploy which
describes
the steps required so that you can produce a snapshot release for other users
to test.
You'll need to get a keypair generated then added to the repository by Fern.
Thanks.
Original comment by david.j....@googlemail.com
on 31 May 2009 at 9:39
Original comment by david.j....@googlemail.com
on 31 May 2009 at 9:39
Code has been all checked in for the past few days. Currently working on
getting a
snapshot release ready. Might be a little while since we are having SSH key
issues.
Original comment by abdinoor
on 2 Jun 2009 at 4:21
Hi abdinoor
Thanks for the patch, is there possible to provide code sample for the Open
Stream
API? When I use the new API, javax.xml.bind.UnmarshalException is thrown, here
portion of my code
FacebookJaxbRestClient client = new FacebookJaxbRestClient(API_KEY, SECRET);
String token = client.auth_createToken();
String url = "http://www.facebook.com/login.php?api_key=" + API_KEY + "&v=1.0" +
"&auth_token=" + token;
BareBonesBrowserLaunch.openURL(url);
String session = client.auth_getSession(token);
System.out.println("Session key is " + session);
// keep track of the logged in user id
Long userId = client.users_getLoggedInUser();
System.out.println("Fetching friends for user " + userId);
client.friends_get();
FriendsGetResponse response = (FriendsGetResponse) client.getResponsePOJO();
if (response != null) {
Date startDate = new Date(2009, 5, 1);
Date end = new Date();
List<Long> friendIDs = response.getUid();
client.stream_get(userId, friendIDs, startDate, endDate, 50, null);
// Exception is thrown at above line
}
Original comment by khoo.ja...@gmail.com
on 5 Jun 2009 at 10:16
The best place to see examples are the unit tests for the stream. Check out the
file
Issue208StreamAPI.java and you'll see all sorts of uses of the stream_get
method.
Also, the stream methods are now available as part of the 2.1.2-SNAPSHOT
release.
Original comment by abdinoor
on 5 Jun 2009 at 1:23
Stream methods are now available in the 2.1.2-SNAPSHOT.
Original comment by abdinoor
on 5 Jun 2009 at 1:33
I build latest sources from your SVN.
When I publish Attachment with Properties, It renders on facebook like below:
0: Text1
1: Text2
2: Text3
The code I use is:
Map<String,String> map = new TreeMap<String,String>();
map.put( "property1", "Text1" );
map.put( "property2", "Text2" );
map.put( "property3", "Text3" );
attach.setProperties(map);
Possible bug or am I doing something wrong?
Original comment by onurrak...@gmail.com
on 8 Jun 2009 at 11:22
I've tried following the directions from Facebook that specify a property to
have a
name and a value that contains "text" and "href" elements, however that doesn't
work.
For some reason the API is not accepting a key/value pair in the format they
specify.
Until that gets figured out it's going to list the properties numerically.
Original comment by abdinoor
on 8 Jun 2009 at 2:31
What are those properties used for anyways? We've been trying to figure that
out for
a few weeks now, with no luck.
Original comment by zcox...@gmail.com
on 8 Jun 2009 at 2:33
Here's the official explanation from Facebook:
properties: An array of key/value pairs that provide more information about the
post. The properties array can contain plain text and links only. To include a
link, the value of the property should be a dictionary with 'text' and 'href'
attributes.
http://wiki.developers.facebook.com/index.php/Attachment_(Streams)
Original comment by abdinoor
on 8 Jun 2009 at 2:41
Yep that's the (only) documentation we've found about the attachment
properties, and
that is still so vague we have no idea what you'd ever use the properties for.
Original comment by zcox...@gmail.com
on 8 Jun 2009 at 2:43
Hi, I have fixed this by extending Attachment class.
Properties should be like below. You use JSONArray thats why it doesnt work.
"properties":{"category":{"text":"humor","href":"http://www.icanhascheezburger.c
om/category/humor"},"ratings":"5
stars"}
Original comment by onurrak...@gmail.com
on 8 Jun 2009 at 2:45
private List<AttachmentProperty> props;
private void putJsonProperties() {
if (getProps() == null || getProps().isEmpty()) {
return;
}
JSONObject jsonProps = new JSONObject();
try {
for (AttachmentProperty prop : props) {
jsonProps.put(prop.getCaption(), prop.getValueObject());
}
} catch (JSONException e) {
}
putJsonObject("properties", jsonProps);
}
--------
public class AttachmentProperty {
private String caption;
private String text;
private String href;
public Object getValueObject() {
if (href == null) {
return text;
} else {
try {
JSONObject linkObject = new JSONObject();
linkObject.put("text", text);
linkObject.put("href", href);
return linkObject;
} catch (JSONException e) {
e.printStackTrace();
}
}
return text;
}
Original comment by onurrak...@gmail.com
on 8 Jun 2009 at 2:49
I have tried sending Facebook properties links using the format:
"properties":{"category":{"text":"humor","href":"http://www.icanhascheezburger.c
om/cate
gory/humor"},"ratings":"5
stars"}
And it fails, I'll try it again with your code when I have a chance.
Original comment by abdinoor
on 8 Jun 2009 at 9:16
Hi,
Here are the classes that I fixed. Works fine with my application.
Original comment by onurrak...@gmail.com
on 9 Jun 2009 at 8:05
Attachments:
Thanks for the classes! I figured out what was wrong in my implementation
thanks to
your work, and got it fixed.
Update your checkout or download the latest snapshot release to get the new
functionality.
Original comment by abdinoor
on 15 Jun 2009 at 8:35
Admitting ignorance is not very fun... but when you gotta do it, you gotta do
it:
I need publish_stream and none of the release jars have that functionality
included
yet. I've downloaded the svn snapshot and have been trying to create a working
jar
file out of the source tree, but to no avail. I can't get all the dependencies
JSON,
JAXB, etc to work out.
Would someone mind to create a new jar that includes the publish_stream
permission
and post it?
Original comment by cyrus7...@gmail.com
on 16 Jun 2009 at 4:40
Hi,
I have checked the sources you updated but if "href" is not defined, shouldnt
the
property be a simple text instead of the JSONObject with empty "href" property
??
I mean:
{"category" : "aaa"}
instead of
"category" : { "text":"aaa", "href":"" }
Have you tested if it works with empty href property?
Original comment by onurrak...@gmail.com
on 16 Jun 2009 at 8:50
Original comment by abdinoor
on 17 Jun 2009 at 1:43
Good catch. I've updated the attachment so it can take properties as either a
link or
just plain text. If the href is provided, the property will be a link,
otherwise it
will be text.
Original comment by abdinoor
on 17 Jun 2009 at 1:43
Hi,
Could you please prepare some public patch or intermediate snapshot where the
open
stream API is available? Need it urgent for my apps.
Thanks in advance. Keep up the good work!
Regards,
Terry Elloway
Original comment by vikma....@gmail.com
on 24 Jun 2009 at 10:41
The 2.1.3-SNAPSHOT release has all the Stream API methods and is available in
the
snapshot Maven repo. See this for more info on getting snapshot releases:
http://code.google.com/p/facebook-java-api/wiki/MavenSupport
Original comment by abdinoor
on 24 Jun 2009 at 1:02
Sorry, that is the 2.1.2-SNAPSHOT, not 2.1.3.
Original comment by abdinoor
on 24 Jun 2009 at 1:02
Hello, I've downloaded 2.1.2-SNAPSHOT from the offsite Maven repos and I cannot
get
the Stream API to work. The Java API calls are there... but when I call them,
the
result cannot be parsed because the schema is not aware of the responses. I
looked
at the schema.xsd/schema.xjb files and could not find anything for stream api.
Can you please elaborate on this?
Original comment by ricosre...@gmail.com
on 1 Jul 2009 at 4:23
Are you actually using Maven to resolve the dependencies or did you manually
try to
download the files and use them? Make sure you're following all the Maven
directions
from this page:
http://code.google.com/p/facebook-java-api/wiki/MavenSupport
If you're still having trouble I would try running mvn dependency:tree and see
that the
dependencies are actually showing up in there correctly.
Original comment by abdinoor
on 1 Jul 2009 at 4:26
I downloaded the code from svn, followed the maven setup directions to change
the
pom.xml, did mvn dependency:tree, mvn install. I builds the schema and api
jars just
fine. The only that didn't seem to work in my Maven2 client is:
<snapshots>
<enabled>true</enabled>
</snapshots>
It doesn't recognize this tag. The snapshot repos are already in the pom.xml..
so
maybe the directions need updating?
Anyways the schema still doesn't appear to be updated. The current trunk in
the svn
tree does not have any of the Stream API in it. I don't know if you're asking
me to
pull it from another repository so please advise.
Original comment by ricosre...@gmail.com
on 1 Jul 2009 at 5:13
Last comment correction: I should say that the SVN trunk does not seem to have
an
updated schema.xsd file. Facebook.xsd doesn't have the stream api response
structures in it. I can confirm that the calls to facebook are working, but
exceptions are thrown because of the unfamiliar responses.
Original comment by ricosre...@gmail.com
on 1 Jul 2009 at 5:16
It seems you forgot to update IFacebookRestClient.java
Original comment by tgaut...@gmail.com
on 21 Jul 2009 at 7:57
and by chance could you add a javadoc?
Original comment by tgaut...@gmail.com
on 21 Jul 2009 at 7:59
I'm getting the same problem as ricosrealm. I can call the stream publish api
method,
but when I get the response I back from facebook, I get the following exception:
javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://api.facebook.com/1.0/", local:"stream_publish_response"). Expected
elements are <{http://api.facebook.com/1.0/}admin_getAllocation_response>....
etc etc
Has this been fixed? Can we have a new snapshot, please?
Original comment by rchatley@gmail.com
on 30 Jul 2009 at 4:51
The .xsd file needs to be updated. It looks like this project relies on
Facebook to
submit the updated .xsd schema file, which Facebook apparently hasn't updated
in a
while (going to the open source facebook svn tree). They may not include BETA
methods in their .xsd file, so if you want to do this without the errors, you
may
have to update the schema on your own.
Original comment by ricosre...@gmail.com
on 30 Jul 2009 at 5:09
I'm pulling down 2.1.2-SNAPSHOT via Maven and do not see the stream_xxx API
methods
in IFacebookRestClient. What am I missing?
Thanks!
Original comment by ronemr...@gmail.com
on 27 Aug 2009 at 7:49
The methods are in IFacebookRestClient.java, starting at line 3565. Not sure
what would
explain you not seeing them. Perhaps you should check that you got the full
2.1.2
snapshot and didn't have a partial download or SVN failure.
Original comment by abdinoor
on 27 Aug 2009 at 8:35
Hello,
I'm pulling down both:
1)
http://mrepo.happyfern.com/maven2-snapshot/com/google/code/facebookapi/facebook-
java-api/2.1.2-SNAPSHOT/facebook-java-api-2.1.2-20090617.134204-5-sources.jar
2)
http://mrepo.happyfern.com/maven2-snapshot/com/google/code/facebookapi/facebook-
java-api/2.1.2-SNAPSHOT/facebook-java-api-2.1.2-SNAPSHOT-sources.jar
and neither appear to have a line #3565 or the stream APIs.
I'm at a loss right now...??
I'm not using SVN right now to access the snapshot, just Maven at this point in
time.
Original comment by ronemr...@gmail.com
on 28 Aug 2009 at 1:50
In addition, my POM looks like this:
<dependency>
<groupId>com.google.code.facebookapi</groupId>
<artifactId>facebook-java-api</artifactId>
<version>2.1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.facebookapi</groupId>
<artifactId>facebook-java-api-schema</artifactId>
<version>2.1.2-SNAPSHOT</version>
</dependency>
Thanks!
Original comment by ronemr...@gmail.com
on 28 Aug 2009 at 1:52
Okay I just checked the jar and indeed the stream methods are not there. I am
following
up with one of the other developers on this project to see if someone maybe
built a new
version of the snapshot without my updates.
Original comment by abdinoor
on 28 Aug 2009 at 2:13
Thanks! Thought I was losing my mind.
Original comment by ronemr...@gmail.com
on 29 Aug 2009 at 1:27
Hi abdinoor,
Were you able to get any information regarding the snapshot build missing the
stream
API updates?
Thanks!
Original comment by ronemr...@gmail.com
on 31 Aug 2009 at 2:52
Would you have some sample code on how to use the stream API from
facebook-java-api-3.0.0-SNAPSHOT in order to publish to a fan page? Is the
stream_get
and stream_publish applied to 3.0.0?
Original comment by stephan....@gmail.com
on 2 Sep 2009 at 4:21
Hi again abdinoor,
Thought I'd check in one more time to see if you were able to uncover why the
stream
APIs are missing in the latest 2.1.2-SNAPSHOT build.
Thanks again for any help you can provide.
-Ron
Original comment by ronemr...@gmail.com
on 9 Sep 2009 at 1:58
Sorry for the delay but something happened to the maven snapshot and I'm
working with
another project contributor to get it sorted out. I don't know how long that
will take
right now, hopefully not long.
Original comment by abdinoor
on 9 Sep 2009 at 1:59
Original issue reported on code.google.com by
amit...@gmail.com
on 25 May 2009 at 2:22