从CRM集成到Team Foundation服务器2018

问题描述 投票:0回答:1

我们有CRM,客户创建门票(变更请求,突发事件......)。从开发团队方面,我们拥有的Team Foundation Server 2018。

为了加快进程,我们想自动化整个事情。所以,当客户创造票,自动创建TFS用户故事。

我们开发的代码服用,每次创建时的机票,数据并投入JSON文件。 (将在Github上附加代码和共享的链接)但现在,我只需要的信息,是一个人有一个想法,如何JSON文件应该看起来像它需要发布到TFS以创建新的用户故事。

{
    "fields": {
        "System.WorkItemType": "User Story",
        "System.AreaPath": "EJ2TFS",
        "System.TeamProject": "EJ2TFS",
        "System.IterationPath": "EJ2TFS",
        "System.State": "New",
        "System.Reason": "New",
        "Microsoft.VSTS.Common.StateChangeDate": "2019-01-01T00:00:00Z",
        "System.ChangedBy": "Doe, John <firm\\doej>",
        "System.CreatedBy": "Doe, John <firm\\doej>",
        "System.Title": "Sample task created by POST API",
        "System.Discussion":"test1",
        "Microsoft.VSTS.Common.StateChangeDate": "2019-01-31T14:00:00",
        "Microsoft.VSTS.Common.Priority": 2,
        "Microsoft.VSTS.Common.ValueArea": "Business"
    }
}   

而错误的是:

{
    "$id": "1",
    "innerException": null,
    "message": "The request indicated a Content-Type of \"text/plain\" for method type \"POST\" which is not supported. Valid content types for this method are: application/json-patch+json.",
    "typeName": "Microsoft.VisualStudio.Services.WebApi.VssRequestContentTypeNotSupportedException, Microsoft.VisualStudio.Services.WebApi",
    "typeKey": "VssRequestContentTypeNotSupportedException",
    "errorCode": 0,
    "eventId": 3000
}
json tfs integration crm
1个回答
1
投票

看起来像你的有效载荷需要改造。我提到的情侣代码样本和分享这个片段的。 (请测试这一点,我没有得到一个机会来测试它)

POST https://dev.azure.com/fabrikam/{project}/_apis/wit/workitems/$User Story?api-version=5.0

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "My first user story"
  }
]

MS documentation example

GitHub sample

© www.soinside.com 2019 - 2024. All rights reserved.