Create Large Amount of Work Items in TFS Using Javascript REST API

后端 未结 1 1017
生来不讨喜
生来不讨喜 2021-01-26 15:17

I need to create around 6000 work items via my TFS extension. I use typescript and REST API in my extension.

below is the code I use to create work item



        
相关标签:
1条回答
  • 2021-01-26 15:55

    Using Work item batch api instead:

    For example:

    http://[collection url]/_apis/wit/$batch?api-version=1.0
    

    Body:

    [
      {
        "method": "PATCH",
        "uri": "/ScrumStarain/_apis/wit/workItems/$Product Backlog Item?api-version=1.0",
        "headers": {
          "Content-Type": "application/json-patch+json"
        },
        "body": [
          {
            "op": "add",
            "path": "/fields/System.Title",
            "value": "apip1"
          },
          {
            "op": "add",
            "path": "/id",
            "value": "-1"
          }
        ]
      },
      {
        "method": "PATCH",
        "uri": "/ScrumStarain/_apis/wit/workItems/$Task?api-version=1.0",
        "headers": {
          "Content-Type": "application/json-patch+json"
        },
        "body": [
          {
            "op": "add",
            "path": "/fields/System.Title",
            "value": "apip2"
          },
          {
            "op": "add",
            "path": "/id",
            "value": "-2"
          }
    
        ]
      }
    ]
    

    More information, you can refer to: Work item batch operations

    0 讨论(0)
提交回复
热议问题