How to use the IN operator in Microsoft Graph API - microsoft-graph-api

I want to filter on records where clientAppUsed are either 'Exchange ActiveSync' or 'Exchange Web Services'.
I'm able to do it this way:
https://graph.microsoft.com/beta/auditLogs/signIns?$filter=clientAppUsed eq 'Exchange ActiveSync' or clientAppUsed eq 'Exchange Web Services'
But I want to use the in operator.
According to this doc: https://learn.microsoft.com/en-us/graph/query-parameters#examples-using-the-filter-query-operator
My query should look like this:
https://graph.microsoft.com/beta/auditLogs/signIns?$filter=clientAppUsed in ('Exchange ActiveSync', 'Exchange Web Services')
But it doen't work.
UnknownError: Please try again after some time.
I have waited and tried again, with the same result.
Does anyone know how to use the in operator correctly or have a different way of getting the same result without the query getting very long?

The In operator might be used if only few scenarios as mentioned in the DOC
Can you please check if this is happening for your query only or is the "In" operator not working for any query.
Try this One:
https://graph.microsoft.com/v1.0/users?$filter=department in ('Retail', 'Sales')

Related

Jira Rest API JQL query

I'm making use of the Jira API with the following call:
https://site.url/rest/api/2/search?jql=project=PROJECT&updated>=startOfWeek(-1w)
When I run this, I'm getting over 6000 results. But when I run the jql query of project = PROJECT AND updated >= startOfWeek(-1w) inside of my Jira sites search bar, I only get around 60 results.
Is there something I'm missing in my api call that would limit the returned to the data to the above query?
Edit
Looking further it appears my call is only bringing back results from my project space and not using the updated query. What should I do so it picks up both?
There is a typo in your query. You have used an ampersand instead of the word 'and'. The ampersand is the character used to add query parameters, so you effectively did this query
https://site.url/rest/api/2/search?jql=project=PROJECT
then Jira just ignored what came after the ampersand, as it didn't know what the parameter 'updated>' was, or how to make it equal 'startOfWeek(-1)'
Within the JQL, you must use the word 'and' with spaces before and after, like this:
https://site.url/rest/api/2/search?jql=project=PROJECT and updated>=startOfWeek(-1w)
Only use ampersands to add other query parameters afterwards, like this:
https://site.url/rest/api/2/search?jql=project=PROJECT and updated>=startOfWeek(-1w)&startAt=0&maxResults=500
Please send the API as POST method:
API: https://url/rest/api/2/search
Body:
{
"jql": "project='project name'&updated>=startOfWeek(-1)"
}

Microsoft Graph API filter and select on messages/attachements [duplicate]

Learning from here: List attachments and Use query parameters
When I call v1.0/me/messages/{message id}/attachments/?$filter=isInline eq true.
It returns both inline and not inline.
When I call v1.0/me/messages/{message id}/attachments/?$filter=size gt 15000.
It returns attachments with all sizes, included for example 14000.
It just ignores the filter parameter...
Is this correct? Documentation says nothing about that.
Is there another way to get only the inline attachments with one query?
There is a known bug with the /attachments endpoint affecting support the $filter clause.
You can track the status of this issue at GitHub. I've also added a reference to your question here.

Provide the 'allowthrottleablequeries' preference to allow this

I have developed an API using Microsoft Graph API. I am encountering below issue.
URL that I am calling :
/v1.0/sites/root/lists/cb32cc85-5351-423d-b2ec-bb418c1d9c64/items?
$filter=fields/Created gt '2018-1-1T00:00:00'
&expand=fields
&$orderby=createdDateTime
&$top=10
Error returned from the API :
Field 'Created' cannot be referenced in filter or orderby as it is not indexed. Provide the 'allowthrottleablequeries' preference to allow this, but be warned that such queries may fail on large lists.
How to enable allowthrottleablequeries as it says and how should I achieve this?
I'm afraid this isn't a very clear or useful error message. As far as I know, there isn't actually a way to enable allowthrottleablequeries.
This happens when a SharePoint list grows too large to handle filtering or sorting non-indexed columns. The fix is to add an index to the created column in your List Settings. You can find instructions on how to accomplish this in Add an index to a SharePoint column.
Try to send your request with following Request Header
Prefer: allowthrottleablequeries
If it does not work then try the following Request Header
Prefer: HonorNonIndexedQueriesWarningMayFailRandomly

Microsoft Graph API $filter=substringof() not working

I try the API as below, but the response message is "Invalid filter clause".
GET https://graph.microsoft.com/v1.0/me/joinedgroups?$filter=substringof(name,'WIO')
Did I miss anything?
The API is OData V4 compliant, which does not have substringof function (reference).
Also, "me/joinedGroups" is not a supported query. Please use "me/memberOf/$/microsoft.graph.group?$filter=groupTypes/any(a:a eq 'unified')" to find all unified groups the user is a member of. Additional filter clauses in above query is not supported at the moment.
You can try using '$search' instead if applicable:
https://graph.microsoft.com/v1.0/users?ConsistencyLevel=eventual&$search="givenName:Jo" OR "surname:smith"
https://graph.microsoft.com/v1.0/groups?$top=2&ConsistencyLevel=eventual&$search="displayName:Group Name"

Can't parse new google urls - HTTP_REFERER doesn't contain parameters anymore

It seems a little odd to my, but although everybody knows about the new google search urls (see Google using # instead of search? in URL. Why?) no one has a problem with the HTTP_REFERER.
I'm using the referrer to parse the google string for the searchquery (&q= ) but as this is all in a hash-tag it wont be sent to the server and all i get is "http://www.google.de/".
So do you know a way of getting the query the user searched for, befor landing on my site?
Due to late-2011 Google security changes, this is no longer possible when the search was performed by a signed-in Google user. See:
http://googleblog.blogspot.com/2011/10/making-search-more-secure.html
http://analytics.blogspot.com/2011/10/making-search-more-secure-accessing.html
Since there are multiple q's in the query string you have to match the "q" parameter globally and take the last one:
/[?|&|#]q=([^&|^#]+)/ig
Get rid of "site:" searches (there are others, but I haven't done them)
/[\+|?|&]?site:([^&|^#])+/g, '');
Then parse the results.
/[\w^'\(\)\{\}]+|"[^"]+"/g
This has been working well for me.

Resources