Search Module Response Error - IMTBuffer Instead of JSON

Im making a custom app, and im having an issue in the search module

  • While the endpoint works fine when tested using Postman, running the module in a test scenario resulted in a response body displaying “imtbuffer(97)” instead of the expected JSON format.

Here is the communication part of the module:

{
	// Request to API endpoint.
	"url": "/{{parameters.rectype}}/query",                       // Relative to base URL
	"method": "POST",
	"headers": {},                         // Additional HTTP headers
	"qs": {                                // Query string
		"offset": "{{parameters.offset}}"  // Parameter "search" that is defined in Mappable parameters.
	},
	"body": {},

	// Response handling
	"response": {
 		"output": "{{item}}",      // i have tried using toString() on the item
		"iterate": "{{body.recs}}",       
		"limit": "{{parameters.limit}}"    // Limits number of output bundles as requested by user (even if API returns more items).
	}
}

Relevant Screenshots

  • This is the response body:

  • And i dont know if this is useful:
    image

  • Im also getting this “general error”:

{
    "type": "error",
    "array": "[200] ",
    "_engineData": {
        "calledAt": "Not available"
    }
}
  • This is the expected output:
{
    "recs": [
        {
            "id": "b0a523606ae8",
            "name": "name2",
            "createdAt": "2023-04-13T17:09:47+00:00",
            "updatedAt": "2023-04-18T17:09:47+00:00"
        },
        {
            "id": "0c841ade9610",
            "name": "name1",
            "createdAt": "2023-04-13T17:04:47+00:00",
            "updatedAt": "2023-04-19T17:04:47+00:00"
        }
    ],
    "total": 2
}

Any help would be appreciated!

if your content is Encoded with gzip then put this
"gzip":true

replace this in with your response code

 "response": {
        "type": "*",
        "output": "{{body}}",
        "error": {
            "message": "{{body.errors[].code}}"
        }
    }

here is my full code for your better understanding

{
   "url":"/rate/v1/rates/quotes",
   "method":"POST",
   "body":{
      "accountNumber":{
         "value":"{{parameters.accountNumber}}"
      },
      "rateRequestControlParameters":{
         "rateSortOrder":"{{parameters.rateSortOrder}}",
		 "variableOptions":"{{parameters.variableOptions}}",
         "returnTransitTimes":"{{parameters.returnTransitTimes}}",
         "returnLocalizedDateTime":"{{parameters.returnLocalizedDateTime}}"
      },
      "requestedShipment":{
         "shipper":{
            "address":{
               "city":"{{parameters.city}}",
               "stateOrProvinceCode":"{{parameters.stateOrProvinceCode}}",
               "postalCode":"{{parameters.postalCode}}",
               "countryCode":"{{parameters.countryCode}}",
               "residential":"{{parameters.residential}}"
            }
         },
         "recipient":{
            "address":{
               "city":"{{parameters.Rcity}}",
               "stateOrProvinceCode":"{{parameters.RstateOrProvinceCode}}",
               "postalCode":"{{parameters.RpostalCode}}",
               "countryCode":"{{parameters.RcountryCode}}",
               "residential":"{{parameters.Rresidential}}"
            }
         },
         "shipDateStamp":"{{parameters.shipDateStamp}}",
         "pickupType":"{{parameters.pickupType}}",
         "packagingType":"{{parameters.packagingType}}",
		 "requestedPackageLineItems":"{{parameters.requestedPackageLineItems}}",
         "shippingChargesPayment":{
            "paymentType":"{{parameters.paymentType}}"
         },
         "rateRequestType": "{{parameters.rateRequestType}}",
         "customsClearanceDetail":{
            "commodities":"{{parameters.commodities}}"
         }
      },
      "carrierCodes":[
         "{{parameters.carrierCodes}}"
      ]
   },
   "headers":{
      "authorization":"Bearer {{parameters.access_token}}"
   },
   "gzip":true,
   "response": {
        "type": "*",
        "output": "{{body}}",
        "error": {
            "message": "{{body.errors[].code}}"
        }
    }
}
1 Like

Hey!! thank you for responding
i tried what u said but nothing changed

Your custom app’s “Base” needs a couple of things to handle gzipped + json content.

Screenshot_2023-10-04_081051

If you still have any issues, please provide updated screenshots.

2 Likes

Hello, thanks for responding
i tried this and the issue is still the same
i dont think the content is gzip encoded
and i still dont understand why im getting json when i try the endpoint on Postman
but get IMTBuffer when i try it in the scenario

i rechecked the headers used in Postman

ill try these and let u know

the same error persists
but the buffer changed

I have found the solution !
by removing the empty body from my communication section , the response body no longer returns an IMTBuffer and it returns the expected output.

{
	// Request to API endpoint.
	"url": "/{{parameters.rectype}}/query",                       // Relative to base URL
	"method": "POST",
	"headers": {},                         // Additional HTTP headers
	"qs": {                                // Query string
		"offset": "{{parameters.offset}}"  // Parameter "search" that is defined in Mappable parameters.
	},

	// Response handling
	"response": {
 		"output": "{{item}}",      
		"iterate": "{{body.recs}}",       
		"limit": "{{parameters.limit}}"    // Limits number of output bundles as requested by user (even if API returns more items).
	}
}

Thanks to everyone who tried to help !

2 Likes