Get test suite id using Azure DevOps API - azure-devops

I am trying the below API, to get the suite ID using test case ID,
http://tfsb.xxx.com/xxx/xxxSoftware/_api/_testManagement/suites?testCaseId=185295&api-version=5.0
But I always get the below response:
404 - File or directory not found.
Can any you please tell me how to get the suite ID using testcase ID for Azure DevOps?

This is not the correct API, according to the docs there is a special API for this - Get Suites By Test Case Id:
GET https://dev.azure.com/{organization}/_apis/test/suites?testCaseId={testCaseId}&api-version=5.0

Been struggling with this all morning. Finally figured out how to get it to work. You should not put the project / team name in the URL. For example, most API calls look like:
https://dev.azure.com/{organization}/{project}/_apis/
However, the correct URL for this api call should look like:
https://dev.azure.com/{organization}/_apis/
In other words just put the base organization but do not put the project/team.
Same if you are using a dedicated organization url, instead of:
https://mycompany.visualstudio.com/Bigproject/_apis/
you must do
https://mycompany.visualstudio.com/_apis/

Related

AzureDevops API builds list API returns empty json results

I am unable to get a list of builds when using the devops api (I am requesting it without any additional filters)
https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1
It returns the following
{ "value": [ ], "count": 0 }
It seems that the API is working other wise as if the following URL is working and returning a full details about the build
https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.1
I am using token authentication and all the other tests seem to work as I would expect. All the {variables} are replaced with my queries, but have left them in as that is somewhat sensitiv(e.
Am I missing something? Is the API broken?
AzureDevops API builds list API returns empty json results
As test, the rest api Builds - List works fine:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1
I test it with postman by using the PAT (only have the build read scope of access):
So, the REST API is fine.
Besides, since you could also get the result with a specify a build Id, please confirm if there are any errors in your url and if there are too many pipelines in your project, which has not returned the correct value in time. You could test it with a new test project.
Besides, what Eric said is also a possibility, please make sure the token authentication have permission to read all pipeline, you could create a PAT with build read scope of access.
Hope this helps.

VSTS API - Get test category information for test run

I have been looking to get hold of test results programatically, for the tests that are run during builds and releases. I am doing it via the VSTS API here.
https://www.visualstudio.com/en-us/docs/integrate/api/test/results
The test category information, declared via [TestCategory] attribute, does not appear in this results returned by this API.
I am wondering if there is a way to get hold of test results along with category information?
The test category information is available within the downloaded test results file using the UI from within the test run details.
Is there an API endpoint that return path to the test results file (the one that can be downloaded via the UI)?
Any pointers will be greatly appreciated.
Thanks
To get TestCategory from test file (such as .trx), you use use the REST API to download a test run attachment instead of using the REST API to get test result(s) from a test run.
You can get the test run attachment id firstly, and then download the attachment:
To get the attachment id, use the REST API:
GET https://account.visualstudio.com/DefaultCollection/project/_apis/test/runs/runId/attachments?api-version=3.0-preview
And you can get the attachment id by the id parameter.
To download the attachment, use the REST API:
GET https://account.visualstudio.com/DefaultCollection/project/_apis/test/runs/runId/attachments/attachmentId?api-version=3.0-preview
To get the TestCategory, you can find in the response part:
<TestCategory>
<TestCategoryItem TestCategory="name" />
</TestCategory>

ALM REST API to Get Linked Defects

I want to get Defects Linked to Test Case, given the Test Case ID using REST API.
ALM Version, which I am using: 11.52
I can only assume the right URL. Please let me know if it works:
https://alm/qcbin/rest/domains/[domain]/projects/[project]/defects/?query={test-reference[1782]}

Autocomplete testing on Azure Search explorer

I am trying to build and test the auto complete feature on a master item lookup tables using Azure Search (for a ASP MVC application). The search index was done with the suggesterName SG set to ItemDisplayName
I was looking to test it first on Azure portal- so that I could aim to replicate the results via code. This is because the results I am getting in code are quite unexpected
As I type the substring the itemDislayName, the expectation was that upto 5 selected names will be displayed
On the portal, I tried a query string of
search=str&suggesterName=SG
with the base request URL containing the index, api version and sugestorName-but I don't get results of items containing 'str' and with the fuzziness as below
Could you please guide around
[1] how I can get suggestor output in azure portal-search explorer
[2] can I control fuzziness using queryType and ~1,~2
I was referring to these 3 links
1) https://learn.microsoft.com/en-us/rest/api/searchservice/suggestions
and
2) https://channel9.msdn.com/Shows/Azure-Friday/Azure-Search-103-Azure-Search-Suggestions-with-Liam-Cavanagh
3) gunnarpeipman.com/2016/07/azure-search-suggesters/
Azure Search Portal doesn't support the Suggestion API yet. You will need to use an HTTP client like Fiddler or Postman.
Make sure you use the right URL for you Suggest requests:
https://[service name].search.windows.net/indexes/[index name]/docs/suggest
Please use our User Voice page to vote for adding the Suggest API to the Portal: https://feedback.azure.com/forums/263029-azure-search

ProjectServer 2013 REST API - Creating Tasks

I'm playing with ProjectOnline and trying to use REST APIs to create projects and tasks etc. I have managed to add a project using following REST call
https://<domain>.sharepoint.com/sites/pwa/_api/ProjectServer/Projects/Add
However when I try to add Task or a Resource to the created project it gives me error "Cannot find resource for the request Add". Could you please let me know what I'm doing wrong.
My REST call is this
https://<domain>.sharepoint.com/sites/pwa/_api/ProjectServer/Projects('<project ID>')/Tasks/Add
The project ID is the ID of the Project created using the REST call 1.
The problem appears to be that you are calling the PublishedProject resource add not the DraftProject resource, your URL needs to be something like this:
/_api/ProjectServer/Projects('projectid')/Draft/Tasks/add(parameters)
The Draft section being key here.
HTH,
Martin