Creating saved target group in facebook audience - facebook

I need to create Saved Target Group in facebook programmatically like PowerEditor does it here https://www.facebook.com/ads/manage/powereditor.
During inspecting the browser's console when saving through the Power Editor I've discovered that such kind of an endpoint is used:
"https://graph.facebook.com/v2.2/act_#AD_ACCOUNT_ID#/audiences", but the method called is encrypted and there is no information about this kind of endpoint in the facebook API documentation.
Seems like Power Editor uses more extended API or not all the API is well documented.
Did anybody experience something similar?
Thanks

Not all of the functionality available in Power Editor is available in the public API or vice versa -
If what you're asking about is not in the public API documentation, it's not part of the API that is available publicly -
It would be dangerous to assume that an undocumented endpoint will continue to work or that it works in a specific way based on observing another app (Power Editor) calling it

You can use saved_audiences API.
Here is Graph Explorer request examples:
POST:
https://developers.facebook.com/tools/explorer/765026780221012?method=POST&path=act_&Fsaved_audiences&version=v2.5&name=foo&targeting={ "age_min":18, "age_max":65, "page_types":[ "desktop-and-mobile-and-external" ], "geo_locations":{ "countries":[ "US" ], "location_types":[ "home" ] } }
GET ALL:
https://developers.facebook.com/tools/explorer/765026780221012?method=GET&path=act_%2Fsaved_audiences&version=v2.5

Related

Getting Error while creating audience of CUSTOM type through Marketing API - Facebook

I am using Facebook PHP SDK, and trying to create Audience of Custom TYPE from Marketing API, and I am getting following Error:
You'll need to agree to the Custom Audience terms before you can
create or edit an audience of CUSTOM type. To accept, go to
https://business.facebook.com/ads/manage/customaudiences/tos/?act=129260934125705.
Even though I have already accepted the term, I am still getting the error for accepting the terms.
Please find attached screenshot for Terms Acceptance.. Terms & Condition Accepted Screenshot
I would recommend checking the status of tos_accepted via Graph API explorer. You can also use it to debug your Audience Creation calls.
You can check if a Business has signed their Custom Audience terms of service, by making a GET call to an ad account owned by that Business. The ad account can’t be acting on behalf of another business, or be shared. The GET call is:
GET act_<AD_ACCOUNT_ID>?fields=tos_accepted
A sample response looks like this:
{
"tos_accepted": {
"custom_audience_tos": 1 // this means the terms were signed
},
"id": "act_<AD_ACCOUNT>"
}
Check full docs about TOS here
A bit more info on Custom Audiences
Thanks Artyom Kovalyov.. I have checked the graph API explorer, and this is what I get.
{
"tos_accepted": {
"web_custom_audience_tos": 1,
"custom_audience_tos": 1,
"value_based_custom_audience_tos": 1
},
"id": "act_129260934125705"
}
Please check and let me know if I can do something else to fix the error that I am getting..
It seems ok Vishal. Have you tried to create this same Audience via graph explorer? The ways to go from here are either filing an FB direct support case for your app, they are not usually fast to reply and not every customer is whitelisted for that.
Another assumption is if you try to do it on behalf of your customer with their account, it might be that they have to accept TOS, not you.
FB has a huge amount of setting and from the info, you provide it's pretty hard to tell what exactly fails.

Searching public profiles using Facebook Graph API

