TFS Rest API:有关附件和链接删除操作的查询 [英] TFS Rest API : query regarding the attachment and link removal operation

查看:68
本文介绍了TFS Rest API:有关附件和链接删除操作的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

这里我们需要确认id应该通过链接的删除请求传递。即删除附件并使用Rest API链接。

Here with we need to confirm the id supposed to pass with the remove request of attachment an link. i.e. Remove of attachment and link with Rest API.

此ID是否指向附件和链接的订单ID?

Is this id refers to the order id of the attachment and links?

示例:

添加了2个附件和2个链接的一个工作项。所以为了删除附件和链接,我们传递了它们的订单ID。我们正在考虑的顺序是下面提到的附件和链接数据获取工作项请求的顺序。

One Work item having 2 attachment and 2 link added. so in order to delete attachment and link we are passing the order id of them. order we are considering is the sequence in which attachment and links data coming with get work item request mentioned below.

http://< host>:< port> / tfs / DefaultCollection /_apis/wit/workitems?ids=3087&$expand=all&api-version=1.0

http://<host>:<port>/tfs/DefaultCollection/_apis/wit/workitems?ids=3087&$expand=all&api-version=1.0

回复:

删除相关链接。在上面的响应中以1的顺序列出。我们将带有删除请求的ID传递为1。

To remove the Related link. which listed at order 1 in above response. we are passing the id with remove request as 1.

[

 

  {

    " op":" remove",$
    " path":" / relations / 1"

  } b $ b]

[
 
  {
    "op": "remove",
    "path": "/relations/1"
  }
]

同样,为了删除在上面的回复3中列出的附件  Sample1.txt ,我们正在通过移除请求的ID为3。

Similarly to remove the the attachment Sample1.txt which listed at the order 3 in above response we are passing the id with remove request as 3.

[

 

  {

    " op":" remove",$
    " path":" / relations / 3"

  } b $ b]

[
 
  {
    "op": "remove",
    "path": "/relations/3"
  }
]

如果要删除单个请求中的链接和附件,我们将传递ID如下。

In case to delete both the link and attachment in single request then we are passing id as following.

[

 

  {

    " op":" remove",$
    " path":" / relations / 1"

  },

[
 
  {
    "op": "remove",
    "path": "/relations/1"
  },

  {

    " op":" remove",$
    "路径":" / relations / 2 "

  },

  {
    "op": "remove",
    "path": "/relations/2"
  },

]

/ 1 相关链接和 / 2 表示样本附件。样本附件的原始订单是3,但我们也将其删除与其他删除操作一样,它预期其id为2,因为在删除相关链接订单后
被更改。

/1 for the related link and /2 for the sample attachment. original order for the sample attachment is 3 but we are also deleting it with other removal operation it expect its id as 2 as after deletion of related link order gets changed.

if我们传递了关系/ 3的附件然后它的给定索引超出范围错误。

if we are passing relation/3 for the attachment then its giving index out of range error.

如果我们将此id作为id值传递,我们也会得到类似的错误我们 收到附件获得回复。所以在这种情况下如果我们通过了样品附件  / relation / 2439然后我们也从
错误中得到索引

similar error we are also getting if we are passing this id as the id value which we  received for the attachment get response. so in this case for sample attachment if we are passing  /relation/2439 then also we are getting below index out of error

如果我们将id作为上面示例中提到的顺序传递,则附件和链接会被删除而没有任何错误。

Attachment and link getting removed with out any error if we pass id as the order as mentioned in above example.

那么请你确认通过删除请求传递的id附件和链接。 id是指我们正在使用的订单。

So can you please confirm the id which supposed to pass with the remove request of attachment and link. is id refer to the order we are using.

请尽快恢复原状。

谢谢。

推荐答案

您好Aresha,

Hi Aresha,

带有附件和链接删除请求的ID传递是订单ID。

The id pass with the remove request of attachment and link is the order id.

我想要清除它,顺序从0开始。删除order1链接后,只剩下3个链接。如果您要删除初始订单3链接,则需要传递2.

What I want to clear it that, the order is begin with 0. After you remove the order1 link, there are only 3 links left. If you want to remove the initial order3 link, you need to pass 2.

每次执行删除链接或附件操作时,特定链接的顺序都将为重新计算。

Every time you execute a remove link or attachment operation, the order of a specific link will be recalculated.

最好的问候


这篇关于TFS Rest API:有关附件和链接删除操作的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