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.
Related
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
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.
All of my workflows for a site have the ability to log data in the Workflow History list on my site. This is controlled at run-time with a parameter in list based on the workflow Name. I would like to be able to run a workflow on this setup table that will delete all records in the History list. My understanding is I can do this via REST call in SharePoint Designer workflow.
I have attempted many times to configure the REST Post command in Designer and I am never able to get this to work. I've searched over and over for a solution and not able to find such a solution.
I first tried deleting all that had the Workflow Association ID equal to the Workflow Name, but could not get that to work. Then I thought I would try selection each value using REST and then deleting that value using REST by the ID I received from the GET.
This is my delete (POST).
[%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('Workflow History')/GetItemObject('[%Variable: HistoryID%]')
I also tried the DeleteListItem
[%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('Workflow History')/DeleteListItem('[%Variable: HistoryID%]')
I want the user to be able to run this on any workflow from the setupWorkflow list I have. The workflow should delete all history for the current workflow.
We can get the list items in Workflow History list base on the WorkflowInstance, in designer workflow, we can get the Instance ID from the Workflow Context.
/_api/web/lists/getbytitle('Workflow%20History')/items?$filter=WorkflowInstance eq 'b87b131e-ce22-43f5-85be-ec81d1045bc7'
Then delete list item using REST API below.
/_api/web/lists/getbytitle('Workflow%20History')/GetItemById(ID)
The following articles for your reference.
Using HTTP Call/ Rest API from SharePoint Designer workflow to create list
workflow to delete list item on subsite( Sharepoint designer call http web service )
I'm currently making a store which is receiving it's data from external sources. Being new to the world of editing/creating REST API, I've come across a problem. The problem is that the external source have no idea what ID the product gets in woocommerce so update/delete products is not possible with the current endpoints/routes. However, the external source does have it's own ID on it's product and I've stored this in a custom meta field in woo and I can see it and update it through api on Postman.
How can i create a new endpoint/route that uses the custom meta field called externalProductId and use this to update the product instead of the woocommerce ID?
What you can do, which I particularly did in my case ... Create a field id_product_woo in your external bank, the time you create the product in Woocommerce, it returns a JSON with the information of the product created, including the ID inside Woocommerce... When you create or update a product in Woocommerce, you then pass the id stored in the id_product_woo field of your external bank.
Apparently, this for me, worked perfectly.
Apologies if this is very naive question. New to VSTS...
We are thinking to use VSTS for our daily project works. Currently, we are on old TFS hosted in-house. We have window application which is data entry tool and when any error generated Staff can raise support request via clicking one button which includes all traceback and any other necessary information for us to debug or they can raise new support work. We are thinking to integrate VSTS for our support work as well by calling API endpoint to create a task in VSTS.
I am thinking to use one service account in code that calls API to create a work item in VSTS however, I need to update System.CreatedBy field to the actual user rather than service account who raises this work item. I have seen numbers of other posts which says its read-only field.
The process is, I create a work item and then update CreatedBy field by calling following endpoint.
https://XXXXXX.visualstudio.com/DefaultCollection/_apis/wit/workitems/11?bypassRules=true&api-version=1.0
passing following JSON
[
{
"op": "replace",
"path": "/fields/System.CreatedBy",
"value": "Test, Mr <Test#example.com>"
},
]
This doesn't update the field.
Is there any way I can update this field? Thanks for your time.
Well, just read this https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/update?view=azure-devops-rest-6.0#update-a-link
NOTE: System.CreatedBy and System.CreatedDate can only be modified using bypass rules on work item creation, i.e. the first revision of a work item.