Manage Typed Parameters
This article lists REST API requests concerning typed parameters.
To get a list of all build parameters of a project, use:
GET/app/rest/projects/<locator>/parameters
For a build configuration:
GET/app/rest/buildTypes/<locator>/parameters
Both endpoints respond with the Properties entity which contains a list of Property instances. These include:
name
— parameter namevalue
— parameter valuetype
— Type, contains:rawValue
— parameter specification as defined in the UI
To get a specific parameter, use:
GET/app/rest/projects/<locator>/parameters/<name>
or
GET/app/rest/buildTypes/<locator>/parameters/<name>
Accepts and returns text/plain
, application/XML
or application/json
. Supply the relevant Content-Type header to the request.
To create a build parameter, send Property to:
POST/app/rest/projects/<locator>/parameters/<name>
or
POST/app/rest/buildTypes/<locator>/parameters/
Note that secure parameters, for example type=password
, are listed, but the values are not included into the response.
Example payload:
<property name="<parameterName>" value="passwordValue">
<type rawValue="password"/>
</property>
{
"name" : "parameterName",
"type" : {
"rawValue" : "password"
},
"value" : "passwordValue"
}
To update the whole build parameter, send an updated Property to:
PUT/app/rest/projects/<locator>/parameters/<name>
or
PUT/app/rest/buildTypes/<locator>/parameters/<name>
To delete a specific parameter, use:
DELETE/app/rest/projects/<locator>/parameters/<name>
or
DELETE/app/rest/buildTypes/<locator>/parameters/<name>
You can edit the parameters collection when sending POST requests to the /app/rest/buildQueue
endpoint. These parameters (if a new parameter was created) and parameter values (if an existing parameter was modified) will be in effect for this specific build only.
<build personal="true" branchName="myBranch">
<buildType id="MyBuildConfigID"/>
<comment>
<text>Build for testing REST API</text>
</comment>
<agent id="286"/>
<properties>
<property name="system.existingParameter" value="myValue"/>
<property name="env.newPasswordParameter" value="mySecret">
<type rawValue="password"/>
</property>
</properties>
</build>
{
"branchName": "myBranch",
"personal": true,
"buildType": {
"id": "MyBuildConfigID"
},
"comment": {
"text": "Build for testing REST API"
},
"agent": {
"id": 286
},
"properties": {
"property": [{
"name": "system.existingParameter",
"value": "myValue"
},
{
"name": "env.password",
"value": "mySecret",
"type": {
"rawValue": "password"
}
}
]
}
}
Learn more: Start Custom Build.
Thanks for your feedback!