Posts tagged with rest

Is it possible to retrieve Facebook Group members' physical mailing addresses from any of Facebook's API's (is it Graph API we would use?)

Can anyone verify? I know we can get the user's emails but it would seem the mailing addresses would not be available due to privacy concerns.

I have checked through the documentation and found this: https://developers.facebook.com/docs/graph-api/reference/mailing-address/ but digging a bit further it seems this is only for business' mailing addresses.

Making get request for creating page-access-token for facebook graph API returns blank data object.

The request is like below according to the official doc:https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#pagetokens

curl -i -X GET "https://graph.facebook.com/{your-user-id}/accounts?access_token={user-access-token}"

This worked at least half years ago, now the request returns blank data[] object. I tried both curl command line and Graph API Explorer.

On Graph API Explorer, Submiting GET https://graph.facebook.com/{version}/{App-Scoped User ID}/permissions returns

{   "data": [     {       "permission": "pages_show_list",       "status": "granted"     },     {       "permission": "pages_read_engagement",       "status": "granted"     },     {       "permission": "pages_read_user_content",       "status": "granted"     },     {       "permission": "public_profile",       "status": "granted"     }   ] } 

But submiting GET https://graph.facebook.com/{version}/{App-Scoped User ID}/accounts returns

{   "data": [   ] } 

Any ideas to solve this issue?


[updated 1] I found the request works for another facebook account. I don't understand why for some accounts request returns blank data(i.e. blank page access token). The user account which fails to create page access token now is the one which could create access tokens last year.

[update 2-A] I checked differences between working example and failed one, and found that requested pages_read_user_content looks like canceled or ignored for the failed one. On graph explorer, after doing "get page access token", pages_show_list and pages_read_engagement are successfully added, but pages_read_user_content is pending with green-colored text. I think this is a hint of this issue, and this article may be related. [updated 2-B] I found another difference about them. After deactivating all permissions for the page on Business Integrations, the pending issue is solved, but the main issue is not solved, so pages_read_user_content seems to be not related to this issue.

[updated3 and solved] I found unofficial tips here. The solution process is a little bit tricky, first you have to run the Delete permission command like this:DELETE https://graph.facebook.com/{version}/{App-Scoped User ID}/permissions and deactivate the app for the facebook page on Business Integrations(after clicking View and edit button for the app, toggle and deactivate all of the WHAT BUSINESS FEATURES CAN BE MANAGED section). Once that's done, you create tokens again from scratch.

I wanna get out campaigns reports using Google Rest API and it does'nt work in Google ads Apps script.

My code:

function main() {    const API_VERSION = "12"; const CUSTOMER_ID = "***"; //contais real custommer ID const DEVELOPER_TOKEN = "***"; //contais real developper ID const MANAGER_CUSTOMER_ID = "***"; //contais real manager ID const OAUTH2_ACCESS_TOKEN = ""; //contais real ACCES TOKEN const data = {   "pageSize": 10000,   "query": "SELECT ad_group_criterion.keyword.text, ad_group_criterion.status FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.status = 'ENABLED'" }; const url = `https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/googleAds:search`; const options = {   method: "POST",   headers: {     "Content-Type": "application/json",     "developer-token": DEVELOPER_TOKEN,     "login-customer-id": MANAGER_CUSTOMER_ID,     "Authorization": `Bearer ${OAUTH2_ACCESS_TOKEN}`   },   body:  JSON.stringify(data),    "muteHttpExceptions": true }; Logger.log(UrlFetchApp.fetch(url, options)); } 

Result error: { "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v12.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "queryError": "UNEXPECTED_END_OF_QUERY" }, "message": "Error in query: unexpected end of query." } ], "requestId": "zKBR9-dJoG9NWAx3iJea2g" } ] } }

But query is valid https://developers.google.com/google-ads/api/fields/v11/query_validator enter image description here

Could you plese help?

Thanks

I wanna get out campaigns reports using Google Rest API and it does'nt work. My code and result is above.

I am trying to create ads in Google using REST Api. As per the REST API documentation passing the following request body.

{ "operations": [     {         "create": {             "adGroup": "customers/*********/adGroups/*********",             "status": "PAUSED",             "ad": {                 "expandedTextAd": {                     "headlinePart1": "Example heading",                     "headlinePart2": "Exmaple heading 2",                     "description": "Sample description about ad"                 },                 "finalUrls": [                     "https://www.example.com"                 ]             }         }     } ], "partialFailure": false, "validateOnly": true } 

Endpoint: https://googleads.googleapis.com/v11/customers/{customer_id}/adGroupAds:mutate

Anyone can suggest what I am missing?

I am trying to upload a conversion using REST API, as I am writing code in rust hence no library is there for that, I am struggling to get the correct response, as, I am not aware of what should the proper request body, and there is no sample payload for a request given by google, the help available is not sufficient to make my request thru.

URL https://googleads.googleapis.com/v10/customers/948-412-1501:uploadClickConversions

Header: 'developer-token': 'X8ec', Authorization: 'Bearer ya29', 'Content-Type': 'application/json'

Post Body { "gclid": "0988098080", "conversionAction": "Submit lead form", "conversionDateTime": "2022-08-06 12:32:45-08:00", "conversionValue": "10", "currencyCode": "10", "orderId": "11111" }

Response

{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name "gclid": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionAction": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionDateTime": Cannot find field.\nInvalid JSON payload received. Unknown name "conversionValue": Cannot find field.\nInvalid JSON payload received. Unknown name "currencyCode": Cannot find field.\nInvalid JSON payload received. Unknown name "orderId": Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Invalid JSON payload received. Unknown name "gclid": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionAction": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionDateTime": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "conversionValue": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "currencyCode": Cannot find field." }, { "description": "Invalid JSON payload received. Unknown name "orderId": Cannot find field." } ] } ] } }