Cannot delete Instagram realtime subscriptions - real-time

I am running into an issue where I can subscribe to realtime updates on tags but I cannot delete these subscriptions.
Subscribing works fine, and I can prove that the subscription step works by GET'ing the subscription list:
curl -X GET 'https://api.instagram.com/v1/subscriptions?client_secret=SECRET&client_id=ID'
{"meta":{"code":200},
"data":[{"object":"tag",
"object_id":"winter",
"aspect":"media",
"callback_url":"http:\/\/SITE.com:7000\/ig",
"type":"subscription",
"id":"4747294"},
{"object":"tag",
"object_id":"snow",
"aspect":"media",
"callback_url":"http:\/\/SITE.com:7000\/ig",
"type":"subscription",
"id":"4747295"}]}
This yields two tag subscriptions (winter and snow, in my case). However, the same code taken from the Instagram Developer instructions for deleting subscriptions is failing:
curl -X DELETE 'https://api.instagram.com/v1/subscriptions?client_secret=SECRET&object=all&client_id=ID'
Oops, an error occurred.
Is this an Instagram-side problem or is my DELETE command erroneous?

I'm getting the same error with code that had been working, so the problem appears to be on their side. I would suggest filing a bug report.

Related

Gerrit REST API and web GUI with different results

It seems that the web interface of Gerrit and the REST API show different results for the review votes.
For example, Change I78c787fd5dd09fc7700f3093341532fe23f20eb8 from the Android Gerrit review instance shows that Dima Zavin voted +2 (LGTM, approved).
The default values for the Android instance are
-2: Do not submit
-1: I would prefer that you didn't submit this
0: No score
+1: Looks good to me, but someone else must approve
+2: Looks good to me, approved
However, the REST API returns no +2 at all, only +1:
curl "https://android-review.googlesource.com/changes/?q=change:I78c787fd5dd09fc7700f3093341532fe23f20eb8&o=DETAILED_LABELS"
Interestingly, this URL seems to work:
curl "https://android-review.googlesource.com/changes/I78c787fd5dd09fc7700f3093341532fe23f20eb8/detail"
What is wrong?
It turned out to be a bug in the Gerrit backend.
You need to add quotation marks to your curl URL:
curl "https://android-review.googlesource.com/changes/?q=change:I78c787fd5dd09fc7700f3093341532fe23f20eb8&o=DETAILED_LABELS"

How do I get the campaigns list through the ads API on Facebook?

