I'm trying to pull recent messages in a chat. My Graph query is as follows
https://graph.microsoft.com/v1.0/me/chats/{chatId}/messages?$filter=lastModifiedDateTime gt 2022-07-27T07:13:28.000z
The query is valid but I get the following response
The query specified in the URI is not valid. Query option 'Filter' is not allowed.
To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.
This message seems like a server side error/message. Is it possible to perform DateTime filtering on MSGraph Endpoints?
According this, the endpoint
GET /me/chats/{chatId}/messages
does not support filtering.
Only the endpoint
GET /teams/{team-id}/channels/{channel-id}/messages/delta
supports filtering by lastModifiedDateTime and operator gt but it only goes back max 8 months.
Related
I am trying to get a full list of every group in Azure AD. I am currently able to get 999 records with the following uri:
https://graph.microsoft.com/v1.0/groups?$top=999
According to the documentation from Microsoft there are only a couple OData query parameters available, none of which appear to be able to navigate to the next page. It also states the maximum page size is 999. I have tried using the $skip parameter to skip a certain number of records, but it is not supported:
{"error":{"code":"Request_BadRequest","message":"'$skip' is not supported by the service.",...
Is there any way to get a full list of all AAD groups? We have several thousand that I would need to get.
Some queries against Microsoft Graph return multiple pages of data either due to server-side paging or due to the use of the $top query parameter to specifically limit the page size in a request. When more than one query request is required to retrieve all the results, Microsoft Graph returns an #odata.nextLink property in the response that contains a URL to the next page of results.
For example, the following URL requests all the users in an organization with a page size of 5, specified with the $top query parameter:
https://graph.microsoft.com/v1.0/groups?$top=5
If the result contains more results, Microsoft Graph will return an #odata.nextLink property similar to the following along with the first page of results:
You can retrieve the next page of results by sending the URL value of the #odata.nextLink
ref doc - https://learn.microsoft.com/en-us/graph/paging
With $top, you can customize the result size within the range of 1 and 1000. Because of your question, I guess that 1000 is exclusive, so the range goes from 1 to 999 (inclusive). Read more about the query parameter $top here. I got the range information from List messages.
The response you get from List groups seems to not contain #odata.nextLink which you would normally expect in such a case, so GET https://graph.microsoft.com/v1.0/groups does not support pagination. That would also explain why you get an error if you try to use $skip. You can read more about $skip here.
In order to get the full list of all groups, I would stop using the query parameter $top.
I am implementing Row Level Security in Azure Data Explorer, I am using
current_principal_details()
To get information about the user but how can I add the names of the groups or something that the user is part of?
I cannot use
current_principal_is_member_of()
Since I will have over 6000 groups and the RLS query will be just too long so my idea is to add groups or roles or something to the user that I can see using
current_principal_details()
And the parse them and use that as input to the RLS query
I am using the following KUSTO to get the info of the user
print d=current_principal_details()
I just need to know how to add properties to the output and use them as input to RLS query
I try to use https://api.telegram.org/bot<token>/getupdates to get updates from telegram with robot, and how can I get custom updates?
Such as, I want to get updates from one telegram group, and in specified time?
Currently there's no way to do that.
You have to process all the updates from the API server in Telegram-specified format. The only thing you can provide as a query filter is an offset parameter.
UPD
If the problem is that you always receive the same set of updates, the reason is that you're specifying incorrect offset parameter for getUpdates method.
From the API docs page:
In order to avoid getting duplicate updates, recalculate offset after each server response
So offset must be different every time you call getUpdates.
How to calculate offset for every call:
getUpdatesrequest returns an array of Update objects.
Every Update object has a update_id property. Iterate over this array, find and store the maximum update_id in a variable (max_upd_id for example).
Use max_upd_id + 1 as a new offset in the next getUpdates call.
For the very first call of getUpdates use offset=0.
I need to get the Marketo Leads who have changes on "progressionStatus" field (inside membership) with the API.
I can get all the leads related to a Program (with Get Leads by ProgramID API) without issues, but my need is to get those Leads with changes on "progressionStatus" column.
I was thinking to use the CreatedAt / UpdatedAt fields of the Program, so then, get all the leads related to those programs. But I didn't get the accurate results that I want.
Also, I tried to use the GET Lead changes API and use "fields" parameter to "progressionstatus" but that field don't exist.
It is possible to resolve this?
Thanks in advance.
You can get the list of Leads with progression status change by querying against the Get Lead Activities endpoint.
The Get Lead Changes endpoint could sound as a good candidate, but that endpoint only returns changes on the lead fields. Progression status change is not stored on the lead directly, so at the end that won't work. On the other hand the Get Leads by ProgramId endpoint returns –amongst others– the actual value of progressionStatus (program status of the lead in the parent program) but not the “change” itself, so you cannot process the resultset based on that.
The good news is that the progression status change is an activity type and luckily we have the above mentioned Get Lead Activities endpoint (which is also mentioned as the Query in the API docs) available to query just that. This endpoint also allows for filtering by activityTypeIds to narrow down the resultset to a single activity type.
Basically you have to call the GET /rest/v1/activities.json enpoint and pass the values of activityTypeIds and nextPageToken as query parameters (next to the access token obviously). So, first you need to get the internal Id of the activity type called “Change Status in Progression”. You can do that by querying the GET /rest/v1/activities/types.json endpoint and look for a record with that name. (I don't know if this Id changes from instance to instance, but in ours it is the #104). Also, to obtain a nextPageToken you have to make a call to GET /rest/v1/activities/pagingtoken.json as well, where you have to specify the earliest datetime to retrieve activities from. See more about Paging Tokens.
Once you have all of these bits at hand, you can make your request like that:
GET https://<INSTANCE_ID>.mktorest.com/rest/v1/activities.json?activityTypeIds=<TYPE_ID>&nextPageToken=<NEXTPAGE_TOKEN>&access_token=<ACCESS_TOKEN>
The result it gives is an array with items like below, which is easy to process further.
{
"id":712630,
"marketoGUID":"712630",
"leadId":824864,
"activityDate":"2017-12-01T08:51:13Z",
"activityTypeId":104,
"primaryAttributeValueId":1104,
"primaryAttributeValue":"PROGRAM_NAME",
"attributes":[
{"name":"Acquired By","value":true},
{"name":"New Status ID","value":33},
{"name":"Old Status ID","value":32},
{"name":"Reason","value":"Filled out form"},
{"name":"Success","value":false},
{"name":"New Status","value":"Filled-out Form"},
{"name":"Old Status","value":"Not in Program"}
]
}
Knowing the leadIds in question, you can make yet another request to fetch the actual lead records.
I want to query the google analytics realtime api using one of my custom dimensions.
In the regular api (not realtime) I can do this as follows:
'metrics': 'ga:pageviews',
'filters': 'ga:pagePath=~/myPath*;ga:dimension2=='+myVal
However, when I change the metrics to 'rt:activeUsers', I got the error:
"Unknown dimension(s): ga:dimension2"
when I did the request.
I changed the separator in the filters string from semi-colon to & and I didn't get the error any more, but the result always returns 0
Is it possible to do filtering on the realtime api? TIA
The realtime API does not support custom dimensions (you can see the list of supported dimensions and metrics here). On possible reason is that at least the values for session- and user-scope dimensions cannot be determined in realtime since realtime reports based on hits. So you cannot filter based on a custom dimension.
There is a possible workaround, but that comes with a caveat that makes it mostly pointless. You can create an additional data view, and then use an advanced filter to copy the custom dimension value for the hit to a dimension supported by the realtime API - e.g. you extract the value from your custom dimension and copy it to the "source" field (or some other field). Then you query for/ filte by the source field to retrieve the value. The caveat is that the original value of the source data field (or whatever field you overwrote) will be lost.