Automic Workload Automation

Expand all | Collapse all

Is there a vara type that does not strip the quotes?

  • 1.  Is there a vara type that does not strip the quotes?

    Posted 09-19-2018 01:46 PM

    ASO 12.1.2

     

    https://docs.automic.com/documentation/webhelp/english/ARA/12.1/DOCU/12.1/ARA%20Guides/Default.htm#REST%20API/AE_REST_AP… 

     

    I'm calling the AE REST API

     

    http://{{host}}:{{port}}/ae/api/v1/100/executions 

     

    using the following JSON body:

     

    {
    "object_name": "JOBP.LAB_NFV_NSO_CHANGE_IP_OF_SERVICE.2",
    "inputs": {
    "partnerid": "partner_id_v123",
    "ip": "1.1.1.1",
    "pool": { "name": "sktest-10-06-2017-aws1.ebiz.verizon.com_HAL_pool" }
    }
    }

     

    To launch a workflow.  Then I'm using a promtset (assigned to the workflow) to pass in and assign variables within the workflow.

     

    partnerid and ip are easy and work using Data Reference "UC_DATATYPE_STRING".  The variable pool (which is JSON itself) is the problem.  The problem is that when I assign pool using "UC_DATATYPE_STRING", the value as seen via a print is 

    2018-09-19 13:33:48 - U00020408 pool = {name=sktest-10-06-2017-aws1.ebiz.verizon.com_HAL_pool

    all the quotes get stripped.  WHY?  And more importantly, what vara type can I use where Automic does NOT strip the quotes?

     

    In troubleshooting:

    I can send this in the body:

     

    {
    "object_name": "JOBP.LAB_NFV_NSO_CHANGE_IP_OF_SERVICE.2",
    "inputs": {
    "partnerid": "partner_id_v123",
    "ip": "1.1.1.1",
    "pool": "{\"name\": \"sktest-10-06-2017-aws1.ebiz.verizon.com_HAL_pool\" }"
    }
    }

     

    and then pool = 

    2018-09-19 13:38:05 - U00020408 pool = { "name": "sktest-10-06-2017-aws1.ebiz.verizon.com_HAL_pool" }

     

    but this is not legal JSON in the body for pool.  In my real life use case the JSON (from the user interface) is rather large and I don't want to get away from JSON.

     

    Soo: what vara type can I use where Automic does NOT strip the quotes?



  • 2.  Re: Is there a vara type that does not strip the quotes?

    Posted 09-20-2018 05:50 AM

    Hi Mitchell,

     

    Not sure how the variables are being passed in your case. I would assume you enter the values in double quotes in the promptset, and then refer to these values inside the REST call ? 

     

     

     

    Are you doing something like below ?

     

     

    {
    "object_name": &MYOBJECT#
    }

     

    If so, you can try this instead:

     

    {
    "object_name": "&MYOBJECT#"
    }

     

    Best regards,

    Antoine



  • 3.  Re: Is there a vara type that does not strip the quotes?

    Posted 09-20-2018 02:37 PM

    My rest call is to launch the workflow.

    My prompt set is applied in the "variables & prompts" tab of the workflow.

    In my prompt set for pool:

     

    prompt set config



  • 4.  Re: Is there a vara type that does not strip the quotes?

    Posted 09-20-2018 06:55 PM

    The UC_DATATYPE_STRING can have quotes in it.

     

    It is my understanding that \ is a valid JSON escape for quotes. So it is my assumption that the quotes are getting removed as part of the request and not by Automic



  • 5.  Re: Is there a vara type that does not strip the quotes?

    Posted 09-21-2018 11:20 AM

    I'm sending the post from Postman directly, so the quotes are in there:



  • 6.  Re: Is there a vara type that does not strip the quotes?

    Posted 09-24-2018 08:27 AM

    Hi,

     

    Sorry but I don't think it's Automic-related. 

    The following characters are reserved in JSON and must be properly escaped to be used in strings:

    • Backspace is replaced with \b
    • Form feed is replaced with \f
    • Newline is replaced with \n
    • Carriage return is replaced with \r
    • Tab is replaced with \t
    • Double quote is replaced with \"
    • Backslash is replaced with \\

    Source: Free Online JSON Escape / Unescape Tool - FreeFormatter.com 

     

    In case you want to pass double quotes as a string, you will need to use escape characters, no matter what the endpoint is.

     

    Best regards,

    Antoine



  • 7.  Re: Is there a vara type that does not strip the quotes?

    Posted 10-12-2018 04:46 PM

    Hi mitchell.feldman,

    Were you able to resolve the issue with Michael & Antoine suggestions of using the escaped characters?