teamcityteamcity-9.0teamcity-8.0

TeamCity API setting configuration parameters


I have configuration parametr current_build_date (User Defined Parameter) I want just to set this parameter to current date by API TeamCity.

On docs I have seen this:

http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/parameters/<parameter_name>

I know my Build configuration ID, but I can't understand how by this to make buildTypeLocator.

I assume result will be something like this:

 curl -u Login:Password \
      -X PUT \
      -d 'valueOfMyParam' \
      -H 'Content-Type: text/plain' \
      http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/parameters/current_build_date

I will realy appreciate if somebody who knows TeamCity API will help me with this problem.

I made attempt just to pass instead of buildTypeLocator my Build configuration ID and I got ERROR:

[17:08:25][Step 3/3] Error has occurred during request processing (Not Found).
[17:08:25][Step 3/3] Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No project found by name or internal/external id 'BuildConfigurationID'.

If there are any problems or ambiguities with my question please add comment, i'll try to fix it.


Solution

  • If you browse the REST API endpoints in a browser you'll be able to see the format of the build locator.

    Visit http://teamcity:8111/httpAuth/app/rest/buildTypes/ and you'll see the entries have a href attribute that contains the buildLocator (generally a property:value combination)

    enter image description here

    You'll then be able to navigate using that url / communicate via the API

    enter image description here

    Hope this helps