Automic Workload Automation

  • 1.  Web Service Connection Object

    Posted Oct 02, 2018 05:39 AM

    Hi all,

     

    currently i try to build up a generic JOBS with PromptSet to execute WebService REST requests.

     

    My Questions:
    Is it possible to read the URL Endpoint in the WebService ConnectionObject and put it into a Variable?

     

    To execute the JOBS successfully i need currently following variables in my PromptSet:

     

    1. ConnectionObject

    2. URL Endpoint (server:port)

    3. Recource

    4. Method (get, post, ....)

     

     

    In the JOBS I choose "Override URI Endpoint" and fill it with the variables of the prompset.

    In the Pre_Process i do following to assign the ConnectionObject to Connection of my JOBS:

     

    :PUT_ATT RestConnection = &RESTCONN#
    :PUT_ATT Method = &METHOD#

     

    I want to achieve that the 2. "URL Endpoint" is automatically filled, when i chosse the 1. "ConnectionObject" in the PromptSet.

     

    Is that possible? Or is there a much better way to do this?

     

    Thanks for your help in advance.

     

    regards,

    Ben



  • 2.  Re: Web Service Connection Object

    Posted Oct 02, 2018 07:17 AM

    Or is there a much better way to do this?

    It depends. Since you asked, and since you are using PromptSets, which means you are not looking to schedule execution fully without any human input anyway, the RESTED Firefox extension springs to mind, and possibly also a commercial service that I can not name here, but that could probably be located with a Google search. Or, you could always use curl from within Automic, too.

     

    That is, unless there are any other reasons why Automic integration is essential, like wanting to process the results of the REST call further in Automic without reading them from e.g. a file.

     

    As for the Web Service objects themselves, sorry, can't comment in any useful way on those, as they are rather new and I have not tried them.

     

    Hth,



  • 3.  Re: Web Service Connection Object

    Posted Oct 02, 2018 08:06 AM

    Hi,

     

    thanks for your reply.

    How do i setup up the CURL command?
    Do you have a simple example or is there a documentation available from Automic?

     

    regards,

    Ben



  • 4.  Re: Web Service Connection Object

    Posted Oct 02, 2018 08:16 AM

    is there a documentation available from Automic?

    Well, not on that particular usage, because it's not a tool made by Automic but just another command line tool that can be called from within Automic, like any command line tool.

     

    It's available stock on most Linux distrubutions, or as a compiled binary for Windows. Once you have that installed, just call curl with the required parameters. REST calls via http GET are straightforward, and for http POST, you can simply put your content to be posted into a file and pass it to curl, like so (Unix example):

     

    cat > post_data << EOF
    { (some JSON stuff here)
    }
    EOF
     
    $ curl https://user:password@host.example.com:port/request --data @post_data
    You can fill curl parameters dynamically from Automic by using Automic &variables#, and any stdout output from curl will end up in the Automic report.
    Hint: You can also conviniently format JSON output on Unix with "jq", if you need to.
    Regards,
    Carsten


  • 5.  RE: Web Service Connection Object

    Posted Dec 10, 2020 11:28 AM
    Dear RA Rest Users,
    is it possible to set the URL Endpoint with a
    :PUT_ATT Script Line ?

    Best regards,
    Dirk


  • 6.  RE: Web Service Connection Object

    Posted Dec 11, 2020 12:57 AM
    No need to do that, I just set a variable and use like in the picture.  This variable could be inherited or populated via Promptset



  • 7.  RE: Web Service Connection Object

    Posted Dec 14, 2020 10:57 AM
    Edited by Scott Hughes Dec 14, 2020 11:02 AM
    Using variables on the URI override is a great solution when things are already resolved.  I found a need to set the URI from pre-processing.  In my use case I lookup all meta data from a static variable.  I have an include that is a short script to give me a number back for the environment, 1 for prod, 2 for uat, 3 for dev, 4 for dr.  I use that number to offset what I look up so I can promote my entire solution from dev with production meta data and never edit any objects in production.  My rest webservice preprocess looks like this:

    :INC JOBI.GET_CLIENT, NOFOUND = IGNORE
    01 !this include script returns 1 in prod, 2 in UAT, and 3 in Dev
    02 !Use &PC_NUM# as an arg in variable lookups ie GET_VAR(("VARA.STATIC.FIREWALL.DATA", "HW", &PC_NUM#)
    03 :SWITCH &$CLIENT#
    04 !adding 1000 as alternate prod environment for lb dr evolution
    05 :CASE 1000
    06 :PSET &PC_NUM# = 1
    07 :CASE 0100
    08 :PSET &PC_NUM# = 1
    09 :CASE 0102
    10 :PSET &PC_NUM# = 2
    11 :CASE 0101
    12 :PSET &PC_NUM# = 3
    13 :ENDSWITCH

    :SET &LV_APP# = GET_VAR("VARA.STATIC.UI_JOB.DATA", "AUTH_API", &PC_NUM#)
    :SET &LV_ENV# = GET_VAR("VARA.STATIC.UI_JOB.DATA", "API_ENV", &PC_NUM#)

    :SET &LV_URI# = 'https://&LV_APP#.&LV_ENV#/login'
    :P &LV_URI#
    :PUT_ATT uriOverride = &LV_URI#


    Technically I could skip the put_att and populate the override uri endpoint on the form with: &LV_URI#, but I was already in preprocessing.

    A good way to find the name of the attributes for RA jobs, (REST, FTP etc) is to export them to xml and review there.  The tag of the attribute will match up.  <component con="0" enc="0" type="2" value="example for forum" xmlName="uriOverride"/>  I put "example for forum" on object form then searched the xml for that phrase.
    ------------------------------
    Scott Hughes
    Senior Automation Engineer
    Verizon
    Albuquerque, NM
    ------------------------------