1

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.

user3678528
  • 1,741
  • 2
  • 18
  • 24
Sergey Luchko
  • 2,996
  • 3
  • 31
  • 51

2 Answers2

5

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

Matt
  • 3,684
  • 1
  • 17
  • 19
1

I solved problem: build type locator was id:Build configuration ID

current_build_date=`date +%%Y-%%m-%%d:%%H:%%M:%%S` 
echo $current_build_date;
curl -u Login:Password \
              -X PUT \
              -d $current_build_date \
              -H 'Content-Type: text/plain' \
              https://teamcity.billing.ru/httpAuth/app/rest/buildTypes/id:Build

configuration ID/parameters/current_build_date
Sergey Luchko
  • 2,996
  • 3
  • 31
  • 51