Impact 7.1, Fixpack 6 applied. Revising existing policies from GetHTTP calls to RESTfulAPIGET calls to RESTful API Data Sources. Majority of policies revised without issues. For one policy, the full URI for the RESTful service contains six parameters. Based on KC documentation, the attached function (redacted) created to perform the request. Passed syntax checks. When run, function is passed an instantiated object (NewObject()). However, following RESTfulAPIGET call, object members (status, data) are NULL. What is causing this?
Answer by ThomasRyan (2596) | Oct 14, 2016 at 08:06 PM
Config Object expects its param member would be set to an object and not a hash of objects. Once this is done the correct output occurs with no null values.
Original:
Function ObtainData(Object){ Config=NewObject(); Param1=NewObject(); Param1['param1']="value1"; Param2=NewObject(); Param2['param2']="value2”; Param3=NewObject(); Param3['param3']="value3"; Param4=NewObject(); Param4['param4']="multiword value"; Param5=NewObject(); Param5['param5']="integer"; Param6=NewObject(); Param6['param6']="integer”; params = {Param1, Param2, Param3, Param4, Param5, Param6}; Config['params']=params; Log("Config: "+Config); Object=RESTfulAPIGET('RESTAPIDSA','/URI', Config); Log("ResultCode: "+Object.status); Log("Data: "+Object.data); }
Fixed:
Function ObtainData(Object){ Config=NewObject(); Param=NewObject(); Param['param1']="value1"; Param['param2']="value2”; Param['param3']="value3"; Param['param4']="multiword value"; Param['param5']="integer"; Param['param6']="integer”; Config['params']=Param; Log("Config: "+Config); Object=RESTfulAPIGET('RESTAPIDSA','/URI', Config); Log("ResultCode: "+Object.status); Log("Data: "+Object.data); }
Can I take an IPL object and serialize it into JSON to be passed as a RESTFUL request? 1 Answer
How can I change the password for impactadmin userID in Impact 7.1? 1 Answer
Issues with installer Impactadmin ID connecting to the Object Server on 7.1 Impact 1 Answer
Migrating Impact to new installation for OS replacement (same version) 1 Answer