getTriggerParameter API request issue

Hello, I am trying to perform a bulk update of triggers in our self-hosted TC (TeamCity Enterprise 2025.03 (build 186049)). To determine a correct PUT request, I've tried to receive a correct field via the GET. Using the documentation https://www.jetbrains.com/help/teamcity/rest/buildtypeapi.html#getTriggerParameter, I've attempted to receive a “cronExpression_dw” parameter, which later I'd like to update via the PUT. But after multiple various attempts I keep failing. URL I am using is https://SERVERURL/app/rest/buildTypes/id:BUILDTYPEID/triggers/TRIGGER_22, and this gives me a full trigger content:

<trigger id="TRIGGER_22" type="schedulingTrigger">

<properties count="16">

<property name="cronExpression_dm" value="*"/>

<property name="cronExpression_dw" value="2-7"/>

<property name="cronExpression_hour" value="2"/>

<property name="cronExpression_min" value="0"/>

<property name="cronExpression_month" value="*"/>

<property name="cronExpression_sec" value="0"/>

<property name="cronExpression_year" value="*"/>

<property name="dayOfWeek" value="Sunday"/>

<property name="enableQueueOptimization" value="true"/>

<property name="hour" value="2"/>

<property name="minute" value="0"/>

<property name="promoteWatchedBuild" value="true"/>

<property name="revisionRule" value="lastFinished"/>

<property name="revisionRuleBuildBranch" value="+:<default>"/>

<property name="schedulingPolicy" value="cron"/>

<property name="timezone" value="America/Chicago"/>

</properties>

</trigger>

As a logical next step to receive a specific parameter, based on the mentioned earlier documentation I am trying to receive a value of a specific fieldname using URL like https://SERVERURL/app/rest/buildTypes/id:BUILDTYPEID/triggers/TRIGGER_22/cronExpression_dw. As a response I am receiving:

<errors>

<error message="Responding with error, status code: 400 (Bad Request). Details: jetbrains.buildServer.server.rest.errors.BadRequestException: Only 'disabled' setting names is supported. 'cronExpression_dw' unknown. Invalid request. Please check the request URL and data are correct."/>

</errors>

Could you please explain what am I doing wrong and how exactly can I get and then update a specific property of a trigger using REST API?

0
4 comments
Hi,

Please refer to the following Knowledge Base article regarding changing a specific property of the build trigger using REST API: https://youtrack.jetbrains.com/articles/SUPPORT-A-1848

Best regards,
Anton
1
These articles are from the autogenerated API reference. These methods exist but allow for getting and updating only the 'disabled' parameter, to disable/enable triggers using API.
A full trigger entity is expected when modifying the trigger. This is also mentioned in the documentation, even if not as detailed as in the article: https://www.jetbrains.com/help/teamcity/rest/manage-build-configuration-details.html#Manage+Build+Triggers

Best regards,
Anton
1

Anton Vakhtel Thank you for the detailed explanation!

0

Please sign in to leave a comment.