Legacy Dev Forum Posts

 View Only

Sign Up

When too many results are returned, data action fails to provide response

  • 1.  When too many results are returned, data action fails to provide response

    Posted 06-05-2025 18:43

    somik.mukherjee | 2021-10-15 11:31:11 UTC | #1

    The GET API is returning below response:

    [ { "contractAssetId": 1018209, "contractId": 28175, "assetId": 370, "assetName": "Central Vacuum System", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "963", "brandCode": "UNK", "deductible": 75.0 }, { "contractAssetId": 1017971, "contractId": 28175, "assetId": 39, "assetName": "Microwave Oven (Built-In)", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "211", "brandCode": "UNK", "deductible": 75.0 }, { "contractAssetId": 1018243, "contractId": 28175, "assetId": 371, "assetName": "Hot Water Dispenser", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "MHWD", "brandCode": "UNK", "deductible": 75.0 }, { "contractAssetId": 1017801, "contractId": 28175, "assetId": 29, "assetName": "Dishwasher", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "207", "brandCode": "UNK", "deductible": 75.0 }, { "contractAssetId": 1018277, "contractId": 28175, "assetId": 373, "assetName": "Trash Compactor (Built-In)", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "04881", "brandCode": "UNK", "deductible": 75.0 }, { "contractAssetId": 1023186, "contractId": 28175, "assetId": 47, "assetName": "Dryer", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "204", "brandCode": "UNK", "deductible": 75.00 }, { "contractAssetId": 1023199, "contractId": 28175, "assetId": 48, "assetName": "Washer", "assetDisplayCategory": "Appliances", "modelNumber": null, "serialNumber": null, "assetPurchaseDate": null, "assetPurchasePrice": null, "productCode": "205", "brandCode": "UNK", "deductible": 75.00 }, { "contractAssetId": 1023150, "contractId": 28175, "assetId": 44, "assetName": "Refrigerator INC ICEMAKER", "assetDisplayCategory": "Appliances", "modelNumber": "ED5GVEXVD05", "serialNumber": "503822075", "assetPurchaseDate": "2011-04-15T00:00:00", "assetPurchasePrice": null, "productCode": "04727", "brandCode": "05421", "deductible": 75.00 } ]

    Data action name: Warranty VA 2 : GetContractAssetSummaryByContractNumberAndAssetCategory

    We have a roadblock with API implementation where we are getting the API is returning too many results. Due to this, the result is not being generated in Genesys cloud. We need to ensure that we get list of parameters within each object as a result from the API.

    We need to get the assetname and corresponding deductible amount for example for each of the given object. We have tried multiple translation map but they don't work:

    { "translationMap": { "contractAssetId": "$.ContractOp[0].ContractObj.contractAssetId" }, "translationMapDefaults": {"contractAssetId": "\"UNKNOWN\""}, "successTemplate": "{\n \"contractAssetId\": {contractAssetId}\n}" }

    Error: "message": "Transform failed to process result using 'successTemplate' template due to error:'Unexpected character ('c' (code 99)): was expecting double-quote to start field name\n at [Source: (String)\"{\n \"contractAssetId\": {contractAssetId}\n}\"; line: 2, column: 23]'\n Template:'{\n \"contractAssetId\": {contractAssetId}\n}'."


    Richard.Schott | 2021-10-12 16:59:14 UTC | #2

    Looking at your response configuration, there are a couple of things that I see. First, you didn't escape the quotes for the translation map defaults. Second, the syntax for referencing the translation map in the success template isn't correct.

    Also, based on the API response you posted, I don't think the translation map is correct. I've updated the example below to assume their is no label on the root array, but is still taking the first entry.

    It should look more like:

    { "translationMap": { "contractAssetId": "$[0].contractAssetId" }, "translationMapDefaults": {"contractAssetId": "\"UNKNOWN\""}, "successTemplate": "{\n "contractAssetId": ${contractAssetId}\n}" }

    I'd certainly recommend reviewing the documentation here: https://help.mypurecloud.com/articles/response-configuration-data-actions/

    Also, using a JSON path tool to double check translation maps is handy. I personally use: https://jsonpath.herokuapp.com/

    If you're needing contractAssetId to be an array containing all the contract asset IDs, you might try $..contractAssetId as your JSONPath.


    system | 2021-11-12 17:00:11 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 12320