我想使用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。如何设置构建参数?我在哪里做错了?
提前感谢。
尝试和错误学习;我通过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
标头解决了问题。