Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Using Variables_CreateOrUpdateVariableDeclaration with the JSON api



  • I am trying to create Free Text variables with the Json api.

    Here is the JSON I am posting to Variables_CreateOrUpdateVariableDeclaration:

    {
    "API_Key":"apikey1",
    "teamcity_build":"my_variable_name",
    "Scope_Code":"X",
    "Scoped_Application_Id":14,
    "Scoped_Environment_Id":3,
    "Required_Indicator":"Y",
    "Variable_Configuration":"<Inedo.BuildMaster.Extensibility.Variables.FreeTextVariable Assembly="BuildMasterExtensions"><Properties /></Inedo.BuildMaster.Extensibility.Variables.FreeTextVariable>",
    "Sensitive_Indicator":"N"}

    Here is the response I get:

    9413161Variables_CreateOrUpdateVariableDeclaration24`XML parsing: line 1, character 70, A string literal was expected

    Can you please help me resolve the issue?

    Product: BuildMaster
    Version: 4.5.2



  • I would also like to note, I am using C# and the issue appears to come from the quotes around Assembly name. I am unsure how else to send it as I have to escape the double quotes on my side. So if you could get a C# sample that creates a variable declaration that would be much appreciated. Thank you.



  • Using a \ character is correct for escaping in JSON; that should work. We will try to reproduce this, but in the meantime are you able to use single quotes instead in the XML?

    Assembly='BuildMasterExtensions'
    

    should also parse as valid XML if I'm not mistaken.



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation