Access Remedy the Restful way

Version 6
    Share This:

    This application will help you to get, create or update data of your arsystem server in a easy way. No configuration of the application is needed. All necessary values are passed during runtime. It therefore is not optimized for performance but flexibility and simplicity instead.

    It is now feasible to even use Script Languages like Python, PHP, Groovy, Ruby, .... to easily access Remedy Data. This massively decreases development and maintenance costs for integrated BSM Solutions.

     

    Sample Use Cases:

     

    * Monitoring & Event Management

    * Software Deployment

    * Technical Configuration Management

    * Identity Management

    * Technical Automation

    * Mobile Service Desk

    * Mobile Change Management

     

    Important note: Our community edition is free for use but comes with absolutely no warranty and support. Please contact service@vipcon.com for a version with support and maintenance.

     

    1.1 Deployment

    Rename the arapi-x.war file to arapi.war and copy it to the webapps folder of your tomcat and restart it. e.g. your midtier tomcat

    High Availability

    If you have a HA environment, deploy the .war file to all your tomcats.

     

    Please see the attached file for a complete user guide.

     

    Examples:

     

    Get all Forms

     

    Request

     

     

    http://<tomcat>/arapi/<arserver>

     

     

    http://tomcat/arapi/arserver/

     

     

    Returns all forms on the Server as JSON

     

     

    Get all fields from a form

     

     

    Request

     

     

    http://<tomcat>/arapi/<arserver>/<schema>

     

     

    http://tomcat/arapi/arserver/AST:ComputerSystem

     

     

    Returns all fields with fieldid and fieldname from the Form as JSON

     

     

    Query Data

     

     

    To access data you need to provide a URL in the following format:

     

     

    http://<tomcat>/arapi/<arserver>/<schema>/<query>

     

     

    http://tomcat/arapi/arserver/HPD:Help%20Desk/'1'="INC000000000604"

     

     

    Create Data

     

     

    Data can be create via a POST Request

     

     

    Use the URL as follows

     

     

    http://<tomcat>/arapi/<arserver>/<schema>

     

     

    http://localhost:8080/arapi/arserver123.mydomain.de/HPD:Help%20Desk/

     

     

    The data itself needs to be provided as JSON in the following format

     

     

    {

         "<myReference>": {

             "<fieldid>": "<value>",

             "<fieldname>": "<value>"

         }

    }

     

     

    The response will return a JSON with the original reference and the created ar system request id

     

     

    {

         "<myReference>": "<arentryid>"

    }

     

     

    e.g.

     

     

    Sample Request

     

     

    {

         "myRequestNumber12": {

             "7": „New“,

             "8": "Servusle"

         }, "myRequestNumber14": {

             "Status": "0",

             "8": "Moin"

         }

    }

     

     

    Sample Response

     

     

    {

         "myRequestNumber12": "000000000000028",

         "myRequestNumber14": "000000000000031"

    }

     

     

    Update Data

     

     

    Data can be updated via a PUT Request

     

     

    Use the URL as follows

     

     

    http://<tomcat>/arapi/<arserver>/<schema>

     

     

    http://localhost:8080/arapi/arserver123.mydomain.de/HPD:Help%20Desk/

     

     

    The data itself needs to be provided as JSON in the following format

     

     

    {

         "<requestid>": {

             "<fieldid>": "<value>",

             "<fieldname>": "<value>"

         }

    }

     

     

    The response will be in JSON and will return "success" or an error for each request

     

     

    {

         "<requestid>": "success"

    }

     

     

    e.g.

     

     

    Sample Request

     

     

    {

         "000000000000031": {

             "Status": "0",

             "8": "Servusle"

         }, "000000000000028": {

             "7": "New",

             "8": "Moin"

         }

    }

     

     

    Sample Response

     

     

    {

         "000000000000028": "success",

         "000000000000031": "success"

    }

     

    Python Usage Example

    The following Python code queries the CMDB AST:ComputerSystem with the query: 'Name' LIKE "%.manyos.de" AND 'Data Set Id' = "BMC.ASSET". For each CI the name an the Reconciliation ID are printed. Each CI will be checked for Dependency Relation. For each relation ClassID of the relation and the ClassID of the Destination Class are printed.

    The Sample contains also the necessary methods for user authentication and illustrates how easy it is to access data via the API.

     

     

    import json

    from pprint import pprint

    import urllib2

     

    def printme(str_name, str_reconid ):

        "This prints a passed string into this function"

        print str_name + " " + str_reconid

        getRelations(str_reconid)

        return

     

    def getRelations(str_reconid):

         json_data = urllib2.urlopen("http://tomcat/arapi/arserver/BMC.CORE:BMC_Dependency/'Source.ReconciliationIdentity'=%22" + str_reconid + "%22")

         mydata = json.load(json_data)

         #pprint (mydata)

         for myRelation in mydata:

             print(mydata[myRelation]["ClassId"] + " -> " + mydata[myRelation]["Destination.ClassId"])

         return

     

    username = "Demo"

    password = "12345"

     

    # create a password manager

    password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()

     

    # Add the username and password.

    # If we knew the realm, we could use it instead of None.

    top_level_url = "http://muc-vip-srvw084.intern.manyos.de:8080/arapi"

    password_mgr.add_password('myRealm', top_level_url, username, password)

     

    handler = urllib2.HTTPBasicAuthHandler(password_mgr)

     

    # create "opener" (OpenerDirector instance)

    opener = urllib2.build_opener(handler)

     

    # use the opener to fetch a URL

    opener.open(top_level_url)

     

    # Install the opener.

    # Now all calls to urllib2.urlopen use our opener.

    urllib2.install_opener(opener)

     

    # use the opener to fetch a URL

    json_data = urllib2.urlopen("http://tomcat" + urllib2.quote("/arapi/arserver/AST:ComputerSystem/'Name' LIKE \“%.vipcon.com\“ AND 'Data Set Id' = \"BMC.ASSET\""))

     

    data = json.load(json_data)

     

    for o in data:

      printme(data[o]["Name"], data[o]["Reconciliation Identity"])

     

    json_data.close()

     

    Latest version can be accessed from here

    vipcon/arapi · GitHub