[Remedy] Python API

IronPython is a implementation of the Python programming language running on .NET, and it can use the ARSystem .NET API.

Another option is to use the standard Python implementation and the pyARS module (a wrapper of the Remedy C API).

qualifications.py [IronPython]

import clr

clr.AddReferenceByPartialName("BMC.ARSystem")

from BMC.ARSystem import *

server=Server()

server.Login("localhost", "Demo", "", "")

objList=server.GetListEscalation()
for i in range(objList.Count):
        print objList[i] + "   [Escalation]"
        print "   " + server.GetEscalation(objList[i]).RunIfQualification

objList=server.GetListFilter()
for i in range(objList.Count):
        print objList[i] + "   [Filter]"
        print "   " + server.GetFilter(objList[i]).RunIfQualification

def blacklisted(name):
        # I get errors trying to retrieve the following objets: 
	if name=="AP:Central-SetDescriptionFrom3WayJoinForm": return True
        if name=="AP:Central-SetGenericFieldFrom3WayJoinForm": return True
        return False

objList=server.GetListActiveLink()
for i in range(objList.Count):
        print objList[i] + "   [Active Link]" 
        if blacklisted(objList[i]):
                print "NOT RETRIEVED"
        else:
                print "   " + server.GetActiveLink(objList[i]).RunIfQualification

attachments.py [IronPython]

import clr
from System import *

clr.AddReferenceByPartialName("BMC.ARSystem")

from BMC.ARSystem import *

form = "AR System User Central File"
fieldid = 20020
entryid = "000000000000001"

server=Server()

server.Login("localhost", "Demo", "","")

print "FILE NAME:"
result = server.GetEntry(form, entryid, Array[UInt32]([fieldid]))
# that's a FieldValueList with a single entry <20020, filename>
for i in result:
        print i.Value

print "FILE CONTENTS:"
out = clr.Reference[Array[Byte]]()
server.GetEntryBLOB(form, entryid, Convert.ToUInt32(fieldid), out)
print Text.Encoding.Default.GetString(out.Value)