I am trying to get the campaigns list from the Graph API Explorer. I'm using the request found at https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/.
GET /v2.8/{ad-account-id}/campaigns HTTP/1.1
Host: graph.facebook.com
I'm' business manager and admin of the page used for ads. I found the AD_ACCOUNT_IDs using the following request on the Graph API Explorer.
GET /v2.8/me/businesses HTTP/1.1
Host: graph.facebook.com
I choosed the one which had the higher privileges.
The error reported when submitting the first request for campaigns is:
{
"error": {
"message": "Unsupported get request. Object with ID '1015359838XXXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "DLyfwGbM8fi"
}
}
What's wrong?
Thanks in advance,
Mattia
#Ryan's answer saved my day. It may sound stupid/silly but I was doing this mistake and I was just stuck at it.
Going through the FB docs for using the Marketing Apis.
I was trying to build the custom audience, this is how the curl request looks like -
One of the basic things to keep in mind while using the Marketing API is, almost all the APIs ask for these two things -
1) ACCESS_TOKEN
2) AD_ACCOUNT_ID
For people who are just starting with the FB Marketing API or somehow stuck in finding these values, I will just tell you how to get these values, so that you don't have to waste your time as I did.
So for getting the ACCESS_TOKEN, go to your app dashboard then click Add Product and then select Marketing API. Once you added the product, this is how the screen should look like -
Now just check the permissions and click on the Get Token button, a token would be generated. Just copy the token in some file and save it.
Now for getting the AD_ACCOUNT_ID value, just go to the Adverts Manager page -
The number that is written inside the red box in you Adverts Manager page is your AD_ACCOUNT_ID.
The final step would be to go back to you app dashboard again, Settings > Advanced
Click on Ads API and then enter the AD_ACCOUNT_ID here. Thats it, you have finished the Access and Authentication process for using the marketing API via your App.
Now comes the part where I was doing the silly mistake. The curls request looks like this -
curl \
-F 'name=My new CA' \
-F 'subtype=CUSTOM' \
-F 'description=People who bought from my website' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/customaudiences
First I replaced ACCESS_TOKEN with its value.
Then instead of replacing only the <AD_ACCOUNT_ID> I replaced the whole string act_<AD_ACCOUNT_ID>, with the AD_ACCOUNT_ID value.
So I was getting this error while making request to the API which was -
{"error":{"message":"Unsupported post request. Object with ID '120574219' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100,"fbtrace_id":"YsSvKKwgLMQ"}}
I don't know why I made this mistake but I am sure this is one of the common mistake others are doing too. Since the response from FB was misleading, I wasted a lot of my time in understanding and reading on the API permissions and authentications.
Hope this article was helpful and save your time.
I similarly was having problems trying to retrieve a list of all campaign IDs within an ad account.
I already am able to retrieve campaign data by ID, so I obviously have permissions already.
But the Facebook error message is misleading.
When retrieving an ad account (in order to then display its campaigns or whatever you want within it), you need to retrieve by its ID prepended with 'act_'.
E.g you could request /act_123456789000001234/campaigns instead of /123456789000001234/campaigns.
Thanks so much to #Jan Sommer at https://stackoverflow.com/a/39974857/470749.

Can you use the Facebook API to delete old posts?

I am new to using the Facebook API and just started playing around with it.
I was wondering if it is possible, for example an app, to delete past posts (that exists on the timeline, i.e, Can an app have the functionality to delete posts that exists before the app was started?)
Thanks.
Looking at the relevant documentation, you are able to delete a post only if it was your application that created it.
An app can delete a post if it published it
You have not stated which language/SDK you are using, but the above link has examples for each supported SDK.
Here is an example using the PHP SDK:
$response = $facebook->api(
"/{post-id}",
"DELETE"
);
What you would need to do is make a DELETE request to /post_id.
Keep in mind that you will need the publish_actions permission to perform this action.
This is tricky - the answer is yes and no.
You can use the API to get a list of old posts, but then you need to delete them via the browser. This tool does just that:
https://github.com/chander/social-network-cleaner
However, it's written in Python and requires a bit of tech know-how.
This is possible now
Delete a Post
To delete a Page post, send a DELETE request to the /{page-post-id} endpoint.
Before You Start
You will need the following:
The pages_manage_posts permission
The pages_read_engagement permission
A Page access token requested by a person who is able to perform the CREATE_CONTENT task on the Page that is being queried
Sample Request
curl -i -X DELETE "https://graph.facebook.com/{page-post-id}
?access_token={page-access-token}"
On success, your app receives the following response:
{
"success": true
}

Like button on content will not work until URL is submitted to Facebook debug tool

I'm troubleshooting an issue where the Like button won't work on my site unless the URL is submitted to the Facebook debug tool.
When I hit like I'm seeing two requests fire to comment_widget_shell.php. Once succeeds (302 found), while the other fails, showing a status "(canceled)" and type "pending":
The successful request:
Request URL:http://www.facebook.com/plugins/comment_widget_shell.php?locale=en_US&master_frame_name=f236db264&offsetX=0&sdk=joey
Request Method:GET
Status Code:302 Found
The failed request:
Request URL:https://www.facebook.com/plugins/comment_widget_shell.php?locale=en_US&master_frame_name=f236db264&offsetX=0&sdk=joey
As of the writing of this question, here is an example URL where like fails:
http://www.zujava.com/geisha-makeup
I iniitally thought it was this Stack Overflow issue, as the site runs on a platform somewhat similar to Heroku, but for Drupal (Pantheon) and I can't reproduce the issue locally. However, I contacted Pantheon support and they reported the Heroku limitation does not exist on Pantheon.
I'm not sure what other tools I can use to debug this. My article pages get a clean report from the Facebook Debugger. Any ideas or tips of what I can look deeper into?
I have had pretty good luck with pantheon. If your just trying to get a like button on drupal why not use http://drupal.org/project/fb_social/ I have used this in d7 and d6 and I have never had a problem.
Pantheon should be able to handle a request to facebook for sure
thanks
Nick

Is there a trick to editing the status of an Ad Group?

According to the Facebook documentation, you can update the run status of an individual ad group via the ads api.
To do this, you submit a POST request to /<AD_GROUP_ID>/ with adgroup_status=X where X is your status (1 for active, 9 for paused, etc). However, making this request results in the status NOT changing, and the only response you get back from Facebook is a JSON representation of the Ad Group.
Has anyone been able to successfully submit ad group status updates to the facebook ads api? If so, are you using the method outlined above, or is there another trick to it?
thanks!
EDIT
I cross posted this into the Facebook Bug tracker in hopes to create a trail/awareness/find more people who were having this problem. https://developers.facebook.com/bugs/354657724569051
EDIT
An example of the request I'm making. This request is being tested from the Facebook Graph Explorer
https://graph.facebook.com/6003521999629?adgroup_status=9&method=POST&access_token=<access_token>
We have not been experiencing problems with changing adgroup_status. Try submitting the status number as an integer and then as a string (I don't remember which type they expect). Note that if the campaign is paused, setting the adgroup_status to 1 will actually change it to 8 (campaign_paused). The fact that you're getting the adgroup to redownload (I presume you have the redownload=1 parameter) tells me that your call is mostly correct. I just confirmed that this works:
curl -F "adgroup_status=9" \
-F "ids=..." \
-F "access_token=..." \
https://graph.facebook.com/
If you're making that API call and receiving the adgroup's details back instead of a 'true' response, it means you're making a GET request, not a POST request.
Update your code to make a HTTP POST request, and this will resolve your issue, John Pickard's answer above is an example of making a POST request in curl, but it will change depending on your application's language and/or which Facebook SDK you're using.