Could not retrieve label of a custom field with Azure DevOps API - azure-devops

I'm integrating our product with Azure DevOps but currently I could not retrieve the label of custom field. I cannot use the name property because the name does not reflect the change from Azure DevOps.
I'm using "https://dev.azure.com/{organize}/{projectId}/_apis/wit/fields/Custom.NewHungField" API for getting information about the custom field, but it does not return label of the field.
Thank you.

Yes, you can not find label when you use Fields - Get directly. But you can see the label of the custom fileds using Work Item Types - Get.
For more information, you can check below demo:
Using API:
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitemtypes/{type}?api-version=5.1
Get the response:
You can find the label of custom fields in it.

Related

Azure DevOps rest api - Get work item by custom field

I am currently migrating from tfs 2015 to Azure DevOps, and I would like to use the REST Api services to get work items. In TFS were an option to include custom fields as filter in the http query to list work items, (e.g. there are many work items with custom field 'otherId', i want to list all the work items which otherId field value equals to 5) but in the Azure Devops api documentation i cannot find description about how to do this.
If it is possible, could you give me an example?
Tried to google it, read devops api documentation but i have not found any solution
You may use Query By Wiql. Your request may be like this:
POST https://TFS_SERVER:PORT/PROJECT/_apis/wit/wiql?api-version=7.1-preview.2
{
"query": "Select [System.Id] From WorkItems Where [YourCustomPath.otherId] = 'OTHER_ID'"
}
Check the example:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/wiql/query-by-wiql?view=azure-devops-rest-7.1&tabs=HTTP#examples
Additionally, check the API version here: API and TFS version mapping

Azure DevOps - how can I retrieve the history of all my "Name" tags?

In Azure DevOps you can tag users with #HisName. How can I retrieve the history of all the comments where my name was tagged? Please not using emails notifications, but inside the Azure DevOps web site? Thanks!
I've searched and asked a couple colleagues but no ones knows.
For work items mentioned users in their comment field like this:
You could try to use 'history' contains 'user name' in a query to get the work item:
If you mean tag user like this in the tag:
Since the query doesn't support '#' symbol in the contains field, please don't use # in the tag or you couldn't query. Then you could query the tag like this and get the work item.
You could add these date according to your requirement to limit the time:

woocommerce How to set the default variation for the product using the api

I'm unable to set the default attribute using the API please help
I tried to send this body to the updated product and add it when adding the product
{"default_attributes":[{"id":1
,"option":"blue"}]}]
but it didn't change

Insert value into Azure DevOps Custom Fields through Rest Api

I've added some custom fields for Test Plan in Azure DevOps. But when I try to create a new Test Plan through the Rest API call, it is only creating a Test Plan with default fields populated, while custom fields remain blank.
I've tried using both the field name (like Team Name) along with field reference name (like custom.TeamName) but to no avail. Even Get is also not exposing custom fields. Is some extra configuration required for custom fields, or it is a code related issue?
Details: I've created one Inherited process under the organization, and then under Process->Test Plan I've created new fields in the Test Plan, as shown in the screen shot:
I've tried below code to create Test Plan as Work Item and successfully created it with extra fields. But as I couldn't create a test suite independently, it is not behaving properly.
I've created a JsonPatchDocument and added all the fields (adding just one here) like below code:
JsonPatchDocument patchDocument= new JsonPatchDocument();
patchDocument.Add(
{
Operation=Operation.Add,
Path="/fields/System.TeamName",
Value="Xander"
}
);
VssConnection connection=new VssConnection(uri,credential);
WorkItemTrackingHttpClient workItemTrackingHttpClient= connection.GetClient<WorkItemTrackingHTTPClient>();
WorkItem res=workItemTrackingHTTPClient.CreateWorkItemAsync(patchDocument,project,"Test Plan").Result;
It is creating the Test Plan, but not Test Suite. So it is acting weirdly. Kindly check this.
Insert value into Azure DevOps Custom Fields through Rest Api
I could reproduce this issue with the REST API Test Plans - Create.
I think this should be related to the REST API, that because even if I use the REST API Test Plans - Get to get the custom field, but the request body does not include the custom field.
Since we could not get the custom field, we could not use the POST or PATCH for the custom filed.
You could add this request for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.

Attask- how to know that whether particular custom form is selected in the task or not

I want to search only those task from the project, which has a particular custom form (though not selected any field).
attask/api/task/5775...?fields=parameterValues,category
This returns only first custom form(category) object selected in the task and not all the custom forms..
I want to find all those task which contains particular categoryID..
Attask/api/ task/search?categoryID= 46785335&fields=parameterValues
It doesn't return me response when custom form selected after another custom form..
Since multiple custom forms is a new feature it is still only in earlyAccess this has not been released to the current API. You can however do this using the unsupported API.
the following will do what you are wanting.
GET attask/api-unsupported/task/search?objectCategoriesMM:ID=55a4232e005dc2668af39a4f24a4db40
This will search all forms not just the primary(first) form