Question about Filters in CodeSearchRequest for Azure DevOps REST API

Spruill, Allen 1 Reputation point
2021-08-25T16:34:32.847+00:00

Hi, I'm using the Azure DevOps REST API to do a code search. I have been following the instructions in the article "Code Search Results - Fetch Code Search Results" from here: https://learn.microsoft.com/en-us/rest/api/azure/devops/search/code-search-results/code-search-results-fetch-code-search-results?view=azure-devops-rest-6.0.

We're running on-premises Azure DevOps Server 2020 Update 1 RC2 and I have the API working when I just specify the search text.

I send my POST request to our server like this: https://azure-devops/tfs/NES%20Applications/_apis/search/codesearchresults?api-version=6.0-preview.1
With a body like this:
{
"searchText": "CISXloc",
"$skip": 0,
"$top": 100
}

My question is how to use the Filters in the CodeSearchRequest. I can't find any documentation on the options for this. I'm trying to search only in files of a specific extension. Using the sample in the link above, I was attempting to try this with Path, but it seems I must specify Project and Repository, and my aim is to search across all projects and repositories in the collection, as I can do in the web user interface.

Does anyone have pointers on using Filters in general, and for the specific case of searching for the text in a file of a specific extension?

Thanks!

Community Center Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,656 Reputation points Microsoft Employee Moderator
    2021-08-26T07:48:07.177+00:00

    Hi @Spruill, Allen

    Welcome to Microsoft Q&A! Thanks for posting the question.

    DevOps is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).

    You can ask the experts in the dedicated forum over here:
    https://stackoverflow.com/questions/tagged/devops
    https://developercommunity.visualstudio.com/spaces/21/index.html

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.