I am looking to search Facebook public profiles using the Graph API with parameters like name, location and age. To accomplish this I created a Facebook app to get an app ID but I am unsure as to how to proceed to make the query to the API.
To try it out I tried using the explorer (https://developers.facebook.com/tools/explorer/) but I am unable to get any results that does not contain "me". I made sure to get a access token and enter a query like the following:
search?q=tobias&type=user&fields=id,name
The only reply is:
{
"data": [
]
}
I feel like I am missing something but I have been unable to figure out what, please advice.
The search endpoint is broken since 2018-04-04 for certain search types, including pages and users.
Search API
You can no longer use the /search endpoint with the following object types:
event
group
page
user
See
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4
Due to what has recently been in the news, searching for users has been deprecated, and is not supported through Facebook APIs.

How do I get the Explore and Stream section from the SoundCloud API

I can't seem to find the section in their api reference. I tried it as a searchquery but it doesn't seem to work. api.soundcloud.com/stream or /explore return a 404, so that doesn't work either
Thats actually not a part of the public API.
But its quite easy to grab your call from the dev console.
Thats an example call from my user:
https://api-v2.soundcloud.com/stream?user_id=e87647259112403eaa239b6e2c510e46&sc_a_id=e87647259112403eaa239b6e2c510e46&user_urn=soundcloud%3Ausers%3A1672444&promoted_playlist=true&limit=10&offset=0&linked_partitioning=1&client_id=02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea&app_version=a089efd
To make that call work, you need to modify the headers.
These answers may help you:
Retrieving the "recommended" playlist via API call?
soundcloud: Is api-v2 allowed to be used and is there documentation on it?
How to get "all" tracks related to an artist with Souncloud API
Using these endpoints does not go inline with SoundClouds TOS.

Check JIRA REST API version?

How to check, that rest api is enabled in JIRA and it has appropriate version?
I know, that it is possible to request 'api/latest', but if latest installed version isn't compatible with methods, that i call?
To check that it is enabled, (and to disable it if you wish), then you will need to go to the Administration panel of your instance and enable/disable it there. Specifically you need to go to:
Administration > General Configuration > Set Accept remote API calls to either On/Off
To check if REST api is enabled, just go to (change the URL to your own)
https://jira.atlassian.com/rest/api/2/user
and see if the page loads.
I don't think there is a way using the API to get the API version, but you can make the API calls and fallback in case of an error. The coding depends on what you are trying to achieve.
You can find more info about the REST API at:
JIRA REST API Version 2 Tutorial
JIRA REST API documentation
If your stuck on the coding part, search Atlassian answers and SO or ask a question.
Use the /rest/serverInfo endpoint, e.g. /rest/api/2/serverInfo.
This should return a JSON string with JIRA version, e.g.
{
...
"version": "8.x.x",
...
}
View page source of Jira page and search version.
Sample output:
<meta name="application-name" content="JIRA" data-name="jira" data-version="7.9.2"><meta name="ajs-server-scheme" content="http">

iPhone facebook integration

I am using Graph API in my application. I am fetching user's facebook wall feeds using graph API also getting details of particular post i.e (Like count,Comments etc).
but i want to allow user to Like and Comment any post from the application itself.
what is the request format for that?
Please help me or give any pointers.
Regards,
Sanket
You would be well served to check out the Publishing section of the documentation. It provides information such as this.
One example is liking, which is defined as:
Method: /OBJECT_ID/likes
Description: Like the given object (if it has a /likes connection)
Arguments: none
Basically, just initiate a Graph API call to something like:
[facebookObject requestWithGraphPath:#"98423808305/likes" andDelegate:self];
That will "like" a picture from Coca-Cola (ID taken from the documentation).
Edit 1
According to the documentation:
Most write operations require extended permissions for the active user. See the authentication guide for details on how you can request extended permissions from the user during the authentication step.
Are you sure you have enough privileges? Unfortunately the documentation is very unclear as to whether it serves the dual purpose of liking the object and returning the likes already on that object.
Edit 2
I did some more research into what could be causing this and came across this question and answer that indicated that the code I posted above using requestWithGraphPath:: should work. However, it does not due to a bug on Facebook's Bug Tracker.
Unfortunately, it looks like there is no way to "like" an object via the Graph API, which seems very strange to me. Perhaps it is possible with the legacy REST API instead of the Graph API?
Edit 3
Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. You should be able to use the stream.addLike method to "like" something in the "stream". Unfortunately, it doesn't appear to support photos, videos, etc. Only posts and comments.
Finally i found the solution for LIKE option
We should use following method for like option.
-(void) requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate
graphPath = /OBJECT_ID/likes
Paramas = dictionary with comment ,for like option use empty dictionary
HttpMethod should be POST
you should get response = true if the LIKE request is successful.