Using Facebook Graph API Explorer to publish an action - facebook-graph-api

Background
I'm creating a simple Facebook application, first time working with Facebook.
* Using an "Action Type" of "Read"
* Using an "Object Type" of "Article"
I can't submit the application because the Action Type shows an error "You, or this app's Open Graph Test User, must have published this action at least once."
Immediate question:
I'm trying to publish the Action using the Graph API Explorer so that I can then submit the app for review.
I tried a GET /me/news.reads which didn't generate an error but only returned a blank results {"data":[]}
Also when I go back to look at the Action Type, it still shows the same error about needing to publish.
I tried the same request as a POST which did give an error "The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: article."
On another notes, a more generic GET request I tried /me?fields=posts,feed gets me the data I want in the Graph API Explorer, but what would I set as my Action Type and Object Type to use that request?
Any comments on the overall approach I'm using would also be welcome.
More background: The underlying goal of this is that we want our separate corporate website to pull in the latest post to the Wall on our Page.
Any help would be much appreciated. Thanks.

Related

Getting started using Microsoft Academic Graph API

I am trying to run some queries on Microsoft Academic Graph using their API. I cannot figure out what to use for the Ocp-Apim-Subscription-Key. (I have seen this question and it did not help.) When I try to run queries I get the following message (401: access denied): Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key.. This happens either using curl on the command line:
curl -v -X GET "https://westus.api.cognitive.microsoft.com\
/academic/v1.0/evaluate?\
expr=stochastic&model=latest&count=10&offset=0&attributes=Id" \
-H "Ocp-Apim-Subscription-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
or using the API testing console.
So what am I using for the Ocp-Apim-Subscription-Key? (Not a lot of Xs!) I've tried two things. First, I've tried using the key that you can get by going to https://labs.cognitive.microsoft.com/en-us/project-academic-knowledge and clicking on the subscribe link (either Key 1 or Key 2).
Second, I've tried using a key generated by going to the cognitive services on my azure portal, and trying to create a subscription to a suitable service. However, nothing that I can see matches the Academic Search API that I want to use, so I used a generic bing search subscription.
Neither of these grants me access to the API. What am I missing?
EDIT:
After first response by #ali-heikal, I tried going to here: https://dev.labs.cognitive.microsoft.com/docs/services/56332331778daf02acc0a50b/operations/5951f78363b4fb31286b8ef4/console. A red warning box appears at top of page: You are not subscribed to this API and will get a '401 Access Denied' response. To subscribe, go to the Products page and click on the desired product containing this API.. If I go to the Products page, and go on to the Project Academic Knowledge - Preview page, I am offered the chance to subscribe. Clicking subscribe takes me to a generic MS sign in (I am signed in, choose that account), I am taken to a page which says:
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
So this does not work for me. Where is it documented that I should use this endpoint? Can someone provide further instructions on how to use it?
EDIT2:
There is this answer which describes using a different endpoint: https://stackoverflow.com/a/49318405/54557. However, changing my curl request to use this does not work (with same Access denied error).
You're using the wrong endpoint, since you're using the Preview API, then you should use the Preview endpoint as well.
It should work if you follow those steps:
Regenerate a key from here (do not use an old key this time) and confirm by clicking the Yes, regenerate this key button
Open the Testing Console from here
Insert the key you just generated into the Ocp-Apim-Subscription-Key field
Insert the following into the Request body field: expr=Composite(AA.AuN=='ali heikal')&count=2&attributes=Ti,Y,CC,AA.AuN,AA.AuId
Click the Send button
Check the Entity Attributes documentation here to understand the attributes I included following the Evaluate Method documentation here
I think the problem is that you are using an old key with the wrong endpoint and attribute values.

Facebook Story for my app: Unable to generate story

