Difference between odata and fetchxml - pagination

I would like understand the difference between odata and fetchxml, this has to do with pagination in MS Dynamics, I am very new to the stack and would like to understand why there are two object models that essentially perform the same tasks?
the problem statement is as follows, we want our product to properly page answers it gets from Dynamics, currently we can only get 5000 answers per page, so if we are supposed to get say 6000 answers per page, how would we go about it:
I understand the limitations of odata, it can only retrieve record size = 5000. To overcome this or see the next set of results, I would have to use the value of the #odata.nextLink property with a new GET request to return the next page of data.
Similarly for fetchxml, there is the option to use paging cookie. Is my initial analysis correct?
But I still do not understand why there are 2 object models?

fetchxml is native Dynamics CRM querying language available from oldest versions.
Odata REST based web api was introduced in CRM 2016 update 1 onwards (v8.0).
There was a SOAP based 2011 endpoint before, its deprecated now.
You will find blogs/documentation over the internet based on different versions in different point of time. Read more

Related

Microsoft Graph $top filter return inconsistent results

When using MS Graph the API is returning inconsistent results when using $top filter.
Here is an example using the MS Graph Explorer:
Here we can see that we are setting top to 1 element and the API is returning 8.
The query is:
https://graph.microsoft.com/v1.0/security/alerts?$top=1&$count=true
Here is the link to the graph explorer:
https://developer.microsoft.com/en-us/graph/graph-explorer
If someone is also having the same problem or the API is working well for him it will help a lot knowing it.
I can reproduce your issue, this should be correct, because the alerts in the result are from the different providers, check the doc:
$top - Returns the aggregated top results from each security API
provider.
e.g. If you use $top=1 and there are 8 providers in your case, then you will get 8 values, it will get one value from each provider.
If you specify only one provider via the $filter, then you will get only one value with $top=1, you can check the provider keywords here.
Sample:
GET https://graph.microsoft.com/v1.0/security/alerts?$filter=vendorInformation/provider eq 'MCAS'&$top=1&$count=true

Get recurrence data of sharepoint calendar events using microsoft graph api?

Is there a way to get recurrence information of sharepoint calendar events using the graph api? I can get the event fields using this endpoint but I could not figure out a way to get event recurrence data of sharepoint calendar event using graph api.
If there's no way to do that, is there any documentation regarding working with sharepoint calendars? I could not really find any official documentation for it.
Not sure about Graph, but here's what I know. There has always been a problem when it comes to expanding the recurrence data in calendar events - AFAIK there is no way to retrieve this piece of info using JSOM nor REST for item collections. It is possible though to get this information for a single item in a form of an XML. All you have to do is to fetch and read the RecurrenceData property of an item. Example endpoint URL:
https://[tenantUrl]/_api/web/lists/getByTitle('Events')/items(1)?$select=Title,RecurrenceData
It will return something like the following in the RecurrenceData field:
<recurrence>
<rule>
<firstDayOfWeek>su</firstDayOfWeek>
<repeat><daily dayFrequency="1" /></repeat>
<repeatInstances>10</repeatInstances>
</rule>
</recurrence>
You can try to fetch that property using the provided Graph endpoint but I don't know what the result will be and unfortunately I don't have a way to check it right now - sorry!
Also, have a look at this thread on the SharePoint StackExchange: https://sharepoint.stackexchange.com/questions/23221/rest-api-expand-recurring-calendar-events?noredirect=1&lq=1
I've also recently stumbled upon a neat little library on Reddit, which simplifies common calendar tasks and allows to get this info using SOAP service. You can find it here: https://spcalendarpro.sharepointhacks.com/
This is what worked for me to get RecurrenceData for a SharePoint calendar list in Azure using Graph API:
/v1.0/sites/root/lists/<list_guid>/items?$expand=fields($select=Title,RecurrenceData)

Get delta users (Users creatad between date) - office 365 graph API

