Automic Workload Automation

 View Only
  • 1.  AE REST API V21 Documentation

    Posted May 15, 2024 02:44 PM

    We are trying to make use of the AE REST API with V21 and can't find documentation that helps understand specific uses, or in-depth uses for the API.  After a lot of trial and error due to the lack of finding any useful documentation, I've been able to create a few bash script using curl to use some REST calls to return some data from AE, but I need more specific examples/documentation.  Does anyone know of any, or of anywhere people have posted their programs?

    One thing I'd like to do is determine which agent groups an agent is in.  I can get an agent list using:

    URL="$REST_ENDPOINT/ae/api/v1/$CLIENT/system/agents"
    curl --header "Content-Type: application/json" \
      --user "$AE_USER_PW" \
      "$URL"

    I can get a list of agent groups  using:

    URL="$REST_ENDPOINT/ae/api/v1/$CLIENT/system/agentgroups"
    curl --header "Content-Type: application/json" \
      --user "$AE_USER_PW" \
      "$URL"

    Is there a schema/list of all objects that I can query with the objectSearch call?

    I've tried:

    $REST_ENDPOINT/ae/api/v1/$CLIENT/system/agents/$AGENT_NAME  #$AGENT_NAME is the name of an actual agent in the $CLIENT.

    and see the following:

    {
      "code" : 45212,
      "error" : "Object  '$AGENT_NAME' not found.",
      "details" : "No detail information available."
    }

    I tried:

    $REST_ENDPOINT/ae/api/v1/$CLIENT/system/agents/$AGENT_GROUP # $AGENT_GROUP is the name of an actual agent group in the $CLIENT

    and see that following:

    {
      "code" : 45212,
      "error" : "Object  '$AGENT_GROUP' not found.",
      "details" : "No detail information available."
    }

    If I search for either $AGENT_NAME, or $AGENT_GROUP in the UI, it finds them as objects.

    I'd LOVE to know what I'm doing wrong!! I'd also LOVE to know how I can search the AE objects to see which agent groups contain the agent in question. Where do I find the schema that will help me?



  • 2.  RE: AE REST API V21 Documentation

    Posted May 15, 2024 02:59 PM

    I found out how to get information for a specific agent group and that includes references to the individual agents via objectSearch and a json file specifying the object that I want information for.

    It'd be great to have comprehensive doc on how to use the json file (I've tried trial and error runs with different "filter_identifier" sections and object types). Is there any documentation available to help me with that?




  • 3.  RE: AE REST API V21 Documentation

    Posted May 16, 2024 03:34 PM

    Hello Steven,
    The only available documentation unfortunately is the official one. It lacks of precise explanation or even good examples but... its something.

    LINK

    Ive checked in both v21 and v24 documentation but it looks like there is no exact match for the thing you are looking for.
    However you could utilize the Get Object to export the definition of the HOSTG object and afterwards parse the agent names.

    system/agents/{agent_name} is correct resource and for me its working. However It does not work with HOSTG objects.

    {
        "active": true,
        "name": "MDZDEVPCWAPP148",
        "jcl_variant": "WINDOWS",
        "platform": "WINDOWS",
        "authenticated": true,
        "version": "21.0.9+build.1701861860536",
        "hardware": "x86/4/64",
        "ip_address": "10.32.107.71",
        "port": 2301,
        "software": "WinNT",
        "workload_max_job": -1,
        "workload_max_ft": -1,
        "tls": true,
        "linked": true
    }
    

    You can use GET /objects/{object_name} to export the definition of the HostGroup.
    There is also an option to add additional filter as query parameter - ?filter=agent_group_filters

    Without the filter you have one additional block for 'agent_group_attributes'. 
    The result is as follows :

    {
        "total": 1,
        "data": {
            "hostg": {
                "metadata": {
                    "version": "21.0.7"
                },
                "general_attributes": {
                    "type": "HOSTG",
                    "name": "HOSTG.WIN.PWC",
                    "platform": "WINDOWS",
                    "minimum_ae_version": "11.2"
                },
                "agent_group_filters": [
                    {
                        "type": "H",
                        "agent": "MDZDEVPCWAPP148",
                        "version": "*",
                        "hardware": "*",
                        "software": "*",
                        "software_version": "*",
                        "archive_key1": "*",
                        "archive_key2": "*",
                        "role": "*"
                    }
                ]
            }
        },
        "path": "SYSTEM/AGENTGROUPS/EU/WIN",
        "client": 400,
        "hasmore": false
    }
    

    I wrote few basic python scripts which i use to export/import objects and to 'play' with the json extracts and i had the same issue as you need to dig deep and test, test, test until you find the proper syntax and how exactly that thing works.



    ------------------------------
    ------------------------------
    Automic SME @ DXC.Technology
    ------------------------------
    ------------------------------



  • 4.  RE: AE REST API V21 Documentation

    Posted May 23, 2024 01:25 PM

    Thanks, Krum!

    I was successful at writing a Perl programs to make sure of the calls that you mentions.  My actual goal is to be able to add and remove and agent to/from all agent groups, but I guess I'll need to wait for the REST API to get more mature.