I am using a sandbox account to test the API calls. Based on the instructions posted here: https://developers.facebook.com/docs/marketing-api/reference/ad-image I am trying to make a POST call to upload an image so that I can then create an FB Ad. The API comes back with an error
Unsupported post request. Object with ID 'act_1234567890' does not exist, cannot be loaded due to missing permissions, or does not support this operation.
I have looked at this post Upload image_file using Ads API but neither of the calls worked.
It's worth mentioning that I can create Campaigns and Ad Sets for that sandbox account, I get this permission error only when trying to upload an image so that I can create an AD (https://developers.facebook.com/docs/marketing-api/reference/adgroup)
Posting the answer as it appears there are other people who run into this issue (see comment by #gwely).
After a lot of back and forth with FB Support, their response boiled down to
This probably is a Windows specific question as specifying filename as #path/to/file just works for me. You can try calling the command in the images folder to verify if that works for you."
So I ended up installing CURL on my windows machine and was able to make the call via CURL. The curl command was
curl \
-F 'filename=#image_name.jpg' \
-F 'access_token=YOUR_TOKEN' \
"https://graph.facebook.com/v2.11/act_115606837999493/adimages"
Hope it helps.
Related
I hope someone can help me with figuring out how to use authenticated URLs with gcs.
What I am trying to archive:
I want to send someone an authenticated gcs link (not pre-signed): e.g. https://storage.cloud.google.com/XXX/happy-simon.png
That person needs to log into their Google account
If they have the proper rights, they can download the file
Problem:
Whem I try to access an authenticated URL for GCS they do not work in the browser, but only when the Header "referer: https://console.cloud.google.com/" is set.
How to reproduce:
Upload a file to gcs
Give yourself at least read privileges on that file (you should be owner anyways as you uploaded it)
Try to download it via the "Authenticated Url"
3.1) When I click on the link in the google cloud console the download works without problems
3.2) When I copy the url and open it in a new tab I get a 403 error
Testing with curl on the console I found out that the difference between the two calls is wether the -H 'referer: https://console.cloud.google.com/' is set or not. If I set it, also the call from the new tab works.
I'm trying to create a test page on Facebook while developing an app. Per the instructions, I've created a test user, noted the user id and created an access token.
I'm now trying to make a POST request via curl to create a page
curl -i -X POST https://graph.facebook.com/v3.3/{user-id}/accounts?category_enum=MARKETING_AGENCY&name=Test%20Page&access_token={access-token}
However the response is an error
(#100) The parameter name is required
Seems I have supplied the name parameter though; any ideas?
EDIT
If I remove the category_enum param, the error becomes
(#283) Requires manage_pages permission to manage the object
However, I have verified the user has the manage_pages permission....
Beware of the facebook api documentation... On the surface it looks like only the name parameter is required, however after hours of experimentation with the Graph API Explorer I managed to create the test page with no less than 9 required parameters!
I'm trying to use bigrquery from an interactive R session for the first time. I've installed the R bigrquery package and successfully established a connection. I've authenticated following a redirect from the interactive RStudio session to the web browser for login, so oauth seems to be working correctly. However, when I try to run a query, such as DBI::dbReadTable(con, "A549_raw_merged_TADs")[1:6, ], I get the error Error: The project variant-annotation has not enabled BigQuery. [invalid].
I am sure I need to enable something else in the project on the Google side, but I'm not sure what I need to enable, or how to do that from the web console interface.
Is this documented anywhere, or can anyone here give me instructions?
Note: I have confirmed that the BigQuery API has Activation status of Enabled via the console at https://console.cloud.google.com/apis/api/bigquery-json.googleapis.com/overview, so although my question is the same as Error processing job: Project has not enabled BigQuery, the issue appears to be different.
Additional information: when I check the BigQuery API status via the console link above, there's a notification that "To use this API, you may need credentials. Click 'Create credentials' to get started."
So it may be that my assumption that oauth seems to be working is not correct.
You can enable the BigQuery API with this command gcloud services enable bigquery.googleapis.com, but, since you mention it is already enabled, you may be pointing to a different project.
Feel free to ping me on a new thread if you require assistance on the new issue.
As you can see in this picture
I have a valid long-life Access Token for my app (390068587730802) with the following permissions: ads_management, manage_pages, read_insights, user_friends
I can use it to get data on another accessible app (50813163906) using the Graph API Explorer,
$facebook->getUser(); does return my user id
HOWEVER, I get NULL from the same request via the PHP SDK.
I have tested locally on xampp and on an apache server. I have updated the PHP SDK today to include the latest changes surrounding offline_access and long life tokens. I have read dozens of posts and FB documentation. I´m glad to read more you think will help, but please note that my token is valid, long lived, and I am successfully getting "/me" from the graph API. All of this happens under http or https.
UPDATE "Facebook: Sorry, something went wrong. We're working on getting this fixed as soon as we can."
As seen in this next picture below, I´ve var_dump´d the CURL options to verify the correct access_token and URL is actually being called. Furthermore, I can copy these urls directly into the browser and get complete data return!!
If during my testing I have created "two active sessions" - as some docs warn - how can you test for that? Most importantly, why would the same FB insights query work in the Graph API Explorer, but return null with PHP SDK?
It turns out that "since=30 days ago" was giving a 400 (bad request) response. This error was not showing up in the CURL errors. Only via
curl_getinfo($this -> ch,CURLINFO_HTTP_CODE);
When i changed
$period = "{$period} days ago";
to
$period = urlencode("{$period} days ago");
//or
$period = strtotime("- {$period} days");
everything worked via CURL.
I have an app and I want to post to the users feed.
All the users have allowed publish_stream permission but I have no idea how to post to their feeds which I should be able to do even if the user is offline.
I want to use curl and the graph like this:
curl -F 'access_token=...' \
-F 'message=Hello, Arjun. I like this new API.' \
https://graph.facebook.com/arjun/feed
Do I simply use the access code I got when the users initially allowed me access, or do I have to get a new access code each time I want to post to their feed, if so, how do I do that?
Any help, much appreciated.
After the user authorized your application you get an access-token from facebook. You can use this token to post to the users-wall until he changes his password or removes your application from his application list.
I think you need to include your api-key in the request. Otherwise please provide the error message your getting!