How to use apprequest for send or askfor using OpenGraph API? - facebook

I am using Facebook Unity SDK to implement a sample gift module in my game.I am using the method:
**public static void AppRequest(
string message,
OGActionType actionType,
*string objectId*,
string[] to,
string data = "",
string title = "",
FacebookDelegate callback = null)**
Ref: https://developers.facebook.com/docs/games/requests/v2.2
AS the OGAction type refres to the action like askfor or send,the next arguement is object_id which i unable to get properly.
Can anyone tell do the object will be created in the app itself or it must be created in the opengraph section of my app registerd on facebook?Do i need my own sever for this?
I just need to send an item and and recieve it at the reciever's end.Please tell me where i am wrong or what i should i do to get it properly?

This is what I did:
1- On the "Tools & Support" section in the Developers' page, open "Object Browser".
2- Set the "App" and "Object Owner" section to your App.
3- Click "New Object".
4- A new object will be created and you can copy its id in the AppRequest parameters.
I don't know if there is an easier or better way to do it but, so far, I have been getting requests without issues.
Cheers!

Related

Jive - Get current blog post from app

I'm developing an app which has a Content Action and an !app Action.
I would like to get via javascript (i.e. Open Social API I suposse...) the current user (I got it!) and the current blog post (blogpost id) from both actions.
Is it possible?
Thank you!
I found it!
You can do it adding an gadgets.util.registerOnLoadHandler() listener, and inside it you should call the osapi.jive.core.container.getLaunchContext(function (selection) {});
From selection object you can get the type and the id:
var type = selection.jive.content.type;
var contentid = selection.jive.content.id
You have a full example from Jive Developers Website

Facebook/Unity OpenGraph: Object with ID ' ' cannot be retrieved

I am currently trying to get Facebook to send an Open Graph object from within my Unity game however something weird is happening. I have the object set up within the Open Graph settings page, and I have done all of the set up required to get the actual object ID and everything. The image is hosted, the POST object data changed etc. The function I am calling contains the following:
FB.AppRequest(
message: "I sent you a life!",
actionType: Facebook.OGActionType.Send,
objectId: livesIdValue*,
filters: null,
excludeIds: null,
maxRecipients: null,
data: "",
title: "Send a life to your friends",
callback: sendLifeCallback
);
*livesIdValue is set to the ID that was returned from the Graph API Explorer.
The strange thing about this is, on one Facebook account, this works completely fine, and will show the Friend Picker dialog window thing. When I try it with a second Facebook account though, I get the error message:
"Object with ID 'value that is stored in livesIdValue' cannot be retrieved.
Has anybody run into this problem? I'm really not sure what could be causing this problem to only show up on one account but not the other.

Blackberry facebook Graph API. "Like" the post of users

I am developing blackberry application that use the Facebook functionality. I do every thing using the Graph API of facebook for blackberry. But my problem is that i m not able to "like" or "comment" on any post or photo.
Can you please give the source code or help example on how to like the post of user.
I read the "Post - Facebook Developers" but i m not getting what it actually saying or how to achieve this functionality.
Any help is appreciated.
Thanks in advance.
i dont know about graph api.but if it possible download this api http://sourceforge.net/projects/facebook-bb-sdk/
and you can do everything here easily.if you need any help ask me
you just add that jar file to your application
next just write following code
ApplicationSettings sett=new ApplicationSettings("http://www.facebook.com/connect/login_success.html", "facebooke id", "secret key", Permissions.ALL_PERMISSIONS);
facebook=Facebook.getInstance(sett);
user = facebook.getCurrentUser();
String result=user.publishPost(String pMessage, String pLink, String pPictureurl, String pName, String pCaption, String pDescription, String pSource);
if result value not null thaen your post successfull

What does it mean for a Facebook Event to be "private"?

I use Facebook-C#-SDK 5.0.3 FacebookClient.Post("me/events", [parameters including "privacy" => "secret"]). The new event shows as "Private Event" on my Facebook. However, my friends see the event appear on their Wall, and when they click on the event they see it as "Public Event".
I am trying to create test events for debugging purposes, but even though I see the event as "Private Event", and when I edit the event the three checkboxes are cleared:
-- Anyone can view and RSVP (public event)
-- Guests can invite Friends
-- Show the guest list on the event page
the event is still visible and announced to all my friends. They can't RSVP, but they do get the UX to post to the event's wall.
Thanks,
Jon
With the SDK the convention is to pass parameters in as a dynamic object or dictionary.
According to a post here the parameter name for setting visibility is 'privacy_type'.
So (without testing) this is how I would go about it in .Net 4:
dynamic parameters = new ExpandoObject();
parameters.privacy_type = "SECRET";
_facebookClient.Post("me/events", parameters);

Access Facebook albums from a flash app

I want to create a flash Facebook application in which, after pressing a button, the user will be able to browse his/her photo albums and choose a photo. How should i do that? What will be the code under the button to gain authentication from any user using this application?
Thanks.
I am currently writing a facebook application for a university assignment that will allow the user to do everything you can do in facebook, but via the flash player window. You will need a few basic things happening in order to do it.
User log in and authentication - this must be done via Facebook - using OAuth authentication, and meeting all of facebook's security policies
register the application with facebook
Use the Graph API (facebook's developer's toolkit) to get the necessary functions that will communicate with facebook via flash.
In Flash itself you will use a bunch of URLRequest functions to send out to FB for information, then you will need to retrieve that data responses and store them to variables (extracting data with a few lines of code is easy, something like this;
//initialise variables
public var photoURL:String;
var Request:URLRequest = new URLRequest("http://www.whatever the url for the graph api service you are using which is founf from FB");
//that ^^ will send off a request for the url, you then want to use the returned data by registering an event handler like this below
functionName.addEventListener(onComplete, completeHandler);
functionName(event, EVENT)
{
var loader:URLLoader = new URLLoader(Request);
var data:XML = new XMLData(load.loader); //i think this is right but not 100% sure, fiddle with it
//then you want to extract the data that is returned, for example, extracting xml data from a rest request works by hitting data from the xml by specifying a path to the object you want. an example of xml is this <rsp stat="ok"><photos ......more code="morecode"><photo url="url of photo"></photo</photos> so you can hit the url in that example like this;
photoURL = data.photos.photo.#url; //this line will grab the photo url for you, allowing you to dynamically create an array and assign photos to the flash stage according to the url you get
}
this is fairly advanced stuff and I am assuming that you have some decent knowledge on AS3, XML, and the FB API, if you need more help just reply