I need to retrieve a last photos in my OneDrive images directory and order it for 'takenDateTime' attribute in 'photo'.
I tried with this with this query:
https://graph.microsoft.com/v1.0/me/drive/root:/myimages/test:/search(q='.jpg')?select=name,id,webUrl,eTag,createdDateTime,lastModifiedDateTime/orderby=takenDateTime/photo%20desc
but the orderby seems not to work.
I have tried with 'lastModifiedDateTime' too but the list isn't sorted
How I can retrieve a list and order for more recent photo?
Thanks in advance.
The search request doesn't support orderby or filter.
Bye.
A $search request returns up to 250 results. You cannot use $filter or $orderby in a search request.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/item_search
Related
How to download recent tweets regardless of keyword? I want any recent tweet from the Twitter API version 2. Is it possible? If it is, how to write a query?
For example, it will download tweets containing word cat:
https://api.twitter.com/2/tweets/search/recent?query=cat
but what query to use to use instead of ?? to get tweets for any keyword:
https://api.twitter.com/2/tweets/search/recent?query=??
In API1.1, it was possible to use * as a query, but it seems it is not working for API2. If I commit a query I get the following error: The query query parameter can not be empty.
I think this would return far too many results as it would be all Tweets from all users, all over the world! The "recent" endpoint will limit results to those from the last 7 days but it would still be millions.
You can query just the tweets from a particular account (e.g. Stackoverflow) with:
https://api.twitter.com/2/tweets/search/recent?query=from:stackoverflow
Query: https://graph.microsoft.com/beta/users?$select=id,displayName,signInActivity&$filter=signInActivity/lastSignInDateTime le 2020-03-01T00:00:00Z
I am trying to query for users based on "lastSignInDateTime". When I do this , the response gives all the properties for every user returned. I then try to reduce this response by adding a "select" parameter to reduce the properties returned but it seems to have no effect. Is it possible to combine the "Filter" and "Select" query Parameter's?
We have a bug for collection enumeration in that beta endpoint. Due to be fixed within next couple of months. AS a workaround you can export your dataset into data structure and filter in memory (preferred) or you can query specific users (expensive and not recommended)
Is it possible to count all rows in a given entity, bypassing the 5000 row limit and bypassing the pagesize limit?
I do not want to return more than 5000 rows in one request, but only want the count of all the rows in that given entity.
According to Microsoft, you cannot do it in the request URI:
The count value does not represent the total number of entities in the system.
It is limited by the maximum number of entities that can be returned.
I have tried this:
GET [Organization URI]/api/data/v9.0/accounts/?$count=true
Any other way?
Use function RetrieveTotalRecordCount:
If you want to retrieve the total number of records for an entity beyond 5000, use the RetrieveTotalRecordCount Function.
Your query will look like this:
https://<your api url>/RetrieveTotalRecordCount(EntityNames=['accounts'])
Update:
Latest release v9.1 has the direct function to achieve this - RetrieveTotalRecordCount
————————————————————————————
Unfortunately we have to pick one of this route to identify the count of records based on expected result within the limits.
1. If less than 5000, use this: (You already tried this)
GET [Organization URI]/api/data/v9.0/accounts/?$count=true
2. Less than 50,000, use this:
GET [Organization URI]/api/data/v8.2/accounts?fetchXml=[URI-encoded FetchXML query]
Exceeding limit will get error: AggregateQueryRecordLimit exceeded. Cannot perform this operation.
Sample query:
<fetch version="1.0" mapping="logical" aggregate="true">
<entity name="account">
<attribute name="accountid" aggregate="count" alias="count" />
</entity>
</fetch>
Do a browser address bar test with URI:
[Organization URI]/api/data/v8.2/accounts?fetchXml=%3Cfetch%20version=%221.0%22%20mapping=%22logical%22%20aggregate=%22true%22%3E%3Centity%20name=%22account%22%3E%3Cattribute%20name=%22accountid%22%20aggregate=%22count%22%20alias=%22count%22%20/%3E%3C/entity%3E%3C/fetch%3E
The only way to get around this is to partition the dataset based on some property so that you get smaller subsets of records to aggregate individually.
Read more
3. The last resort is iterating through #odata.nextLink and counting the records in each page with a code variable (code example to query the next page)
The XrmToolBox has a counting tool that can help with this .
Also, we here at MetaTools Inc. have just released an online tool called AggX that runs aggregates on any number of records in a Dynamics 365 Online org, and it's free during the beta release.
You may try OData's $inlinecount query option.
Adding only $inlinecount=allpages in the querystring will return all records, so add $top=1 in the URI to fetch only one record along with count of all records.
You URL will look like /accounts/?$inlinecount=allpages&$top=1
For example, click here and the response XML will have the count as <m:count>11</m:count>
Note: This query option is only supported in OData version 2.0 and
above
This works:
[Organization URI]/api/data/v8.2/accounts?$count
I need to get daily uploaded videos in a playlist so thought to get videos for a playlist sorted by published date.
So is there any option to pass published date while fetching data for playlist?
I tried 2 options
option 1 )
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=15&playlistId=PLP-nGFpz3fa_boeLhG4m0Ie_8vmCvp5oH&key={YOUTUBE_API_KEY}
does result return from this URL is in sorted order? I found its not in sorted order.
Can I pass some date parameters related to date in this or some sort related parameters?
option2 )
I tried using "Youtube Search API"
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list
here we have date option but only can pass channelId not playlistId.
So can we pass playlistId in search API to get all videos for playlist?
Is there any other way which I can use?
Thanks
The PlaylistItems:list does not have any way to order results - the playlist order is returned in the order specified by the owner. Nor does Search:list allow you to specify a playlist.
Does the playlist owner add new videos to the beginning or end of the playlist? If the beginning, you could try fetching the first X videos and comparing the publish date to the current date.
Looking at the guide using Videos.list, nowhere does it mention that this feature is available, where the list is readily sorted upon return of the response body. Try putting the results in a container first where you will implement your own comparison of dates to sort the items. This SO thread seems to confirm this.
I am using Google Documents List API for searching within documents.
Searching on the google drive ui returns results with most number of occurences of words first. But with api it returns the results with last uploaded date first.
This is the URL which i am using https://docs.google.com/feeds/default/private/full?q=search+term
I also tried with https://docs.google.com/feeds/default/private/full?q=search+term&desc=true but this gave the same results that we were getting earlier i.e. by last uploaded date first.
Can someone guide me with what additional parameters i should be adding to the url
You can use the orderBy query parameter to order the Documents List Feed by certain criteria:
last-modified: Default value, sort by last modified date.
last-accessed: sort by last accessed date.
title: sort by title (this is what you're looking for.
starred: sort documents by their "starred" attribute.