Data api ga, how to get data for multiple pages? - google-analytics-api

I'm using Data api of google to get data in my filters, I'm getting data for page path for single page and I'm stuck at multiple pages. I followed document and passed following query to filters,
$filter = 'ga:pagePath=~/about_us.htm,ga:pagePath=~/index.htm';
Is there anything wrong in it? Can someone please help in it.

You need to add $dimensions='ga:pagePath' to individually query the two pages.

I don't see anything wrong with it but it's always good to run your data api calls through the Data Feed Query Explorer. It will show you if it is getting results and show you the proper url-encoded query.
I ran a query using the Data Feed Query Explorer on my site that was similar to yours and had no problems.

Related

I am unable to filter by 'Name' in SharePoint picture library

I am rendering to a page blog posts. Unfortunately, when the blog was initially set up, the pictures corresponding to each blog post was kept in a picture library for some odd reason. Now I need to dynamically display the appropriate picture with the correct blog post but I am having a hard time. I am using SharePoint 2016 and using REST API to query the picture library. I am able to query the library but I am not able to filter for a specific picture.
So, here's what I have,
the below works and shows the field that I need, Name
/blog/_api/web/lists/getbyTitle('blogPics')/items?$select=File/Name&$expand=File
the below filtering doesn't work
/blog/_api/web/lists/getbyTitle('blogPics')/items?$select=File/Name&$expand=File&$filter=Name eq 'imgName.jpg'
Any ideas why?
Thanks!
We can use FileLeafRef to filter the specific picture.
/_api/web/lists/getbytitle('blogPics')/items?$select=FileRef,FileLeafRef&$filter=FileLeafRef eq 'imgName.jpg'

How to find posts of a facebook page within a certain period of time?

I want to import posts of a page between 07-12-2017 and 10-12-2017.
I have converted the dates to unix timestamps.
https://graph.facebook.com/v2.11/ekantipur?fields=posts.until(1512926148).limit(125)&access_token=MyAccessToken
works and so does
https://graph.facebook.com/v2.11/ekantipur?fields=posts.since(1512666948).limit(125)&access_token=MyAccessToken
But since and until together does not work. It only shows a single id.
Is there an another way to accomplish this task? If yes please reply. Thankyou in advance.
Update here is my updated Url with since and until. Its still not working.
123456/posts?since=07-12-2017&until=10-12-2017
Can you update the original post with your combined Since and Until?
I'm assuming that the SINCE is set to 7/17 and the UNTIL is 10/17, correct? It looks that way from the converted numbers, but I try not to assume it isn't something small like that :). No offense intended.
Looking at the graph API, I am using the page id of one I am the admin of and using since and until and it's coming back with posts between 07-12-2017 and 10-12-2017. I'm wondering if it has something to do with the limit in your urls. What if the limit statements are narrowing things down too much?
I'm just putting this into the graph API and getting the results I'm expecting: (no, my page id isn't 123456)
Granted, I'm not calling it in a url, Graph API is pretty forgiving.

Query string is not coming in fiddler?

In the fiddler i choose the inspectors>webforms to see the query string for the request. But instead it is coming blank. Do i need to enable anything in order to get that? Or any other way. Please help me out.
The session selected in your screenshot is a JavaScript file that is used by the page in question. Its URL does not contain a query string. Instead, you should select the Session that represents the web page that includes this JS file.

Facebook Graph API: Getting the total number of posts

I've been using the Facebook Graph API to display user posts. When I get the initial "page" of posts, the resulting data object has a paging property object with a previous and next URL property. I was hoping to generate navigation links based on this available paging information. However, sometimes these URLs point to an empty set of data, so I obviously don't want to navigate the user to an empty page.
Is there a way to find the total count of objects in a collection so that better navigation can be derived? Is there any way to get smarter paging data?
Update:
Sorry if my post isn't clear. To illustrate, look at the data at https://graph.facebook.com/7901103/posts and its paging property URLs. Then follow those URLs to see the issue: empty pages of data.
Since it pages the datas with date-time base. You can't get the knowledge of whether if there are datas or not before you actually send the request to it. But you can preload the data from previous url to determine is it suitable to dispaly a previous link in your web page.
Why be dependent of Facebook?
Why don't you preload all data for a user and save into a database. Then you fetch the posts from db and show to user. This way you have all the control on how many posts there are and how to manage next and prev.
I was going to try to post this as a comment to your question, but I can't seem to do so...
I know that the Graph API returns JSON, and while I've never come across a way to have the total number of posts returned, depending on what technology you are using to process the response, you might be able to capture the size of the JSON array containing the posts.
For example, if I were using a java application I could use the libraries available at json.org (or Google GSON, or XStream with the JSON driver) to populate an object and then simply use the JSONArray.length() method to check for the number of posts returned.
see:
http://www.json.org/javadoc/org/json/JSONArray.html
It might seem like a bit of a simplistic solution, but might be the type of work around you require if you can't find a way to have Facebook return that data.
Can you specify what technology your application is based in?

Getting old records from Facebook using the API

I want to fetch some historical data using the api. But when I access older and older pages, I suddenly hit one that's returning me empty data.
For example, call to this url: https://graph.facebook.com/kenderken/posts?limit=100&until=2010-06-01T09:10:53%2B0000 returns me empty data even that there are posts on my wall that are older then 2010-06-01... (here's the last one that API returns to me: http://www.facebook.com/kenderken/posts/134367776579392 and this one http://www.facebook.com/kenderken/posts/271650467287 is from January 2010, no way to get it via API)...
Any clues on that?
That is a fairly common bug with Facebook. If you search http://bugs.developers.facebook.net/ you will find many similar reports.