ArgorAvest
ArgorAvest

Reputation: 151

TeamCity REST API Error: Error has occurred during request processing (Not Acceptable)

I tried to receive in .NET information about TeamCity build. All works fine, except one: I tried to get build name, using request to REST API.

Here is my request:

https://myteamcity/httpAuth/app/rest/buildTypes/id:<build_id>/name

And here is my error: Error has occurred during request processing (Not Acceptable). Error: javax.ws.rs.WebApplicationException Not supported request. Please check URL, HTTP method and transfered data are correct.

In browser I received correct plain text information. What's wrong with REST API? All another requests work well.

Upvotes: 1

Views: 915

Answers (1)

cyberskunk
cyberskunk

Reputation: 1772

Accept header might cause the problem, try changing it to Accept: text/plain or removing it.

For example, when I request

curl -H "Accept: application/json" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass

I'm getting the same error, but the name is returned after changing value of the header to text/plain

curl -H "Accept: text/plain" http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass

or after removing the header from the request

curl http://teamcity/httpAuth/app/rest/buildTypes/id:buildId/name --user user:pass

Upvotes: 2

Related Questions