REST - GET - Param as Json

0
Hi Team, https://gateway.eu1.mindsphere.io/api/assetmanagement/v3/assets?page=0&size=100&filter={"typeId":"tenant.AssetType"}   I have to make the GET Rest Webservice call using the above endpoint with filters param as shown above. I tried to put {"typeId":"tenant.AssetType"} in a string and facing the below issue. Please help me in passing such param in REST call. com.mendix.core.CoreException: com.mendix.modules.microflowengine.MicroflowException: Illegal character in query at index 87: https://gateway.eu1.mindsphere.io/api/assetmanagement/v3/assets?page=0&size=100&filter={"typeId":"casssee.GenAsset"}     at DigitalTwinHome.MSGetAssetsOfAssetTypes (CallRest : 'Call REST (GET)')     at DigitalTwinHome.DTHomeHelper (SubMicroflow : 'MSGetAssetsOfAssetTypes') Advanced stacktrace:     at com.mendix.basis.component.InternalCoreBase.execute(InternalCoreBase.java:389) Caused by: com.mendix.modules.microflowengine.MicroflowException: Illegal character in query at index 87: https://gateway.eu1.mindsphere.io/api/assetmanagement/v3/assets?page=0&size=100&filter={"typeId":"casssee.GenAsset"}     at DigitalTwinHome.MSGetAssetsOfAssetTypes (CallRest : 'Call REST (GET)')     at DigitalTwinHome.DTHomeHelper (SubMicroflow : 'MSGetAssetsOfAssetTypes') Advanced stacktrace:     at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:146) Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 87: https://gateway.eu1.mindsphere.io/api/assetmanagement/v3/assets?page=0&size=100&filter={"typeId":"casssee.GenAsset"}     at java.net.URI.create(URI.java:852)     at com.mendix.http.HttpLocation.toUri(HttpLocation.scala:24)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:44)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:201)      
asked
2 answers
1

Hi Mohan,

Have you tried using urlencode to encode the JSON string you’re passing in the filter parameter?

https://docs.mendix.com/refguide/string-function-calls#a-name-urlencode-a-urlencode 

answered
0

Have you tried the Asset Management Connector? There is a Java Action integrated for the GET function of the Asset Type

answered