TeamCity设置带有其余API的buildType参数

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

我想使用rest api设置构建参数。然后我进行了一些研究,找到了这些文档和文章。

我按照上面的记录进行http呼叫。

请求获取参数

GET
Accept */*
http://myTeamCityServer/app/rest/buildTypes/id:myBuildTypeId/parameters/myParameter/value

响应

200
myValue

请求设置参数

PUT
http://myTeamCityServer/app/rest/buildTypes/id:myBuildTypeId/parameters/myParameter/value
--data yourValue

Response

200
myValue

所以什么都没有改变。 PUT响应与GET响应相同。它也返回200 OK。如何设置构建参数?我在哪里做错了?

提前感谢。

rest teamcity
1个回答
0
投票

尝试和错误学习;我通过PUT提出https请求。响应是:

403 Forbidden: Responding with 403 status code due to failed CSRF check: no "Origin" header is present and no authentication provided with the request, consider adding "Origin: http://myTeamCityServer" header.

对此响应,我将Origin标头放入请求中,并且请求按预期方式工作。

另外添加X-CSRF-Token标头解决了问题。

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