TeamCity REST API Error: Error has occurred during request processing (Not Acceptable)
TeamCity REST API Error: Error has occurred during request processing (Not Acceptable)
我试图在 .NET 中接收有关 TeamCity 构建的信息。一切正常,除了一个:我试图获取构建名称,使用对 REST API.
的请求
这是我的要求:
https://myteamcity/httpAuth/app/rest/buildTypes/id:<build_id>/name
这是我的错误:请求处理期间发生错误(不可接受)。
错误:javax.ws.rs.WebApplicationException
不支持的请求。请检查 URL,HTTP 方法和传输的数据是否正确。
在浏览器中我收到了正确的纯文本信息。 REST API 有什么问题?所有其他请求都运行良好。
Accept
header 可能会导致问题,请尝试将其更改为 Accept: text/plain
或将其删除。
例如,当我请求
curl -H "Accept: application/json" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass
我遇到了同样的错误,但是在将 header 的值更改为 text/plain
后返回了名称
curl -H "Accept: text/plain" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass
或从请求中删除 header 后
curl http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass
我试图在 .NET 中接收有关 TeamCity 构建的信息。一切正常,除了一个:我试图获取构建名称,使用对 REST API.
的请求这是我的要求:
https://myteamcity/httpAuth/app/rest/buildTypes/id:<build_id>/name
这是我的错误:请求处理期间发生错误(不可接受)。 错误:javax.ws.rs.WebApplicationException 不支持的请求。请检查 URL,HTTP 方法和传输的数据是否正确。
在浏览器中我收到了正确的纯文本信息。 REST API 有什么问题?所有其他请求都运行良好。
Accept
header 可能会导致问题,请尝试将其更改为 Accept: text/plain
或将其删除。
例如,当我请求
curl -H "Accept: application/json" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass
我遇到了同样的错误,但是在将 header 的值更改为 text/plain
curl -H "Accept: text/plain" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass
或从请求中删除 header 后
curl http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass