missing devops REST API asOf parameter for workitem comments - azure-devops-rest-api

devops REST API provides a very handy asOf paramater for workitems in order to get a past snapshot of their state.
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-5.1#uri-parameters
we would like to include the comments at that snapshot/asOf moment, however we aren't able to use $expand (tested with 'All')
our fallback is then to use the comments endpoint : https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/comments/get%20comments?view=azure-devops-rest-5.1
but this one lacks asOf parameter, I tried with just to be sure it's not hidden/undocumented, but with no luck.
GET https://dev.azure.com/xxxx/xxxx/_apis/wit/workitems/16247/comments?api-version=5.1-preview.3&asOf=2020-06-01T07:00:56.89Z
any idea/workaround how to address this ? we can play with comment createdDate & changedDate to find similar behavior, and/or fetching all comment revisions. however I wanted to know if I didn't missed an obvious approach.

You can get the comment in System.History field using the Work Items - List Api, but in this api, it only returns the latest revision of the work items you list:
To list all comments, you need to use Comments - Get Comments api, but asOf parameter doesn't work in this api. So the workaround is using createdDate & changedDate to find the items you need.

Related

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

Get issues by label in Jira

I'm unable to get issues with needed label from REST API of Jira.
I'm sending GET request to the jira_url/rest/api/2/search?jql=project=MYPROJ&label=build1. In response I get 50 random items. I know that with this label exist only 2 items, but can't get them both.
I was serfing JIRA REST API documentation, but haven't found good examples how to get issues with items in array at least. Also tried the same via POST request with body:
{
"fields": [{"labels": ["build1"] }]
}
Tried similar examples from https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues
Any easy way to get the JQL Query String to use is to use the Issue Search UI and look at the generated URL at the top and to just grab the jql part:
So the part to add the labels section is:
%20AND%20labels%20in%20(build1%2C%20build2)
Which is and labels in (build1, build2). It is important to note that using the & makes the REST API things the JQL query parameter has ended which is why you need to use the space encoded character of %20 and then the AND keyword to build your JQL.

Dailymotion graph API user activities

I am using the graph API of dailymotion and in particular the /user/<id>/activities feature.
There is no parameter to sort the list and no specification for the default sort order. Is there any guarantee that it is sorted by created_time (or something else) ?
The documentation :
https://www.dailymotion.com/doc/api/explorer#/user/activities/list
The api explorer :
http://www.dailymotion.com/doc/api/obj-user.html#user-activities-connection
Thanks a lot for your input on this!
Thank you for reporting this issue. You where right, the order was already assumed to be created_time behind the scene. From now on, there is a new sort parameter that you can use to order the result set on /activities and /user/<xid>/activities. For example:
https://api.dailymotion.com/user/<xid>/activities?fields=id,type&sort=recent

How can I retrieve an entity by key without using filter with JayData

JayData has a method on EntitySet called find(keyValue, cb). However, this method translates to the following OData query:
http://localhost/api/MyEntitySet?$filter=(Id eq 1)&$top=2
Why doesn't the OData provider query by key instead? Like so:
http://localhost/api/MyEntitySet(1)
I find the second query to be more natural in this case, also easier to debug. Is there a way to force JayData to use the second query?
Sorry, we don't support this now. You can add it to our backlog (http://jaydata.org/backlogs) or open an issue on github.
Now it seems to be supported, but not documented yet. I have tested wit the Version 1.3.6. The reuest was translated into
http://localhost/api/MyEntitySet(1)
The only documentation i found was here (Search for "New find() for OData provider"):
http://jaydata.org/blog/release-notes

Resources