Changing the default value of a substitution parameter

The Test Management API provides a method for modifying existing substitution parameters. The method is called AddOrUpdateSubstitutionParameters(). To update the default value of a substitution parameter send a request such as the following:```text <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning"> soapenv:Header/ soapenv:Body prov:AddOrUpdateSubstitutionParametersRequest prov:Credentials prov:UserNametestuser</prov:UserName> prov:Passwordtestpassword</prov:Password> </prov:Credentials> <prov:ParameterizedMonitor monitorId="326334"> prov:SubstitutionParameters <prov:SubstitutionParameter id="0" name="UserName" value="mytestuser"/> </prov:SubstitutionParameters> </prov:ParameterizedMonitor> </prov:AddOrUpdateSubstitutionParametersRequest> </soapenv:Body> </soapenv:Envelope>


This message will reset the global value of UserName for monitor ID `326334` to `mytestuser`. It is not necessary to include in the request all of the substitution parameters defined for the monitor. Additionally, you can update single values for each `ParameterizedMonitor` in the request.

A successful response to the previous request appears below:

```xml 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <AddOrUpdateSubstitutionParametersResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>SUCCESS</ResponseStatus>
      </AddOrUpdateSubstitutionParametersResponse>
   </soap:Body>
</soap:Envelope>

If an invalid ID is sent, the server sends the following error message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <AddOrUpdateSubstitutionParametersResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>FAILURE</ResponseStatus>
         <ErrorMessage>The global substitution item for
               GPN.TestManagementWS.Service.DataMembers.SubstitutionParameter
               could not be found!</ErrorMessage>
      </AddOrUpdateSubstitutionParametersResponse>
   </soap:Body>
</soap:Envelope>

If an invalid monitorId is sent, the server sends the following error message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <AddOrUpdateSubstitutionParametersResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>FAILURE</ResponseStatus>
         <ErrorMessage>No backbone monitor could be retrieved for account DEV –
                       Test User and monitorId 1</ErrorMessage>
      </AddOrUpdateSubstitutionParametersResponse>
   </soap:Body>
</soap:Envelope>

Because it is essential for you to send valid values in the request, a best practice for using the API is copying the valid values from a GetParameterizedTests() query before setting the substitution parameter to its new value (for example, changing UserName from mytestuser to mybadusername. It is not possible to change the name of the substitution parameter or its ID. Those values are owned by the system and generated when the script is created and uploaded into Dynatrace Synthetic Monitoring.