How to retreive delta calendarView from ms graph expanded with extension? - microsoft-graph-calendar

is there any smart way to get delta events from ms graph with extension?
Standard delta query is:
https://graph.microsoft.com/v1.0/me/calendarView/delta?startdatetime=2018-12-16T19:40:53&enddatetime=2020-12-16T19:40:53
Standard query for events with extension is:
https://graph.microsoft.com/v1.0/me/events/?$expand=extensions(%24filter%3did+eq+%27Microsoft.OutlookServices.OpenTypeExtension.Com.XXX.YYY%27)
and I couldn't find in documentation way to merge it and query for delta with "$expand=extensions".
Simpliest way, which comes to my mind is to ask api for delta and then ask one by one for expanded view object, but it's causes lots ot queries :/

Related

Microsoft Graph filter vs $filter

I am testing filtering using Microsoft Graph Explorer. I noticed odd behavior that I cannot figure out.
Using endpoint https://graph.microsoft.com/v1.0/me/events?filter=start/dateTime%20ge%20%272018-04-01%27 I get properly filtered data back.
However, using documented $ prefix, https://graph.microsoft.com/v1.0/me/events?$filter=start/dateTime%20ge%20%272018-04-01%27, I get nothing. There is no error, just no data coming back.
How do I query the data using the $filter?
You're not actually getting the results you think you are. When Microsoft Graph sees a query parameter it doesn't expect, it simply ignores it.
When you call /events?filter=start/dateTime ge '2018-04-01' it is simply ignoring the unknown filter parameter and returning you an unfiltered result.
When you call /events?filter=start/dateTime ge '2018-04-01', it is filtering out anything prior to April 1, 2018. If there are no events with a start after this date, you will get an empty array as a result.
I assume you're using the default dataset included with Graph Explorer? The default Graph Explorer data set's most recent event is 2017-11-16T08:00:00.0000000.
The reason you see results from the /calendarView endpoint but not the /events endpoint is that /events only returns single instance meetings and series masters while /celandarView shows everything within a date range. In order to avoid having to maintain a dataset with updated events, the demo data relies on a handful of recurring event entries.
Since events does not return individual occurrences of a meeting, you don't see any results from your query.
If you try this query, you'll see actual results:
https://graph.microsoft.com/v1.0/me/events?$filter=start/dateTime ge '2017-04-01'

CalendarView and DeltaToken in different time range with Microsoft Graph API

From the Graph Documentation:
if you want a calendarView for a specific time range you use the query
GET https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2017-01-01T19:00:00.0000000&endDateTime=2017-01-07T19:00:00.0000000
if you want a delta token to get the changes in a calendarView you use the query
GET https://graph.microsoft.com/v1.0/me/calendarview/delta?startdatetime={start_datetime}&enddatetime={end_datetime}
My problem is taht I need to get all the events from a specific date at the beginning of my program, but after that I'm interesting to track changes of events from another date.
So I'm wondering if is it possible to get a calendarView for a specific time range and a delta token for another time range in a single query?
It is not possible to do this in a single query. Please issue two separate queries.
Thanks!
Sri

How to handle structured queries for retrieving rows with Google Sheets API v4

I would like to begin migrating my application that relies on Google Spreadsheet API (v3) to Google Sheets API v4. However, there is one question I have that remains before I begin.
In Google Sheets API v3 I can get a rows based feed with a structured query using the sq parameter in the request URL. This is useful if the sheet has 10000 rows and I need to get only rows with a certain value in a specific column(s). It's also very efficient in terms of speed.
In looking at Google's migration guide to v4, I found this statement under "Retrieve Row Data":
The Sheets API v4 does not currently have a direct equivalent for the Sheets
API v3 structured queries. However, you can retrieve the relevant data and
sort through it as needed in your application.
How do I go about retrieving "relevant data" from a sheet of 10000 rows efficiently given that there is no structured query in v4 API. I would rather not have to retrieve all 10000 rows only to sift through that response. Especially since it will slow down my app and probably increase the amount of data being sent over the wire.
With the v4 API, how can I retrieve rows that have specific values in a specific column (or set of columns)?
I don't need to reference the docs because you are already aware of it. There is no such feature in Sheetsv4. You have to manually perform the Basic Reading methods and parse the response, loop over it and sift for the value you're looking for.
This is related to your SO question here. I've already written some code there so I'll just post the results here so you have an idea how I searched for values.
To fetch for phone, I looped through the JSON response:
arrayBuffer = xhr.response;
console.log("arrayBuffer "+ arrayBuffer);
myArr = JSON.parse(arrayBuffer);
for(var i = 0; i < myArr.values.length; i++){
if(myArr.values[0][i] === "phone"){
console.log("column position is " + (i+1)); // +1 because counting starts at 0
}
}
You can also file a Feature Request here.

