Update Data Masking

Hello,

I triying Data Masking, with this documentation: https://cloud.google.com/apigee/docs/api-platform/security/data-masking

But, when I used “updateMask”, the request is OK, but there is not any update in my data masking. Any suggestion about how I must use “updateMask”?

I sent:

curl “https://apigee.googleapis.com/v1/organizations/gdc-latam-apigee-internal-1/environments/dev/debugmask?updateMask” -X PATCH -H “Authorization: Bearer $TOKEN” -H “Content-type: application/json” -d ‘{
“requestJSONPaths”: [
“$.store.book[].date",
"$.store.book[
].version”
],
“variables”: [
“request.header.via”
],
}’

  • Set the updateMask query parameter to specify a field mask that includes a comma-separated list of fully-qualified names of fields in the debug mask. For example: "requestJSONPaths"

I think maybe you have a stray trailing comma. This works for me.

$ curl "https://apigee.googleapis.com/v1/organizations/$ORG/environments/$ENV/debugmask" \
  -X PATCH -H "Authorization: Bearer $TOKEN" \
  -H "Content-type: application/json" -d '{
     "requestJSONPaths": [
       "$.store.book[*].date",
       "$.store.book[*].version"
     ],
     "variables": [
       "request.header.via"
     ]
}'

Thank you Dino. Without the comma it works. But, my question reffer to parameter “updateMask” in the URL, I’ve used “updateMask=requestJSONPaths”, for example, when I specify requestJSONPaths, only updated this field, and it must to have all fields, ex. “updateMask=requestJSONPaths&updateMask=variables” to update all JSON request.

So, my question is what is the difference to send “updateMask” and not send it.

curl “https://apigee.googleapis.com/v1/organizations/$ORG/environments/$ENV/debugmask?updateMask=requestJSONPaths” -X PATCH -H “Authorization: Bearer $TOKEN” -H “Content-type: application/json” -d ‘{
“requestJSONPaths”: [
“$.store.book[].tittle",
"$.store.book[
].ssb”
],
“variables”: [
“request.header.ip”
]
}’

So, my question is what is the difference to send “updateMask” and not send it.

I think that if you do not include a field in “updateMask” then the field will not be updated. Right? I think that’s how the API is defined. I am assuming that’s how the service endpoint knows how to apply the PATCH request.

1 Like

I suppose that, although if it is not sent, it updates everything without problem. Thank you for your reply.

a Further example for other future readers:

PATCH :apigee/v1/organizations/:org/environments/:env/debugmask
Content-Type: application/json
Authorization: Bearer :token

{
  "namespaces": {
    "myco": "http://example.com"
  },
  "requestXPaths": [
    "/myco:employee/myco:name",
    "/password"
  ],
  "requestJSONPaths": [
    "$.store.book[*].date",
    "$.store.book[*].version",
    "$.password"
  ],
  "variables": [
    "request.header.via",
    "another-variable-name"
  ]
}
1 Like