Updating action properties which are objects - facebook

Is it possible to update an object property of a published action? I tried POSTing to:
https://graph.facebook.com/ACTION_ID?OBJECT_PROPERTY=OBJECT_URL
&access_token=VALID_ACCESS_TOKEN
I got true as a response, as you do.
I can update first-level properties such as expires_in, just not connected objects.

No, you cannot modify the object properties in this way.
You can modify action properties in this method, but if you want to update the object, you need to change the OG tags on that object's URL, and either wait 48 hrs for FB's cache to expire, or force a rescrape of the OG object properties by using the debug tool at http://developers.facebook.com/tools/debug
or via the API by POSTing to
https://graph.facebook.com/id={object-id or object-url}&scrape=true

Related

Setting website_url application property to blank via the API

Any idea how to set website_url application property to empty via the API? When I try to send an empty parameter, I get 'true' as a result but it does not update the property.
curl "https://graph.facebook.com/myappid?website_url&access_token=applicationaccesstoken&method=post"
This is to comply with the latest policy about on-canvas only games.
refer to bug: https://developers.facebook.com/bugs/140498756103463?browse=search_50d24fd418f5d6c41473620
Docs state that an array can be unset if editable, we can try passing an empty array and see if that does the trick.
Create
To set properties for an app, issue an HTTP POST with an app access
token to
https://graph.facebook.com/APP_ID?PROPERTY_1=PROPERTY_VALUE&PROPERTY_2=PROPERTY_VALUE2
using the same properties and formats as in the table above. Not all
app properties can be edited via the API, please refer to the
properties in the table above for an indication of whether a property
can be edited or not.
Array properties can be unset by passing an empty array.

RestFB publish custom action and object

I'm just getting started with Facebbook API/OpenGraph and RestFB.
I created a custom object and action type on Facebook.
However, I don't quite get the concept of how RestFB works with publishing an action with an object.
I'm able to publish an action (complete) like this:
FacebookType publishMessageResponse =
facebookClient.publish("me/myapp:complete", Post.class,
Parameter.with("mycustomobject", "http://samples.ogp.me/xxxxxxxxxxxxx"),
What I don't understand is how to create an object with all necessary parameters and pass it into the publishMessage. In this case I just linked to the sample object that was provided by Facebook for illustration.
What I don't understand is how to create an object with all necessary parameters and pass it into the publishMessage.
Open Graph objects are basically just URLs.
You put all the necessary info into the HTML that this URL delivers, into the Open Graph meta elements. (See OG docs for this.)
Then, when publishing your action on an object, you just give that object’s URL, and Facebook will fetch the data from there. (Unless you have some additional custom properties, for which you can also give the values while publishing the action).

Retrieving the action-instance-id from Facebook given the URL

tl;dr: No, there isn't a way.
Calling publish_action using the JS SDK is actually pretty straightforward. However (from the little info I gleaned from reading the documentation), there's no way for me to query facebook to have it return the action instance ID for an object that I have already published... is there?
Example:
User A loads the page, and the page sends an FB.api call to /me/news.reads, which returns an action instance ID.
User A reloads the page, and the page again sends an FB.api call to /me/news.reads, but this time, the Graph API returns:
{
error: {
code: 3501,
message: 'blahblahblah... already associated... blah blah'
type: 'OAuthException'
}
}
Pretty standard stuff, and expected, since I turned off the ability to publish the same URL multiple times.
Now then, is there any way for me to retrieve a previously published action instance ID from the Graph API by passing in the URL, or is it up to me to handle the returned action instance ID (from the original publication attempt) and save it to a database? I was hoping I wouldn't have to do that...
No, there is no way to retrieve instances of published actions other than:
Accessing action by id:
http://graph.facebook.com/ACTION_ID
Accessing all instances published by specific user:
http://graph.facebook.com/USER_ID/NAMESPACE:ACTION (NAMESPACE:ACTION may be replaces by the name of one of built-in actions like news.reads, music.listend, etc.
If you want to access details of published actions connected/referencing specific object you'll need to save that data on your end for later usage.

How do I retrieve custom properties of a custom open graph object?

I defined a custom Open Graph action (e.g. "drive") and a custom object ("car") with custom properties ("color", "make"), then added the meta tags to the object page and verified with the Object debugger. I also published few actions in my timeline.
When I use the action API to view the "drive" actions ("/me/[name_space]:drive") I see all the actions and the Objects with their default properties (ids, titles..) but no custom properties.
How can I retrieve the Objects with all their custom properties?
It is probably too late, but I encountered with the same problem today.
It seems that the custom action /me/[name_space]:drive only provides the standard properties, but I found that if you also include the object type you can retrieve it with the custom ones:
GET https://graph.facebook.com/me/recipebox:cook/recipes
or in your example:
GET https://graph.facebook.com/me/[name_space]:drive/car

MVC 2.0 Post Form to action instead of redirect to action

I am using T4MVC to redirect to another action return RedirectToAction(MVC.MyController.MyAction());.
In result it is doing get request.
Is there any way to make post request from controller. I want to keep all the same but only make post instead get. I cant find any methods for that. I found one post helper here http://geekswithblogs.net/rakker/archive/2006/04/21/76044.aspx but i cant pass any values i need using this post helper. I was trying to pass values through TempData but they are not coming when i using this helper. May be some one have any ideas?
The reason i want to do this because when user come from one controller to another and then if user click update or just click enter in browser address bar, page will break.
Should i use session for that reason?
A RedirectToAction will always perform a GET, never a POST (it returns a HTTP 302 to the browser, which will then issue a GET request).
To persist data across the redirect, if it is data that can be easily represented as a string and stored in the query string, then you can just add it to the route values of the redirect.
e.g.
return RedirectToAction("Search", new { searchString = "whatever" });
If it is a complex type, then you will need to store it in TempData. A number of other questions on StackOverflow (such as this one) give details on how.
If repeatedly storing to and reading from TempData across your application offends your code-sense, then you can encapsulate this by using the PassParametersDuringRedirect attribute and generic RedirectToAction available in the MvcContrib project. Some details on this technique are available here.
only way of doing post is by having a form and doing submit on that form, either with a submit button or with javascript, any info you want passed to that action must be in that form and you will find everything posted in FormCollection(hope I spelled it right).