apiconnectapic

Using Redact Policy in API Connect 2018


I have the below message from where I want to remove the field "Status Code"

{
    "Details": {
        "UT_LL": 22235,
        "UT_ZZ": 512,
        "Status Code": 206,
        "UT_DATE": "2019-10-02-11.36.16.353965",
        "UT_TOTAL_REC": 132
    }
}

Appreciate your help as I am new to API connect. Also kindly note that I have already went through IBM portal and Knowledge center for the same use case..But none of those options work.


Solution

  • Not sure if you already solved, as it has been some time since this post. But nevertheless the solution for the wider community.

    I was using API Connect 2018.4.1.9 (but should work same with earlier versions too) and was using DataPower API Gateway Service

    1] I created a mock endpoint to respond with the above JSON data

    2] Response w/o redact policy

    {
        "Details": {
            "UT_LL": 22235,
            "UT_ZZ": 512,
            "Status Code": 206,
            "UT_DATE": "2019-10-02-11.36.16.353965",
            "UT_TOTAL_REC": 132
        }
    }
    

    3] Response with redact policy. As you could see the Status Code field is removed (redacted), you could choose

    {
      "Details": {
        "UT_LL": 22235,
        "UT_ZZ": 512,    
        "UT_DATE": "2019-10-02-11.36.16.353965",
        "UT_TOTAL_REC": 132
      }
    }
    

    API Yaml file i used.

    https://github.com/pramodvallanur/samples/blob/master/redact-sample.yaml