In the Open Graph Dashboard of my Facebook application I get error for my story saying "Unable to generate story" after creating both custom or storys with standard object.
So under the page facebookdeveloper/apps/myapp/story/openGraph where I usually have nice storys for different scenarios (one on one, multiple people, past tence) it just says error "Unable to generat story" everywhere.
My story titles says for example: "Mr X read a book.title on myApp" and then "Unable..."
There is no more information on why I get the error.
I had storys with similiar object etc. for the application previously which I removed. Cant his affect the creation of new stories?
Anyone else who has the same problem and a solution?
I had "Unable to generate story" until I completed the steps at :
Facebook Open Graph Story
Setup the Backend Server (just put the PHP example on a server you can access)
Test it using the Object Debugger
(Once you resolve any errors from Debugger) Publish a test action
OpenGraph can then generate the different scenario stories.
Hope that helps.
Try clicking on Manage Sample Data, create the sample object first, then the sample action. Setup the sample action to use the sample object you just created. This worked for me, just in time to stop me going mad. I got this solution from a Japanese site : http://konifar.com/1185
This error comes up because facebook has no examples of the story to render. It does not inhibit your ability to post the actions.
I know it's too late to provide an answer but it will be helpful to others who are having the same issue,I was having the same issue and it held me back by a couple of hours after one successful post you will be able to get the preview until then you can't get a preview.
Another point when publishing a test action:
It needs to be from your account, so if you have an account just for testing that's not the same as the admin account, it won't work
It can't be from a test user - I think this is related to the first point

Facebook graph, post action with extra parameters

I have created an application with their associated Open Graph actions. Got problem with submitting one action, which is using extra field "message". When admin or tester using this action it works fine, but it is not working with facebook's test users, such is "Auth Dialog Preview User", it gives an error "Message: This action is not allowed to set a user message because this property was not requested for approval." Why it gives this error to the test user? And when i submit this action, facebook replies me that they can not test this action... What i missed?
http://gyazo.com/42ebb0a5c12f3c47fed64f5eb9930f61
Why it gives this error to the test user?
Doesn’t it quiet clearly say so:
"Message: This action is not allowed to set a user message because this property was not requested for approval."
…?
Users that are not admins can’t post actions that have not been approved by Facebook.
I've been beating my head against the wall on this problem as well.
First: There is a Facebook Bug that is currently triaged on this topic.
Facebook Bug Link
Second: I noticed Facebook has updated the description of the Message property.
message: Allows users to write a personalized message attached to this
action. You can only use user message when the text is entered by the
user (not pre-populated). string
Facebook page that details the Message parameter
You'll notice it clearly states that it can't be pre-populated now. I don't remember it saying that previously (Of course my memory could be failing me) and I'm curious if that means even if the user composed the message on my application, Facebook considers the string I'm feeding the action pre-populated even though it's an actual unique comment written by the user. In other words you may have to use Facebook code (plugin, dialog, etc...) to prompt the user to actually enter a message attached to the action.
Third: FYI, I was able to get my action approved (With the Message parameter) but the same error persists for all users attempting to submit the action with the exception of admins and testers, so getting your action approved won't likely alleviate the issue. It's either an actual bug or a misunderstanding of the capabilities/functionality of the Message parameter.
Apologies for this being a partial answer slash extension to the question.

how to get in my app the activities from my friends using the same action type/objects?

i create a new action type ler (translation for 'read' in my language) and a object called reportagem (similar for built-in object 'news').
i tried this at graph api explorer:
me/friends/reportagem.lerem
according to the configuration of my action type and object, that should be the correct way to find my friends activities in my app.
thanks in advance.
If you want to see your Friend's activity for a given action, you must query the Graph API using the Action ID, not the namespace.action method.
Example, my Action ID is: 1234567890
If I want to read the actions of my friends for the same action, call the Graph API as follows:
GET https://graph.facebook.com/friend.name/1234567890
If you have permission, the above call will list the friend's actions from the App.
You can get the Action ID from the Open Graph section from the App Settings page. Check the URL (it will be something like):
https://developers.facebook.com/apps/{app_id}/opengraph/action_type/{action_id}

Facebook custom graph action not appearing

I found a very similar question here: Actions do not appear on timeline, but the solutions offered there are not working for me.
I created a custom graph action and a custom graph object through my Facebook application, and the process of publishing seems to be working fine. When I post the data using the JavaScript SDK with my access token and the object ID, the Facebook API returns the ID of the action, which I can then access on the graph. This side of things is clearly working, since accessing the object via the graph with my app's access token returns all the information it is supposed to.
However, I see no record of this action on Facebook itself; not on my app's timeline, not on the aggregation I set up for this action. The solutions offered in the link above entail double-checking the validity of the meta tags, which I did using the debugger, and also ensuring that there are no URLs within the meta tags that are inaccessible, which is also not the case. Is there anything else that could prevent these actions from showing up on the timeline?
Thanks!
There can be some permission error for facebook (and thus global users) for some url. If you get the action response id, it has to be in your facebook timeline at least (not in others excluding the developers and testers of your app) and it really occurs almost real time.
PS: If you found a similar questions elsewhere, please try to go on with the discussion there instead of creating a duplicate question.