2

My issue is that I want to give my response file names a more meaningful name but to do this I need to be able to match on any text following the id. Here is my current mapping:

{
  "priority": 10,
  "request": {
    "urlPattern": "/api/v1/customer\\?Id=(.*)&IdType=(.*)&AdditionalInformation=(.*)",
    "method": "GET"
  },
  "response": {
    "transformers": [
      "dynamic-mapping-transformer"
    ],
    "status": 200,
    "headers": {
      "Content-Type": "application/json",
      "Correlation-ID": "{{request.headers.Correlation-ID}}"
    },
    "transformerParameters": {
      "bodyFileName": "{{request.query.Id}}",
      "fileDirectory": "getWorkplaceDetails",
      "extension": "json",
      "encodeName": false,
      "caseInsensitive": true
    }
  }
}

And the naming convention for the response files should be something along the lines of "Id_foo_bar" but "foo" and "bar" are not available in the request so there is no way for me to know them before the response is posted. I would like to use a wild card in the bodyFileName value to match on anything after the Id and was wondering if anyone knew a way to do this?

EDIT 1

I forgot to mention that the mapping needs to accept multiple files with different names which is why I am looking to use a wild card instead of a static file name.

  • How about `"bodyFileName": "{{request.query.Id}}_foo_bar"`? – Wojtek Jul 30 '21 at 12:22
  • Hi Wojtek, thanks for your reply I made an edit, forgot to mention that the mapping needs to accept multiple file names therefore setting a static name in the response params wouldn't work for the scenario. – HermanCodes Aug 02 '21 at 08:18

0 Answers0