Facebook API - Can't update adset targeting's geolocation by zip codes - facebook

I'm trying to update my adset's targeting location to include 2 zip codes 85233 and 85224 but facebook keeps returning an Unknown error.
My request is
https://graph.facebook.com/v2.11/[ADSET_ID]
targeting={ "geo_locations":{"zips":[{"key":"US:85233"},{"key":"US:85224"}]}}
access_token=[ACCESS_TOKEN]
Response:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "EA9s0p59E9h"
}
}
Please let me know the correct way to do this?
UPDATE: I have tried to update adset geolocation by lat and lng but the same error happened.
{
"geo_locations":{
"custom_locations":[
{
"radius":30,
"latitude":30.1519297,
"longitude":-97.8338758
}
]
}
}

Can you try to use "/v2.4/" and check whether it returns a proper response?
Because it seems like a FB API bug. Check this: https://developers.facebook.com/bugs/486654544831076/

Related

Get Commenter's Profile Picture - Facebook API

I have this code
var source = new EventSource("https://streaming-graph.facebook.com/<livestream id>/live_comments?access_token=<access token>&comment_rate=ten_per_second&fields=from{name,id,picture},message,attachment");
source.onmessage = function(event) {
}
But it only includes the profile photo of Pages that comment on the livestream. It doesn't have the profile picture data for Regular Users who comment on the stream.
event data when a Page comments:
from: id: "104156481935516" name: "Person 1" picture: {data: {…}}
[[Prototype]]: Object id: "458166779554976_383292267259200" message:
"test comment""
event data when a Regular User comments:
id: "458166779554976_751936735966533"
message: "regular user test comment"
Is there a way to get the profile picture of the Regular Users? I also can't get their names. I already tried
http://graph.facebook.com/<user id>/?fields=picture&type=large&access_token=<access token>
but I get the error:
{
"error": {
"message": "Unsupported get request. Object with ID '<user id>' 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,
"error_subcode": 33,
"fbtrace_id": "AfEpta2noSLzSiJ32LdqJAS"
}
}
I only get the error above when trying to fetch other people's profile pic. It works ok when I try to fetch my Page or other Pages.

I wanna get posts' usernames through their(posts') ids if I they don't belong to me. So, how can I do it?

I have two access_tokens:
From Instagram Graph API:var fs_access_token, which I get after I log in with Facebook;
From Instagram Basic Display: var inst_access_token;
SO
I have the collection of posts' ids, which I get through ig_hashtag_search:
var posts_ids; //!= null;
I also have 3 posts on my Instagram business account.
And I try to get usernames of all this posts that I have in my collection with one endpoint:
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
response.text().then(function (text) {
alert(text); //using Instagram Basic Display
});
});
}
But then I get the error from this request:
{
"error": {
"message": "Unsupported get request. Object with ID '17884048231750634' does not exist, cannot be loaded due to missing permissions, or does not support this operation",
"type": "IGApiException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AKiycowo9LbwZbKzxOL-EQ9"
}
}
Interesting fact: if I insert the id of one of posts that I have on my Instagram business account instead of posts_ids[u], then it WILL work!
SO, what the hell's going on here? It means that I can get "username data" only from posts that I have on Instagram account, doesn't it? Or what?
I also tried to get usernames with other endpoind, where of course I used other access_token, which I get after I log in Facebook(access_token that I used above was access_token, which I get after I log in Instagram; Instagram Graph API - log in Facebook, and Instagram Basic Display - log in Instagram):
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
But then I again get the error from request:
{
"error": {
"message": "Unsupported get request. Object with ID '17884048231750634' 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,
"error_subcode": 33,
"fbtrace_id": "AhN5o9eopccP4NrQsu8QuaN"
}
}
And again interesting fact: if I insert the id of one of posts that I have on my Instagram business account instead of posts_ids[u], then it WILL work!
I also tried to do so:
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
and
for (var u = 0; u < posts_ids.length; u++) {
fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
response.text().then(function (text) {
alert(text);
});
});
}
But then I get this error:
{
"error": {
"message": "Invalid OAuth access token.",
"type": "OAuthException",
"code": 190,
"fbtrace_id": "ARVMttFmcIAfwBTPdYcMEfQ"
}
}
Most likely, this is because I am trying to combine the access token from Instagram with the technology for working with Facebook and the access token received from Facebook with the technology for working with Instagram.
So couldn't you please help me to find endpoint in Instagram Basic or Instagram Graph which allows to get usernames from posts of the OTHER users(especially through ids which I get with Hashtag Search/recent_media)? Or couldn't you help me to understand how to use it correctly? Because I am a beginner and may not know some details. Please, help me!
Unfortunately you can't. You can find the following under the Limitations section on the hashtag endpoints.
You cannot request the username field on returned media objects.
Ref: https://developers.facebook.com/docs/instagram-api/reference/hashtag/recent-media

