getKeywordStats() not working (Facebook API Java SDK ) - facebook

I'm using the official Facebook API Java SDK to retrieve stats for each of the interests used in the targeting of a specific ad (as described in https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats). When trying the call in Graph Explorer it works perfectly but I get an empty response in Java. I have already used the SDK to get insights for campaigns, ad sets and ads so the general setup is working. This is the code I have for now:
APINodeList<AdKeywordStats> stats = new Ad(adId, CONTEXT).getKeywordStats()
.requestAllFields().execute();
System.out.println(stats);
EDIT:
After some digging I think I found the cause of the problem, hopefully this PR should fix it: https://github.com/facebook/facebook-java-ads-sdk/pull/149

Related

New Google Sites API

I know the current Google Sites API only supports Classic Sites.
Does this API exist now? and How to manage(create and etc) New Google Sites though API?
No, an API doesn't exist.
There are several feature requests in the issuetracker.google.com site, so they are aware it is needed. You would think they have some of the framework developed, since there is currently some access to sites (and I don't mean for editing) through the existing drive API. It would be worth adding your comments to those requests in the issue tracker website.
https://issuetracker.google.com/issues/36761330
https://issuetracker.google.com/issues/7324991
https://issuetracker.google.com/issues/120462223
https://issuetracker.google.com/issues/205856782
Though Google Sites API is still not available, I discovered some good news (for my use case, at least). I can confirm there are some minimal Google Sites abilities available through the Google Drive API. Specifically, I was able to add a user to the my site as viewer to a published site, using the Drive API permissions. Here is the Python code.
# get boilerplate creds= code from here https://developers.google.com/drive/api/quickstart/python
drive = build('drive', 'v3', credentials=creds)
new_permission = {
'type':'user',
'role':'reader',
'view':'published',
'emailAddress':USER_EMAIL
}
# you can get the SITE_FILEID from the site url
res = drive.permissions().create(fileId=SITE_FILEID, body=new_permission).execute()
Since the OP specifically asked about create, that works like so:
new_file = {
'name':'test site2',
'mimeType':'application/vnd.google-apps.site',
}
res = drive.files().create(body=new_file).execute()
Hope this can help some folks.
If you check Google sites api at the very top of the page it states.
If there was an api for accessing the new version they would have stated it. There is not.
According to this question, Google planned the new API for Google Sites for end of 2021: https://support.google.com/sites/thread/3363462/is-there-any-eta-for-the-new-google-sites-api?hl=en
I did not hear any news, since that.

Facebook Insights API Conversions are NOT matching Facebook Ads manager Results

When trying to fetch Facebook insights API for the following action offsite_conversion.fb_pixel_purchase I always get less number than Facebook show on their ad manager, I tried to inspect their network calls and URL structure and I see they're using the same field offsite_conversion.fb_pixel_purchase to show Results I am not sure why the numbers are mis-matching. I tried to query from the Graph API and from my shell with the same results.
You may check use_account_attribution_setting and use_unified_attribution_setting in here: https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/insights
Setting use_unified_attribution_setting to true worked for me.
I did some testing and found out that if you use an additional breakdown, FB will return less conversions. There might be a bug in their API when you use breakdowns.
I tried getting offsite_conversion.fb_pixel_purchase with
'breakdowns' => 'hourly_stats_aggregated_by_advertiser_time_zone',
and facebook retuned 5 conversions.
if I remove the breakdown and get the data grouped daily I get 11 conversions which is what Facebook Ads Manager shows

Uber API /v1/estimates/time responds No authentication provided

In order to test if the urls I made is correct, I put them in my browser to see if I can GET results.
First, I tried GET /v1/products which should return all types of cars and I put it in the browser like this:
https://api.uber.com/v1/products?server_token=MY_TOKEN&latitude=39.914286&longitude=116.461745
Which works fine and gives me a big JSON of products:
{"products":[{"capacity":4,"product_id":"0ed2dbad-c769-41f5-b66d-0767da627f9e","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber +","display_name":"People\u2019s Uber +","description":"People's Uber +"},{"capacity":4,"product_id":"6bf8dc3b-c8b0-4f37-9b61-579e64016f7a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber","display_name":"People's Uber","description":"People's Uber"},{"capacity":4,"product_id":"93a40036-2670-4a41-bc59-1e901ca33632","price_details":{"service_fees":[],"cost_per_minute":0.4,"distance_unit":"km","minimum":20.0,"cost_per_distance":2.3,"base":15.0,"cancellation_fee":15.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-china-uberx.png","short_description":"uberX","display_name":"uberX","description":"The low-cost Uber"},{"capacity":4,"product_id":"259df3b5-e062-4b2b-ab81-3e3fbba4b423","price_details":{"service_fees":[],"cost_per_minute":0.7,"distance_unit":"km","minimum":30.0,"cost_per_distance":3.85,"base":18.0,"cancellation_fee":20.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-black.png","short_description":"UberBLACK","display_name":"UberBLACK","description":"The original Uber"},{"capacity":4,"product_id":"d1b0005e-8e33-44f1-b1e5-b3f98138642a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-electric.png","short_description":"Electric Vehicles","display_name":"a","description":"a"}]}
Then, I tried GET /v1/estimates/time, with the SAME COORDINATES and SAME SERVER TOEKN, I made the url like this:
https://api.uber.com/v1/estimates/time?server_token=MY_TOKEN&start_latitude=39.914286&start_longitude=116.461745
But it returns:
{"message":"No authentication provided.","code":"unauthorized"}
If the token has expired it should not work with the Products API which actually is working fine, so I don't think that's the issue. Please help, thanks.
BTW, I am testing Uber API in China in case the location may affect the results here.
The GET /v1/estimates/time endpoint has a regional dependency which is probably why it's not working for the China location. Try it out after creating your app on the China Developer dashboard: https://developer.uber.com.cn/ and using that server token with api.uber.com.cn.
Documentation for this can be found here: https://developer.uber.com/docs/china

/act_{account-id}/adcreatives creative_ids parameter is not working in the Facebook Ads Graph API

I have an application that uses the Facebook Ads OLD REST API and recently I heard that it will be deprecated in a month, so I'm working hard to migrate all my code to the new Graph API...
Unfortunately, nothing goes smoothly.
when calling to GET /act_{account-id}/adcreatives to get the AdCreatives for a specific campaign the parameter creative_ids is not working and always retrieving all the creative for the account!
This was working fine in the rest api... and no documentation changes were made in ads.getCreatives so I'm assuming creative_ids paramter is still there...
Any help will be appreciated!
thanks,
Yaniv Hakim
I found the _ids parameters to be finicky so I use the generic ids=comma-separated list parameter, without the act_{account-id}. Creative IDS are unique across accounts so there's no need to specify the account-id. If you want to use the specific parameters, have you tried creative_id, creativeids, creativeid and other permutations you can think of (with and without account-id)?

facebook chat on the iphone using xmppframework

Well i started of by following all the instructions here:
http://code.google.com/p/xmppframework/wiki/FacebookChatHowTo
I used the recommended fork of the facebook api and tried the latest from:
https://github.com/facebook/facebook-ios-sdk/
My problem starts with the following error:
< failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">< not-authorized/></failure>
The error is a reply from facebook to xmppframework s response to a authentication challenge. The response that is made by the iphone is base64 encoded msg when i decode it i find 2 of the values are null:
api_key=(null)
and the
session_key=(null)
This is obviously the reason facebook is returning that error. But the problem i have is i cant seem to find any where to set these values in the framework. Besides i think the session_key should be pulled in from facebook anyway.
I guess what i want to know is a couple of things.
Has any one got the xmppframework working with facebook on a iDevice?
If you have got it working did you have to stray from the path of the instructions on http://code.google.com/p/xmppframework/wiki/FacebookChatHowTo ?
do you know of any other method to get facebook chat working on the iphone?
Any suggestions or help for my current dilemma would be appreciated. Happy to share my code if you want.
cheers
I wrote the Facebook integration for XMPPFramework. The api_key and session_key, come from a call to auth.PromoteSession. Facebook is trying to deprecate that call, so to enable it, you must follow step 7, in the HowTo:
Under Migrations, change Disable Deprecated Auth Methods from Enabled to Disabled and Save Changes.