Mock response template for arrays

Hello. I am setting up responses for my mock server. My request body is an array of JSON objects. I want to use the value of report_request_id in my mock response.

Here is a simplified version of my request body:

[
    {
        "report_id": "{{id_report}}",
        "startDate": "{{date_start}}",
        "endDate": "{{date_end}}",        
        "session_filter": true,
        "report_request_id": {{id_report_request}}
    }
]

I have tried several variations and have reviewed the documentation for object-path. The mock always returns the default. Here is one of the variations I’ve tried:

{
    "result": [
        {
            "success": false,
            "data": {
                "report_request_id": "{{$body '[0].report_request_id' '5556'}}",
                "reportRunId": 1838018,
                "message": "Report failed."
            }
        }
    ]
}

Any help would be appreciated.

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