SuiteCrm Rest API: JSON Body attributes throws error when calling POST or PUT

I'm using postman in order to call SuiteCRM REST API.
I tried to call this endpoint
PATCH http://{{suitecrm-url}}/Api/V8/module
and i've added this payload to the body (Content-Type: Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
When the request is executed SuiteCRM gives this response:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
I found out that the problem was the whitespace in the value: when i tried to use the value "namewithspace", it worked.
Anyone has any idea how to solve this problem ?
Thanks in advance
I found out this issue on github that resolved my problem:
https://github.com/salesagility/SuiteCRM/issues/6452
In short to make it work i had to modify the file in
/Api/V8/Params/Options/Fields.php
and replace this line
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
with
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
The person mentioned in github:
this is just for temporary fix and not upgrade safe

meetup api DATE error

I got a problem with the v3 of api meetup.com
Trying to request the api:
GET https://api.meetup.com/find/upcoming_events?sign=true&key=VALID-API-KEY&lon=32.97&page=1000&lat=4.95&page=20&offset=0&end_date_range=2018-07-19424:00:00
Expected behavior:
HTTP/1.1 400 error
{
"errors": [
{
"code": "end_time_range_error",
"message": "end_time_range is not a valid time",
"field": "end_time_range"
}
]
}
Actual behavior:
HTTP/1.1 200 success
{
[...]
}
From the docs:
end_date_range: Return events that start before this date. The date
must follow this format: YYYY-MM-DDTHH:MM:SS.
https://www.meetup.com/de-DE/meetup_api/docs/find/upcoming_events/?uri=%2Fmeetup_api%2Fdocs%2Ffind%2Fupcoming_events%2F
So it is all about:
from the docs: YYYY-MM-DDTHH:MM:SS
from my request: 2018-07-19424:00:00
Any hints?
Hopefully, it's not too late for an answer to this question. If so, maybe this would be helpful for somebody else.
The correct format for this one is 2018-07-19T16:00:00

How should we retrieve an individual post now that /[post-id] is deprecated in v2.4?

I just tried through the Graph API Explorer with this path /v2.4/10153513872748291 and I've got this result:
{
"error": {
"message": "(#12) singular links API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12
}
}
But https://developers.facebook.com/docs/reference/api/post/ doesn't say anything about deprecation.
I'm not sure if I miss something, or there's another way to get info about an individual post.
Edit: v2.3 works, but v2.4 is the latest one.
Looks like you now need to the combination of the id of the user or page that made the post (or whose wall it is on), an underscore, and then the post id.
For your example post, 10153513872748291, that is made by a page Drama-addict, that has the id 141108613290 – so 141108613290_10153513872748291 will work.
And so does 788239567865981_10153513872748291, because 788239567865981 is the id of the user making the post.
Firstput userId underscore add postId /Likes to check Like status in facebook
userId_post_Id/Likes to fetch Likes Records
userId_post_Id/Comments to fetch Comments Records
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=303261006522998_751199848395776%2FLikes&version=v2.9
**In this link Right side Get Token indide GetAccessToken to select Permission**
303261006522998_751199848395776/Likes
303261006522998_751199848395776/Comments
{
"data": [
{
"id": "124778301449917",
"name": "Manisha Gera"
},
{
"id": "1680577265523548",
"name": "Rubi Sharma"
}
],
"paging": {
"cursors": {
"before": "MTI0Nzc4MzAxNDQ5OTE3",
"after": "MTY4MDU3NzI2NTUyMzU0OAZDZD"
}
}
}