Jira - create rest api query - jira

I'm using the Jira API with the following call: https://site.url/rest/api/2/search?jql=project=PROJECT&orderBy=Resolveddesc, however, it's not showing as per applied order by resolved desc.
No static URL like - https://site.url/rest/api/2/search?%20Requests%22%20%20ORDER%20BY%20RESOLVED%20DESC
Also, I am looking to filter the following fields in RestAPI to improve the performance.
fields": ["summary","assignee","status"]
any help on this would be appreciated.

Without sample data, it is hard to know if you data support those filtering.
Below should be what you want.
https://site.url/rest/api/2/search?jql=project=PROJECT+order+by+resolved+desc&fields=summary,assignee,status

Related

Retrieving More columns as Part of VSTS query

I'm trying to fetch details from VSTS using VSTS query API. So to get all Portfolio Epics I created a custom query and used its ID to get that in JSON format. the query looks like this
https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql/{id}?api-version=5.0-preview.2
But the issue is its not giving me many details about each of the work items in JSON. It only lists the ID and URL. Like this
WorkItems:[
{ID:234,URL:"workitemurl"},
{ID:235,URL:"workitemurl"},
{ID:236,URL:"workitemurl"},
...
]
So if I need more details about an item I need to execute those individual URl for each PE and thus I can get its details. instead of I am just checking is there is any way of getting an ID (keyedinID of each work item along with the ID and URL) like this. Please note KID is a field if we execute the URL separately. So to avoid that extra process, I would like to get that along with the WorkItems.
WorkItems:[
{ID:234,URL:"workitemurl",KID:002},
{ID:235,URL:"workitemurl",KID:023},
{ID:236,URL:"workitemurl",KID:033},
...
]
So how can we make this possible?
The Web UI uses a different API to get query results (/_api/_wit/_query), which allows query+data in a single pass. This is an old __v5 type call, which means it's considered internal.
The proper way to do this now is to first do the query as you're doing it right now and then call /_api/wit/workitems?ids=1,2,3,4 using the IDs from the references you got from the first call. That will also allow you to load the details dynamically and in small batches which will result in a more responsive UI.
See:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-4.1

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

Manipulating SurveyMonkey Results & data

we wud like to webscrape / import surveymonkey results into a html page then approve/decline each survey from/on that page.
We can also use wordpress as a last resort if we must.
Any ideas/tip how we can do this programatically ? Api Tips ???
Tnx
You can use the SurveyMonkey API to fetch the responses and render them how you like.
You can fetch the survey details like this:
GET /v3/surveys/<survey_id>/details
You can fetch the survey responses like this:
GET /v3/surveys/<survey_id>/responses
You can then join the two data together to fill it out. This may be quite a bit of work to render all that yourself though, you may just want to have a list of edit/analyze URLs (provided in the body when fetching responses) and then click through to SurveyMonkey to view the response and decide.
Fetch them in bulk like this:
GET /v3/surveys/<survey_id>/responses/bulk
and make a table with a list of URLs to work with. You may think of other ideas by looking at the API docs.

Office365 Graph API - combining NOT filters

I'm trying to perform a query using the Office 365 Graph API which uses multiple NOT filters, and I'm seeing some very strange behaviour.
Starting with a single NOT filter clause works fine:
/me/messages?$search="NOT from:joebloggs#outlook.com"
EDIT: Combining two NOT filters works as follows
/me/messages?$search="NOT from:joebloggs#outlook.com AND NOT to:joebloggs#outlook.com"
But combining four NOT filters doesn't work
/me/messages?$search="NOT from:joebloggs#outlook.com AND NOT to:joebloggs#outlook.com AND NOT cc:joebloggs#outlook.com AND NOT bcc:joebloggs#outlook.com"
Any help would be greatly appreciated. Thanks in advance
I’ve tested the expression below at my side and it works.
$search="NOT from:joebloggs#outlook.com AND NOT
to:joebloggs#outlook.com"
$search="NOT from:axx#mail.com AND NOT to:bxx#mail.com AND NOT cc:cxx#mail.com AND NOT bcc:dxx#mail.com"

Using custom metadata in the result of OData queries

I wonder if it's possible to use custom metadata within the result of OData queries (at the entity level). I think of metadata such as scores since the query executed on an ElasticSearch database and I would like to provide these hints to the end user.
Thanks very much for your help!
Thierry
Sorry I'm not familiar with ElasticSearch. But if I understand your questions correctly, you want some information other than the raw data in the request result ? If so, there is such things called Instance Annotation that may satisfy your need. An explanation from OData spec.
HTH

Resources