Is there a way to search for public events on Facebook which includes these parameters:
Location
Keyword
Period (month of September let's say)
Thnx!
Related
Getting this message:
Same event ID received for many event instances
You're sending the same event ID for many instances of your ViewContent events. Event IDs are unique identifiers that are used to deduplicate identical events received from your pixel and the Conversions API so they're not counted twice. To ensure that Facebook is accurately counting your events, each unique event instance needs its own unique event ID.
This may cause issues with the measurement of your events and the attribution of your ad campaigns.
So we've added IDs, and it's got to the point we've made a ridiculous function to make generate IDs:
function timePlusUuid4() {
return (Date.now().toString()) + '-' + ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}
Every conversion event is using it:
fbq('track', 'ViewContent', data, { eventID: timePlusUuid4() });
But we cannot get the error to go away. There is no other place conversions happen on the website.
Of course FB pixel helper, and FB test event function, show it working flawlessly.
Help please!
don't use time
i had the same problem using time...
or try to add '' around the value
Currently I am using a REST API see below to count files in SharePoint library, but how to count according to current logged in user's permission
var libUrl = appWebURL + "/_api/SP.AppContextSite(#target)/web/getfolderbyserverrelativeurl('" + e.DepLibName + "')/itemcount?#target='" + SPHostUrl + "'";
The issue with the method you're using is it only returns the value of the #ItemCount attribute of the List/Library object itself - it's not actually querying the item count based on the permissions of the currently logged in user.
You should switch to the ListData.svc, which does apply security trimming to its response. Ex.
appWebURL + "/_vti_bin/listdata.svc/" + LibraryName +"/$count"
This will return the number of items in the List/Library that the currently logged in user has access to, and not the number of items total.
I have a requirement in Sp2013 on premise. I need to pull Anniversary for all the employee for the current month.
I have code that pull data for the current user. I need help for all the users, who anniversary belong to current month. Any help is appreciated.
var url = _spPageContextInfo.siteAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/GetMyProperties";
$.ajax({
url: url,
type: "GET",
contentType: "application/json;odata=nometadata",
headers: { Accept: "application/json;odata=verbose" },
success: function (data) {
try {
//Get properties from user profile Json response
userDisplayName = data.d.DisplayName;
AccountName = data.d.AccountName;
CSOM will provides method for the Per user. So in your case if you want to get the anniversary of each user then you need to first get all the users available in a site collection and then iterate through them to get the user profile of it and get the anniversary field.
#vaibhav suggested there is an example of how to implement this.
Look for the most upvoted answer
Thanks
You need to use a Refiner property like date or string. And go with rest search api call.
Map People:BirthDate or SPS-Birthday according to the custom or Sharepoint OOB property.
Anniversary has year associated with it. But birthday has date month no year.
Apply filter accordingly to get relevant results.
Refer to the below for sample:
https://joranmarkx.wordpress.com/2013/10/02/show-upcomming-birthdays-based-on-sharepoint-2013-user-profiles-with-search-office365/
I've written a little script in JAVA, that tests the parameter limit with four different values (10, 100, 1000 and 10000) when querying a user's news feed of Facebook using the Open Graph API and the RestFB client. As you'll see, it has a strange behavior...
Scenario:
public static void main(String[] args) {
// vars
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
FacebookClient client = new DefaultFacebookClient(accessToken);
Connection<Post> home;
List<Post> postList;
Map<String, Post> postMap;
int i;
// limits to test
String[] limits = {"10", "100", "1000", "10000"};
for (String limit : limits) {
// init list and map (looking for duplicate posts)
postList = new LinkedList<Post>();
postMap = new LinkedHashMap<String, Post>();
// get news feed
home = client.fetchConnection(id + "/home", Post.class, Parameter.with("limit", limit));
// going through pages
i = 1;
for (List<Post> page : home) {
for (Post post : page) {
// store into list
postList.add(post);
// store into map (unique post id)
postMap.put(post.getId(), post);
}
i++;
}
// sort posts by created time
Collections.sort(postList, new Comparator<Post>() {
#Override
public int compare(Post post1, Post post2) {
return post1.getCreatedTime().compareTo(post2.getCreatedTime());
}
});
// log
try {
FileWriter out = new FileWriter("log/output.txt", true);
out.write("LIMIT: " + limit + "\n");
out.write("\tPAGES: " + (i - 1) + "\n");
out.write("\tLIST SIZE: " + postList.size() + "\n");
out.write("\tMAP SIZE: " + postMap.size() + "\n");
out.write("\tOLDER POST: " + dateFormat.format(postList.get(0).getCreatedTime()) + "\n");
out.write("\tYOUGNER POST: " + dateFormat.format(postList.get(postList.size() - 1).getCreatedTime()) + "\n");
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Output:
LIMIT: 10
PAGES: 7
LIST SIZE: 56
MAP SIZE: 56
OLDER POST: 2009-03-22 14:58:03
YOUGNER POST: 2012-05-11 15:48:49
LIMIT: 100
PAGES: 3
LIST SIZE: 174
MAP SIZE: 172
OLDER POST: 2012-01-12 23:01:34
YOUGNER POST: 2012-05-11 15:48:49
LIMIT: 1000
PAGES: 2
LIST SIZE: 294
MAP SIZE: 292
OLDER POST: 2009-03-22 14:58:03
YOUGNER POST: 2012-05-11 15:48:49
LIMIT: 10000
PAGES: 2
LIST SIZE: 294
MAP SIZE: 292
OLDER POST: 2009-03-22 14:58:03
YOUGNER POST: 2012-05-11 15:48:49
Interpretations and questions:
Obviously, you can't get all the posts a user has had on his news feed since his account was created. Is limit limited?
With a limit of 100, 1000 and 10000, I must have had each time two duplicated posts within the whole returned news feed (174 - 172 = 194 - 192). Why? I never saw the same post twice on my personal news feed...
With (and only with) a limit of 100, the older post I get was created during the year 2012, meanwhile the other values of limit make the query retrieving a post that was created during the year 2009. I can understand that with an upper limit (1000 or 10000), the query retrieves older posts. But why does a limit of 10 make the query retrieving an older post than a query limited by 100?
Last but not least point: I'm not getting the same number of posts. Obviously, the more the limit is high, the more the number of retrieved posts is high. What I thought first, is that the only consequence of a smaller limit was an upper number of pages (which is the case though), but that the number of retrieved posts would not change. But it does. Why? That said, the number of posts seems to converge between a limit of 100 and 1000, because the number of posts is identical with a limit of 1000 and a limit of 10000.
PS: specifying a since and/or a until parameter to the query doesn't change anything.
Any answer/comment is welcome :)
Cheers.
Edit:
This is my best recall:
LIMIT: 200
PAGES: 3
LIST SIZE: 391
MAP SIZE: 389
OLDER POST: 2012-01-27 14:17:16
YOUGNER POST: 2012-05-11 16:52:38
Why 200? Is it specified anywhere in the documentation?
Its not in documentation but personally I have tested following for my project.
Facebook limit is limited to 500 posts. No matter you put a limit higher than 500 it will fetch only 500 results max. Try with 500 (or more), you will get maximum posts.
You wont get 500 posts every time but will get above 490 posts in general.
Some posts get filtered by various reasons (like privacy, blocked user, not suitable for specific region and other things)
This answers your 1st and 4th quetion.
For question no. 2 , I do not work in java, so I cant say if there's a prob in your code/logic or what your code is doing.
For question no. 3 , God help facebook !
Edit
For 4th problem, you may be hitting the queries/hour limit of graph api (facebook uses it to prevent spamming, you cant query apis frequently in quick succession)
Also,
this is why, you do not get all results returned by facebook.
(if you specified a limit of “5” but the five posts returned are not
visible to the viewer, you will get an empty result set.)
In addition to the limits mentioned in the documentation for each of
the tables and connections listed above, it is helpful to know that
the maximum number of results we will fetch before running the
visibility checks is 5,000.
Reference: Paging with graph api and fql
Also, there is a limit on no of results for a particular table. You can get a detail about them on respective fql tables.
For stream table (the one for posts/feed),
Each query of the stream table is limited to the previous 30 days or
50 posts, whichever is greater, however you can use time-specific
fields such as created_time along with FQL operators (such as < or >)
to retrieve a much greater range of posts.
Reference: Fql stream table
Look here too:
Facebook FQL stream limit?
There is an ongoing bug in Facebook open graph API paging having to do with the limit parameter. The higher the limit, the more pages of posts --- as if a lower limit also culls a sampling of posts. The problem has surfaced and retreated ever since the post search function was down for a month in September.
A new bug has surfaced: at present a post search without an access_token and a small limit (like 12) will return few and sparsely populated results pages. The same search made with the access_token given in the API documentation example will give full pages of 12 results +/- and no skipping. I have no idea what kind of access_token they use, but no attempts on my part have duplicated their results. The post search without access token is more or less non-functional (again)!
There could be some logic on facebook side to prevent data mining. Try add some delay while going through pages and see if better.
I'm able to return a location's details by sending a query via the graph api with the location's ID, however I'm looking to achieve the reverse - effectively find location id by sending a request containing the location name (city, state etc). Is this possible?
This is possible under a few different approaches. You can either search using long / lat positions and put the place name into the query. This search will search places only.
Do the following
https://graph.facebook.com/search?q=ritual&type=place¢er=37.76,-122.427&distance=1000&access_token=mytoken.
This will return ritual coffee.
Another way is to search through facebook pages using the following
https://graph.facebook.com/search?q=ritual%20coffee&type=page&access_token=mytoken
This way is more difficult as you will obviously need to parse the list in more detail.
You also can use the place sdk from facebook:
compile group: 'com.facebook.android', name: 'facebook-places', version: '4.30.0' // For latest version, see https://developers.facebook.com/docs/android/
and then:
PlaceSearchRequestParams.Builder builder = new PlaceSearchRequestParams.Builder();
builder.setSearchText("Cafe");
builder.setDistance(1000); // 1,000 meter maximum distance.
builder.setLimit(10);
builder.addField(PlaceFields.ID);
GraphRequest request = PlaceManager.newPlaceSearchRequestForLocation(builder.build());
request.setCallback(new GraphRequest.Callback() {
#Override
public void onCompleted(GraphResponse response) {
// Handle the response. The returned ID in JSON is the placeId.
}
request.executeAsync();
If I understand your question correctly you can use fql:
https://api.facebook.com/method/fql.query?query=QUERY
where query should be something like this:
select page_id from place where name = ;
Here is a page for your refrence:
http://developers.facebook.com/docs/reference/fql/place/