How to implement infinite scroll with multiple filter on data that get from Firebase in Swift?

I'm using Firebase for my iOS application and I'm having trouble implement infinite scroll and filtering data together.
What I need to do is:
Display items with order/filter on multiple property (location, category, status . . .)
Implement infinite scroll when the user scrolled to bottom of the screen.
I tried to think about some solutions:
The first, I think that I'll query the data with the necessary conditions then limit the number of records by use queryLimitedToFirst(N), and increase N when need to load the next items. But because Firebase can only filter on one property at a time and it's also a waste to reload data. So, I was thinking about the second solution.
As approaches are suggested from Frank van Puffelen (Query based on multiple where clauses in firebase):
filter most on the server, do the rest on the client
Yes, exactly like that. I'll execute queryOrderedByKey, queryStartingAtValue, queryEndingAtValue to implement infinite scroll, pull down the remaining data and filter that on client. But there is one problem that is I would not have enough items to display for the user if execute filter on the client.
For example: each time run the query, I receive 10 items. After data filtering process on the client, I just left 5 (can be 0) items meet the conditions to display to the user.
I don't want this because user may think there is a problem
Can I please get some pointers on this? If I didn't structured the data properly, can I also get some tips there?

Custom Date queries using Cumulocity API

Is it possible to aggregate measurements or create custom queries beyond the standard dateFrom dateTo queries?
As an example, I have measurements which have a time delta of 1 minute (2015-01-01T05:05:00, 2015-01-01T05:05:00, 2015-01-01T05:05:00, ...) and I would like to query the measurements at 15 minute intervals (2015-01-01T05:15:00, 2015-01-01T05:30:00, 2015-01-01T05:45:00, ...)
So far I have only come up with these solutions:
Using the standard api request as in
https://tenant.cumulocity.com/measurement/measurements?dateFrom=2015-10-01&dateTo=2015-11-05
and then throwing away most of the data will use a massive amount of time loading the data.
Using cep (cumulocity event language) to generate a new measurement every 15 minutes using the nearest 1 minute measurement seems like a bit of overkill and not very elegant.
Batch requesting the exact minute
https://tenant.cumulocity.com/measurement/measurements?dateFrom=2015-11-05T05:15:00%2B01:00&dateTo=2015-11-05T05:16:00%2B01:00
which will in a massive amount of API requests and also does not seem very efficient.
Use the /measurements/series endpoint which will only give me all series, even those I do not want, as well as only having the aggregation options hourly and daily (as far as I can tell).
Is there a better way of doing this?
you have captured nearly all of the mechanisms that are currently available. There is one more possibility -- not sure if this is an option for you:
Mark the fifteenth measurement when sending it from the device, using e.g. a different type.
I would normally use 2. It's actually quite efficient, it's similar to a materialized view in traditional SQL, plus you can use the data everywhere and in all widgets.
Good luck :-)
Cheers,
André
I would prefer the CEP solution. The rule wouldn't be that complicated. You would of course then store these measurements twice which is not that nice but having your desired measurement with a specific type or fragment will give you the fastest way to query it.
Instead of copying the measurement you could just add a special fragment to the measurement every 15 min in the CEP rule. You cannot update measurements so you would have to delete the measurement incoming every 15 min and then create a new measurement with exactly the same values but add a fragement (e.g. "aggregatedMeasurement": {}).
Your query then looks like this:
https://tenant.cumulocity.com/measurement/measurements?dateFrom=2015-10-01&dateTo=2015-11-05&fragmentType=aggregatedMeasurement
One more idea for point 3:
You could use SmartREST to create a template with the query string and leave the dateFrom and dateTo as placeholders.
From the client side you then would have to make only one request using the bulking feature in SmartREST.
On the server side this would still be transformed into the single requests so you wouldn't gain anything in speed.

Resources