REST API href= attributes can be wrong

When using the REST API, the href= attributes in the XML responses can be wrong, because they are hard-coded in jetbrains/buildServer/server/rest/request/Constants to begin with "/app/rest".  That is only correct if your TeamCity server URL is something like http://tc.example.com/ or http://tc.example.com:8080/.  We recently moved our server and changed its URL to something like https://tc.example.com/teamcity/, which broke our integration tools.  The correct way to combine that URL with /app/rest/whatever produces https://tc.example.com/app/rest/whatever, not https://tc.example.com/teamcity/app/rest/whatever as is necessary.  The REST API needs to be changed to produce the correct href= attributes.

3 comments
Comment actions Permalink

Ross,

Current approach for "href" attribute is to contain relative path based on web application context (so you always need to add prefix to TeamCity applicaiton to it).
Do you consider this not convenient?

0
Comment actions Permalink

Yegor,

Yes, that's inconvenient.  And it's wrong, because what's being returned isn't a relative path (e.g., "dir1/dir2/file.js") but rather an absolute path (e.g., "/dir1/dir2/file.js").  Right now, I've coded around it, but consider this: href= ought to work the same way in the REST API XML responses as it does in HTML.  A correct relative URL would be acceptable as the second parameter to System.Uri.Uri(Uri, String).

Ross

0
Comment actions Permalink

Ross,

You are right, prepending href with "/" is probably not a good approach.

Are you OK with just removing it?

Do you think that changing this in a future version is OK (regarding compatibility with existing clients)?

0

Please sign in to leave a comment.