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?
Please sign in to leave a comment.
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
Anton Vakhtel So I can't work with a specific parameter via GET or PUT, therefore https://www.jetbrains.com/help/teamcity/rest/buildtypeapi.html?_gl=1%2Albocx1%2A_gcl_au%2AMTM2MzI2NzA3Ny4xNzQ0Nzk5NDE0%2AFPAU%2AMTM2MzI2NzA3Ny4xNzQ0Nzk5NDE0%2A_ga%2AMTcyNTI3MzE3MC4xNjg3MTY3NDI4%2A_ga_9J976DJZ68%2AMTc0NDgwNTc5Mi42Ny4xLjE3NDQ4MDU4ODUuNTguMC4w#setTriggerParameter and https://www.jetbrains.com/help/teamcity/rest/buildtypeapi.html?_gl=1%2Albocx1%2A_gcl_au%2AMTM2MzI2NzA3Ny4xNzQ0Nzk5NDE0%2AFPAU%2AMTM2MzI2NzA3Ny4xNzQ0Nzk5NDE0%2A_ga%2AMTcyNTI3MzE3MC4xNjg3MTY3NDI4%2A_ga_9J976DJZ68%2AMTc0NDgwNTc5Mi42Ny4xLjE3NDQ4MDU4ODUuNTguMC4w#getTriggerParameter articles exist and describes such actions? And I should provide a full Trigger entity as a request body instead like You've described in https://youtrack.jetbrains.com/articles/SUPPORT-A-1848?
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
Anton Vakhtel Thank you for the detailed explanation!