Getting Facebook's New Payer Promotions to Work - facebook

Has anyone been able to get the New Payer Promotions described in Facebook's recent developer blog post to work? According to the documentation you should be able to query a new field, is_eligible_promo via the Graph API.
Formatting a call like this only results in the "id" field being returned for me though.
https://graph.facebook.com/USER_ID?fields=is_eligible_promo?access_token=USER_ACCESS_TOKEN
Am I missing something? Do I have to sign up for or enable this somewhere? Or does it just not work correctly?

After testing with a friend's account it appears that the documentation is incorrect.
If the user is eligible it will do what it describes and return the is_eligible_promo field with a "1" as the value.
If the user is not eligible the is_eligible_promo field will not be returned at all.
The documentation says "This query returns the following data in its response: The value 1 indicating the user is eligible or 0 indicating the user is not eligible." Apparently this is not correct.
My account was not eligible therefore it did not return a value for this field.

Related

How to get the The Username of the person that made comment on a Page Post using Facebook Graph API V.6.0?

I have tried the following url
https://graph.facebook.com/v6.0/{commentid}/comments?access_token={pagetoken}
The result i got was 3 fields: created_time, message, id.
I need value of "from" field. please help me.
By default, you only get a minimum set of fields. You need specify additional fields in the API call:
/{commentid}/comments?fields=field1,field2&access_token={pagetoken}

Facebook Oauth2 - invalid scope id?

I'm trying to implement facebook login/autoregister for a website. There is a problem with the requested scopes.
First I have tried to use the "default" scope. According to the official documentation, it provides access to a subset of the UserData structure. It is documented here:
https://developers.facebook.com/docs/facebook-login/permissions/#reference-default
However, if I try to do this, then I get an error:
Invalid scope: default
I have also tried to use something basic first. For example, scope="id". Then I get this error:
Invalid scope: id
If I try scope="email first_name last_name middle_name name picture" then:
Invalid scope: first_name
The only that worked so far is scope="email", but that is not enough for auto registration.
Moreover, the documentations cleary says that "All permissions, except the Default Public Profile fields, require Facebook Login and Client OAuth Login enabled for your app to allow Users or Pages to grant your app these permissions." (you can read this on the top of https://developers.facebook.com/docs/facebook-login/permissions/ ). So it seems that the scopes are not invalid because I don't have Facebook Login enabled for my app. They are invalid for some other reason - maybe because the don't exist?
I wonder why are these scopes documented if they are invalid? And where can I find the valid ones?
Side note: it seems that Facebook does not follow RFC 6749. When there is an error, the Oauth2 server (https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2 more specifically 4.1.2.1 error response ). But Facebook does not do this. It displays a popup window on facebook.com instead, and if I press "OK" on that window, it enters an infinite loop and keeps displaying the same message again and again: "You are no logged in". (Why would I?)
UPDATE: Even though I used scope=email only, the /me api returned all fields, including first_name, last_name, email, and profile picture. So maybe those things are not scopes, but field names. But it is still unclear what scopes are available? The documentation still seems bad. It should clearly tell which terms are scopes, which are field names from data structures. And a complete list of scopes is still missing from the docs (or maybe there is a list, just I couldn't find it?)
The docs are indeed a bit misleading, but "default" is not a permission/scope, it just tells you want data you can get WITHOUT an additional permission. You can find the available permissions in the link of your question, if you just scroll to the top. Only that list is important, for the default fields there is a link "Default Public Profile Fields", but - again - no scope/permission is needed.
And yes, there is a big difference between scope and fields. For example, the email field can be used after authorizing with the email scope, but the birthday field requires authorization with the user_birthday permission. Fields can be found here, for example: https://developers.facebook.com/docs/graph-api/reference/v3.1/user

Facebook marketing api access non existing field

I am trying to access campaigns of the facebook account. Using python lib: https://github.com/facebook/facebook-python-ads-sdk
Receive error: (#100) Tried accessing nonexisting field (campaigns) on node type (AdAccount)
Url: https://graph.facebook.com/v2.11/{account_id}/campaigns
Everything worked fine for months. Now, even facebook page for this url is empty: https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/
Any thoughts, what's the problem?
Seems to be a bug.
Reported here: https://developers.facebook.com/bugs/707332642990208/
Works perfectly without time_range param.
So, could be temporary solution.
I don't know if this is a bug or not: facebook does this from time to time and is implementing check routines for parameters - in fact "adaccounts don't have any parameters:facebook api reference adaccount reading)
The error you are getting (#100) says "invalid parameter" (facebook reference adaccount validation rules), this is, because you may have defined the time_range and you are asking api for campaigns in an adaccount. But: for adaccount edge time_rage parameter is invalid.
The solution is to FIRST asking api for https://graph.facebook.com/v2.11/{account_id}/campaigns and after this defining the (time_range) parameter(s) for the insights of your campaign.

Facebook Marketing API some field are not shown

I have a development level access to Marketing API and it looks like I cannot read some fields of specific objects.
For example I try the following call:
You can see that promoted_object, link_url and object_url are not displayed in the result. And I should have one of those three value as the Ads was ad to promote "web site click".
Is it a bug or a limitation of the development acces or I am doing something wrong?
It is true that not all fields are readable by all apps, however in the case above it is most likely that these fields are empty on that object and therefore not returned in the response.
Promoted object, for example, is required on the adset level now, however it may be the case the adset you are trying to read is very old and therefore does not have one specified.
In regards to the creative fields, again not all creatives have these fields and in the case they are empty, are not returned in the response. You should check the promoted_story_id to see if this contains what you're looking for.

Salesforce API CALL issue

I'm testing the REST API,
I successfully called to https://naxx.salesforce.com/services/data/v29.0/sobjects/
It returns the expected result.
When I call to https://naxx.salesforce.com/services/data/v29.0/sobjects/Account/
It returns a (404) Not Found response.
I have replaced the "Account" placeholder with the logged user's email, nickname, email , also I have tried with access_token.id value but nothing works. The answer is always 404.
What should I use as "Account" value, and where can I get that information?
I'm following this documentation:
http://www.salesforce.com/us/developer/docs/api_rest/index_Left.htm#CSHID=quickstart_oauth.htm|StartTopic=Content%2Fquickstart_oauth.htm|SkinName=webhelp
Specifically the subtitle called "Get Basic Object Information".
I have the same problem with:
https://naxx.salesforce.com/services/data/v29.0/sobjects/Account/describe/
https://naxx.salesforce.com/services/data/v29.0/query?q=SELECT+name+from+Account
I have not the problem with:
https://naxx.salesforce.com/services/data/
https://naxx.salesforce.com/services/data/v29.0/
https://naxx.salesforce.com/services/data/v29.0/sobjects/
Thank you in advance.
Account is not placeholder text it is the actual name of an SObject type. That it returns a 404 response means your user account does not have access to Account records. You should check your users profile & license settings. The services/data/v29.0/sobjects/ request will return details of all the SObject types your user has access to. (so you'll find that Account is not in this list in your case)
I had a similar issue. I was able to access the object Account in the list of objects but was not able to retrieve the metadata. Seems that the documentation misses the parameter "sobjects" in the path. The correct URL is:
https://na1.salesforce.com/services/data/v20.0/sobjects/Account/describe/ -H "Authorization: Bearer token"
This can be confirmed through by trying the url:
https://na1.salesforce.com/services/data/v20.0/sobjects/Account
which lists the uses such as records, describe, listviews, etc. It may vary based on organization and if the user has permission, it is ideal that the developer hit the second URL and then obtain the correct base url to retrieve the metadata.