拉取请求状态-TFS不会保留添加到状态的自定义属性

时间:2019-12-11 16:21:40

标签: tfs azure-devops-rest-api

我们正在环境中运行TFS 2018 Update 2。

我们会将发现here的示例json发送到我们的服务器,并且该示例被成功接受:

{
  "properties": {
    "sampleId": 7,
    "customInfo": "Custom status information",
    "startedDateTime": {
      "$type": "System.DateTime",
      "$value": "2017-09-19T14:50:26.7410146Z"
    },
    "weight": {
      "$type": "System.Double",
      "$value": 1.75
    },
    "bytes": {
      "$type": "System.Byte[]",
      "$value": "dGhpcyBpcyBzYW1wbGUgYmFzZTY0IGVuY29kZWQgc3RyaW5n"
    },
    "globalId": {
      "$type": "System.Guid",
      "$value": "1e788cb9-9d3d-4dc6-ac05-822092d17f90"
    }
  },
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-1",
    "genre": "vsts-samples"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1"
}

但是响应与文档中的看起来不一样。相反,它看起来像这样:

{
  "id": 6,
  "state": "succeeded",
  "description": "Sample status succeeded",
  "context": {
    "name": "sample-status-1",
    "genre": "vsts-samples"
  },
  "creationDate": "2019-12-11T16:14:05.0574648Z",
  "updatedDate": "2019-12-11T16:14:05.0574648Z",
  "createdBy": {
    "displayName": "...",
    "url": "https://.../_apis/Identities/0b85e078-130d-4cb8-a450-17c5c7efccec",
    "_links": {
      "avatar": {
        "href": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
      }
    },
    "id": "0b85e078-130d-4cb8-a450-17c5c7efccec",
    "uniqueName": "...",
    "imageUrl": "https://.../_api/_common/identityImage?id=0b85e078-130d-4cb8-a450-17c5c7efccec"
  },
  "targetUrl": "http://fabrikam-fiber-inc.com/CI/builds/1",
  "_links": {
    "self": {
      "href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d/pullRequests/58/statuses/6"
    },
    "repository": {
      "href": "https://.../_apis/git/repositories/35fe73eb-7af1-4bba-bf04-545611fcac1d"
    }
  }
}

属性消失了。有什么事吗 难道是某种完全误导性的文档?

1 个答案:

答案 0 :(得分:0)

要解决您的问题,请检查以下各项:

  1. 在运行Status请求之后,检查POST是否在拉取请求上更新。

enter image description here

  1. 在浏览器中按F12键,然后发送POST请求以检查statuses,以查看是否可以在响应正文中获得properties

enter image description here

  1. 通过转到Administration Console -- Application Tier或在Web门户上检查About来检查TFS版本。我们无法在TFS 2018.2中重现该问题。

enter image description here