Data Masking not working with Namespace and prefix

I was testing the Data masking functionality using the prefix and namespace as suggested in APIGEE docs but its not working as expected.

https://docs.apigee.com/api-platform/security/data-masking

There is small correction also required with the closing of XPathsRequest in APIGEE doc.

<Namespaceprefix=“myco”>http://example.com/myco:employee/myco:name

Do you have any more information on how it’s not working? Does your payload use namespaces?

I have used the same Mask configuration and request structure which is present in APIGEE docs for namespace and prefix example - https://docs.apigee.com/api-platform/security/data-masking.

You can use the below mask configuration

http://example.com /myco:employee/myco:name /myco:employee/myco:age

And below request messgae to try

myco:namexyz</myco:name> myco:age50</myco:age> </myco:employee>

There seems to be an issue with your messages coming through? Try highlighting the XML tags and selecting the code option before submitting

<this is an example>
Request Message ------------

<employee xmlns:myco="http://example.com">
    <myco:name>xyz</myco:name>
    <myco:age>50</myco:age>
</myco:employee>

MASK Configuration ------------------

<MaskDataConfiguration>
    <Namespaces>
        <Namespace prefix="myco">http://example.com</Namespace>
    </Namespaces>
    <XPathsRequest>
        <XPathRequest>/myco:employee/myco:name</XPathRequest>
        <XPathRequest>/myco:employee/myco:age</XPathRequest>
    </XPathsRequest>
</MaskDataConfiguration>

Your mask configuration is expecting the employee tag belongs to the myco namespace

Using default namespace as follows, it will be in that namespace

<employee xmlns="http://example.com">
  <name>xyz</name>
  <age>50</age>
</employee>

where as in your payload you need to add the namespace to the employee tag too - the closing tag had it, but it doesn’t match the opening tag.

The Apigee doc example for this should be updated to match as follows

<myco:employee xmlns:myco="http://example.com">
    <myco:name>xyz</myco:name>
    <myco:age>50</myco:age>
</myco:employee>