I'm trying to get the Current balance and Payment threshold of an ad account using FB Graph API.
But I didn't find these two fields in the graph-api documentation. https://developers.facebook.com/docs/graph-api/reference/adaccount
Facebook Account Billing Screenshot
Here are some fields I get, but not what I need.
https://graph.facebook.com/v15.0/act_2544045166952?fields=currency,spend_cap,balance,amount_spent&access_token={access_token}
`
{
"currency": "USD",
"spend_cap": "0",
"balance": "0",
"amount_spent": "1900",
"id": "act_2544045166952",
"__fb_trace_id__": "Dk04/LHZUMS",
"__www_request_id__": "A0lv2zw3GMOoUUnZkuGmcHh"
}
`
Where can I find this information in the Graph API?
Related
In Facebook ad manager, I can see different categories of conversions against each campaign i.e.
Website Purchases 9
Website Adds to Cart 724
Website Registrations Completed 6
Website Checkouts Initiated 24
Website Searches 272
I am using graph API to extract this data from Facebook Marketing API(insights, attribution)
Firstly I tried to extract campaign level conversions from insights using
act_ad_Account_ID/insights?date_preset=this_month&action_attribution_windows=7d_click&level=campaign&fields=campaign_name,conversions,conversion_values,cost_per_conversion
But I could not see the categories i.e. website purchases, adds to cart etc. in the retrieved data.
Then I tried using attribution
with query
<Business Unit ID>/conversion_events?fields=name,id,cost_per_1k_impressions
as a result, I retrieved these categories associated with business unit ID overall.
"data": [
{
"name": "Website Searches",
"id": "11*******772",
"cost_per_1k_impressions": 11388.238
},
{
"name": "Website Adds to Cart",
"id": "1121******775",
"cost_per_1k_impressions": 188.238
},
{
"name": "Website Purchases",
"id": "11***********7874",
"cost_per_1k_impressions": 7088.238
},
{
"name": "Website Checkouts Initiated",
"id": "11212**********",
"cost_per_1k_impressions": 17088.238
},
{
"name": "Website Subscriptions",
"id": "1********80141",
"cost_per_1k_impressions": 1137088.238
}
But these are overall stats, I want to retrieve these stats at campaign level. Where to put down a campaign filter. Just using these API first time.
answering my own Question here.
We can get conversion data from insights here:
act_ad_Account_ID/insights?date_preset=this_month&level=campaign&fields=campaign_name,actions
actions return a json, that contain
Website Purchases 9
Website Adds to Cart 724
Website Registrations Completed 6
Website Checkouts Initiated 24
Website Searches 272
all these conversions data that we can see on facebook ad manager against each campaign.
There seems to be nothing in the documentation on how this is achieved.
Using the graph api explorer to achieve this would be of huge help
https://developers.facebook.com/tools/explorer/
Thanks for any feedback.
A described in the doc, you can request the business field:
business: The Business Manager, if this ad account is owned
by one
As example:
curl -i -X GET \
"https://graph.facebook.com/vX.X/act_XXX?fields=business&access_token="
{
"business": {
"id": "XXXX",
"name": "Acme"
},
"id": "act_XXXX"
}
I have 2 questions:
a. The Uber create payment API says I can only create payment methods of type alipay, baidu_wallet,or braintree_grant. I want to use this API (or any other) to upload a card.... is this possible or will the user need to load the card manually into uber and then use the Payment Method API to choose the correct payment Id?
b. When the user makes a ride request from my app, I want associate the trip with a specific card. How can I do this programmatically? In other words, I am looking for some API in RideParameters which will allow me to choose a payment method upfront.
a) There is no API method available that will create new payment methods or upload cards. As you mentioned in your question "user need to load the card manually into uber and then use the Payment Method API to choose the correct payment Id".
b) You can list all available payment methods by using: "GET /payment-methods" endpoint. In the response, you will get a list of available payment methods. Please use only known types - so if user account has some payment methods that are not recognized by Uber - they will be with type="unknown". Sample response looks like:
`Status-Code: 200 OK`
{
"payment_methods": [
{
"payment_method_id": "5f384f7d-8323-4207-a297-51c571234a8c",
"type": "baidu_wallet",
"description": "***53",
},
{
"payment_method_id": "f33847de-8113-4587-c307-51c2d13a823c",
"type": "alipay",
"description": "ga***#uber.com",
},
{
"payment_method_id": "f43847de-8113-4587-c307-51c2d13a823c",
"type": "visa",
"description": "***23"
},
{
"payment_method_id": "517a6c29-3a2b-45cb-94a3-35d679909a71",
"type": "american_express",
"description": "***05"
},
{
"payment_method_id": "f53847de-8113-4587-c307-51c2d13a823c",
"type": "business_account",
"description": "Late Night Ride"
}
],
"last_used": "f53847de-8113-4587-c307-51c2d13a823c"
}
Is there a graph API call to know if a given account is Business accounts or personal account?
When I call the graph API like this,
http://graph.facebook.com/11234545656556 (the number is fake for now)
I do not get any data point that tells me that this is a business account and therefore has no name/username etc..
I only get this response type
{"id": "11234545656556",
"link": "http://www.facebook.com/profile.php?id=11234545656556",
"email": "myemail#mail.com,
"timezone": 0,
"locale": "en_US",
"verified": true,
"updated_time": "2012-05-31T22:32:52+0000",
"type": "user"}
Is there an API call to know the type of the account?
You can definitively get this information via FQL:
SELECT type FROM profile WHERE id=11234545656556
There is an undocumented /profile endpoint in the Graph API, but it does not return a type.
The only other way to test for this would be to look for the presence of a certain field in the Graph API response. e.g. if the response contains first_name, then you know it is a user and if it contains category, then you know it is a page.
I am experiencing the same issue. So far the only way to know if its a personal Facebook account is by checking if the response contains a name attribute.
Following FQL (change the id to some known account):
SELECT type, name, username, url, pic FROM profile WHERE id=11234545656556
Will return type "user" for personal or Business accounts.
Assuming "11234545656556" is a business account, name and username will return inconsistent results it might return blanks or "name": "Facebook User".
Same FQL call for a personal account like this:
SELECT type, name, username, url, pic FROM profile WHERE id=4
Will result in public personal info for that given user.
{
"data": [
{
"type": "user",
"name": "Mark Zuckerberg",
"username": "zuck",
"url": "https://www.facebook.com/zuck",
"pic": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/157340_4_3955636_s.jpg"
}
]
}
I have a "Like"-object data from facebook:
{
"name": "24",
"category": "Tv show",
"id": "14176232250",
"created_time": "2010-10-29T17:46:27+0000"
}
it's possible to get all users, which have that "object" in their "likes"?
It is not possible to retrieve information on users who like a page via either the Graph API or FQL.
See this previous question: Retrieve Facebook Fan Names