Sensitive Data Protection can detect and classify sensitive data within structured content such as CSV. By inspecting or de-identifying as a table, the structure and columns provide Sensitive Data Protection with additional clues that may enable it to provide better results for some use cases.
Inspecting a table
The code samples below demonstrate how to check a table of data for sensitive content. Tables support a variety of types .
C#
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Go
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Java
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Node.js
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
PHP
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
Python
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries .
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .
REST
See the JSON quickstart for more information about using the DLP API with JSON.
JSON Input:
POST
https
:
//
dlp
.
googleapis
.
com
/
v2
/
projects
/[
PROJECT_ID
]/
content
:
inspect
?
key
=
{
YOUR_API_KEY
}
{
"item"
:{
"table"
:{
"headers"
:
[
{"name":"name"}, {"name":"phone"}
]
,
"rows"
:
[
{
"values":[
{"string_value": "John Doe"},
{"string_value": "(206) 555-0123"}
]
}
]
,
}
}
,
"inspectConfig"
:{
"infoTypes"
:
[
{
"name":"PHONE_NUMBER"
}
]
,
"includeQuote"
:
true
}
}
JSON Output:
{
"result": {
"findings": [
{
"quote": "(206) 555-0123",
"infoType": {
"name": "PHONE_NUMBER"
},
"likelihood": "VERY_LIKELY",
"location": {
"byteRange": {
"end": "14"
},
"codepointRange": {
"end": "14"
},
"contentLocations": [
{
"recordLocation": {
"fieldId": {
"name": "phone"
},
"tableLocation": {
}
}
}
]
},
"createTime": "2019-03-08T23:55:10.980Z"
}
]
}
}
Text versus structured text
Structuring text can help provide context. The same request as the one in the previous example, if inspected as a string—that is, as just "John Doe, (206) 555-0123"—would provide less accurate findings. That's because Sensitive Data Protection has fewer contextual clues about what the purpose of the number might be. When possible, consider parsing your strings into a table object for the most accurate scan results.