I am making a timer job in c# which will make a call to office 365 and fetch newly created users. For example, if I run it now it should fetch users since last run till current time (Delta). However I dont see any FILTER or API parameter where I can pass date and get ONLY those users who are updated or created after specific date.
Is there any API available something like this;
https://graph.windows.net/{MYORG}/users?api-version=1.6&[Filter=createdDate
gt 12/12/2016 or modifiedDate gt 12/12/2016]
Azure AD Graph API can't do this as far as I am aware of, the User entity does not contain creation or modification dates to query on.
However, the beta endpoint of the Microsoft Graph API should be able to do this. You can follow the instructions here: https://graph.microsoft.io/en-us/docs/concepts/delta_query_users. Simply put you must:
Call the users endpoint with the delta function
If you got a skip token, it means there are more pages
Fetch the next page until you no longer get a skip token but get a delta token instead
This delta token allows you to call the endpoint anytime later to get only the modified users (created/updated/deleted)
General guidance for delta queries
I found that blog already however its under delta and throwing errors to me. Here is what I got in response of first call;
https://graph.microsoft.com/beta/users/delta?$skiptoken=
when I did a GET to that link, I am getting error saying the resource you are trying to request is either does not exist or has been removed or...
I feel there is a bug as its beta API.
However, good news is I just found another blog which seems to have be fixed my problem using following query;
https://graph.windows.net/XYZ.onmicrosoft.com/directoryObjects?api-version=1.6&deltaLink=
I will anyway mark your answer as accepted assuming Microsoft will fix the issue I am getting from backend.

How to access more than 10 products in Amazon mws via ListMatchingProducts API using node.js

I am using node.js(Meteor) for calling Amazon MWS ListMatchingProducts API for getting all products of my seller account . Its running sucessfully and i am getting the response , but as the documentation said that only ten(10) products are returned at one time. So i just want to know how we get products more than 10 . In the doc Amazon also said that you can submit NextToken with a "ByNextToken" operation to request additional pages.But i am not getting any nextToken or related to that nextToken field on my response.So how do i get the nextToken from there side or how can i get more than 10 products from that API. As i also check on one post they said that we need to use Reports for that but i want to use ListMatchingProducts API for that and want result more than 10.
Please provide me any suggestion or guidance how can i achieve that.
Any help would be appriciated
Thanks
You want to call the Reports API using the Inventory Report report type or one of the other Listing Report types. That is the way to go. The ListMatchingProductsoperation of the Products API is meant to be a search, based on a query. Yes, it only lists ten products but it does not give you a NextToken like some of the other operations. Knowing your Report Type and Marketplace ID, you can submit those to the Reports API with your credentials and get back all of your products all at once and there is no searching involved.
What I would also suggest is to use the Amazon Scratchpad to play around with your operations to make sure you get what you expect, then plug it into your node.js project.

Paging in Azure AD graph client

We need a way to get users based on page index and page size so that we will not load all the users every time.
I have gone through with the Azure Graph Client documentation here http://blogs.msdn.com/b/aadgraphteam/archive/2014/12/12/announcing-azure-ad-graph-api-client-library-2-0.aspx
There is a way to iterate forward/backward but, i didn't found a way to get the users based on page index(i.e: i want to get users from 10-20 in the list if i pass parameters page index=2 and page size=10).
If we go with forward/backward paging, then i have to iterate through each page to find the next set of records, which I don’t want to do that.
Any help would be appreciated.
In order to accomplish the kind of pagination you're looking for, Azure AD Graph API need to support both $top and $skip OData operators. However kooking at Supported Queries, Filters, and Paging Options in Azure AD Graph API, while $top is supported but $skip isn't thus I don't believe it is possible to accomplish pagination they way you want to.
It does support $top and $skiptoken which can be used for navigating back & forth but will not serve the scenario you're looking to implement.
Sorry, currently this is not possible via the Graph Client. What you are looking for is similar to a query of a database, where you can selectively control the return set. Azure Graph does not have this capability. When you make a query, the result is returned one page at a time. You pass your token each time you are requesting the next page in the return set. There exist no way that actually tracks page 1, 2, 3... and so forth of the return set, thus, no way to say bypass pages 1 and 2 to go directly to page 3. The only capability available is next page and previous page. There is no page index maintained that can be queried. You get the your results one page at a time.
As said by MMTT here: https://social.msdn.microsoft.com/Forums/en-US/199bbf92-642a-4bcc-add4-f8023a7684e2/paging-in-azure-ad-graph-client?forum=WindowsAzureAD

Resources