Classify
The following APIs are exposed for the Classification Service.
- Text
- Tabular
- JSON
- XML
Classify Text
This API endpoint classifies plain text unstructured data.
POST http://<Host Address>/pty/discover/v2/classify/text
- Content type must be a plain text and in an UTF-8 format.
Important:
- Length of the body is limited to 10 KB. If the body exceeds this limit, it is recommended to use the File Classification Text API. For more information about this File Classification, refer to the File Classification API.
- Non-Latin text is not supported. If the input contains a non-Latin text, the text is rejected with a
422error code.
Query Parameters
score_threshold
- Type:
float - Description: Optional. Exclude results with a score lower than this threshold.
- Values: Minimum 0, Maximum 1.0
- Default:
0.7
Sample Request
curl -X POST "http://<Host_address>/pty/data-discovery/v2/classify/text?score_threshold=0.85" \
-H "Content-Type: text/plain" \
--data "You can reach Dave Elliot by phone 203-555-1286"import requests
url = "http://<Host_address>/pty/data-discovery/v2/classify/text"
params = {"score_threshold": 0.85}
headers = {"Content-Type": "text/plain"}
data = "You can reach Dave Elliot by phone 203-555-1286"
response = requests.post(url, params=params, headers=headers, data=data, verify=False)
print("Status code:", response.status_code)
print("Response JSON:", response.json())URL: POST `http://<Host_address>/pty/data-discovery/v2/classify/text`
Query Parameters:
-score_threshold (optional), float between 0.0 and 1.0, default: 0.7
Headers:
-Content-Type: text/plain
Body:
-You can reach Dave Elliot by phone 203-555-1286Classify Tabular Data
This API endpoint classifies structured Tabular data.
POST http://<Host Address>/pty/discover/v2/classify/tabular
- Content type must be
text/csvand UTF-8 encoded.
Query Parameters
score_threshold
- Type:
float - Description: Optional. Exclude results with a score lower than this threshold.
- Values: Minimum 0, Maximum 1.0
- Default:
0.7
has_headers
- Type:
boolean - Description: Optional. Indicates whether the first row represents the column header.
- Values:
true/false - Default:
true
column_delimiter
- Type:
char - Description: Optional. Delimiter to separate the columns.
- Default:
,
quote_char
- Type:
char - Description: Optional. Character to quote fields containing special characters, such as, the column_delimiter or new-line characters.
- Default:
"
Body
Content type should be
text/csvand in UTF-8 format.Body size is limited to 10K Bytes
Sample Request
curl -X POST "http://<Host_address>/pty/data-discovery/v2/classify/tabular?score_threshold=0.85" \
--header 'Content-Type: text/csv' \
--data-raw 'Social Security Number,Credit Card Number,IBAN,Phone Number
589-25-1068,349384370543801,FR43 9255 4858 47BG 3EBG U4OK O18,(483) 9440301
636-36-3077,4041594844904,AL50 8947 4215 KAEY GAPM NLYC FNZG,(113) 5143119
748-82-2375,3558175715821800,AT34 4082 9269 0841 5702,(763) 5136237
516-62-9861,560221027976015000,FR22 0068 7181 11FB UG8H ECEM 306,(726) 6031636
121-49-9409,374283320982549,DK37 5687 8459 8060 79,(624) 9205200
838-73-3299,5558216060144900,CR54 8952 8144 6403 4765 0,(356) 9479541
439-11-5310,5048376143641900,RS76 6213 4824 0184 8983 74,(544) 5623326
564-06-8466,3543299511845640,EE51 6882 3443 7863 4703,(702) 6093849
518-54-5443,3543019452249540,IT65 D000 3874 2801 Z15I LNLL OOX,(584) 8618371'import requests
url = "http://<Host_address>/pty/data-discovery/v2/classify/tabular"
params = {"score_threshold": 0.85}
headers = {"Content-Type": "text/csv"}
data = """Social Security Number,Credit Card Number,IBAN,Phone Number
589-25-1068,349384370543801,FR43 9255 4858 47BG 3EBG U4OK O18,(483) 9440301
636-36-3077,4041594844904,AL50 8947 4215 KAEY GAPM NLYC FNZG,(113) 5143119
748-82-2375,3558175715821800,AT34 4082 9269 0841 5702,(763) 5136237
516-62-9861,560221027976015000,FR22 0068 7181 11FB UG8H ECEM 306,(726) 6031636
121-49-9409,374283320982549,DK37 5687 8459 8060 79,(624) 9205200
838-73-3299,5558216060144900,CR54 8952 8144 6403 4765 0,(356) 9479541
439-11-5310,5048376143641900,RS76 6213 4824 0184 8983 74,(544) 5623326
564-06-8466,3543299511845640,EE51 6882 3443 7863 4703,(702) 6093849
518-54-5443,3543019452249540,IT65 D000 3874 2801 Z15I LNLL OOX,(584) 8618371
"""
response = requests.post(url, params=params, headers=headers, data=data, verify=False)
print("Status code:", response.status_code)
try:
print("Response JSON:", response.json())
except ValueError:
print("Response Text:", response.text)
URL: POST `http://<Host_address>/pty/data-discovery/v2/classify/tabular`
Query Parameters:
-score_threshold (optional), float between 0.0 and 1.0, default: 0.
-has_headers (optional), Indicates whether the first row represents the column header.
-column_delimiter (optional), Delimiter to separate the columns.
-quote_char (optional), Character to quote fields containing special characters, such as, the column_delimiter or new-line characters.
Headers:
-Content-Type: text/csv
Body:
-Social Security Number,Credit Card Number,IBAN,Phone Number
589-25-1068,349384370543801,FR43 9255 4858 47BG 3EBG U4OK O18,(483) 9440301
636-36-3077,4041594844904,AL50 8947 4215 KAEY GAPM NLYC FNZG,(113) 5143119
748-82-2375,3558175715821800,AT34 4082 9269 0841 5702,(763) 5136237
516-62-9861,560221027976015000,FR22 0068 7181 11FB UG8H ECEM 306,(726) 6031636
121-49-9409,374283320982549,DK37 5687 8459 8060 79,(624) 9205200
838-73-3299,5558216060144900,CR54 8952 8144 6403 4765 0,(356) 9479541
439-11-5310,5048376143641900,RS76 6213 4824 0184 8983 74,(544) 5623326
564-06-8466,3543299511845640,EE51 6882 3443 7863 4703,(702) 6093849
518-54-5443,3543019452249540,IT65 D000 3874 2801 Z15I LNLL OOX,(584) 8618371
Classify JSON Data
This API endpoint classifies structured JSON data.
POST http://<Host Address>/pty/discover/v2/classify/json
Query Parameters
score_threshold
- Type:
float - Description: Optional. Exclude results with a score lower than this threshold.
- Values: Minimum 0, Maximum 1.0
- Default:
0.7
Body
Content type must be
application/jsonand encoded in UTF-8 format.Length of the body is limited to 10K Bytes.
Sample Request
curl --location '<Host_address>/pty/data-discovery/v2/classify/json' \
--header 'Content-Type: application/json' \
--data '{
"address": "64.219.62.68"
}'import requests
import json
url = "http://<Host_address>/pty/data-discovery/v2/classify/json"
params = {"score_threshold": 0.85}
headers = {"Content-Type": "application/json"}
data = json.dumps({
"address": "64.219.62.68"
})
response = requests.post(url, params=params, headers=headers, data=data, verify=False)
print("Status code:", response.status_code)
try:
print("Response JSON:", response.json())
except ValueError:
print("Response Text:", response.text)
URL: POST `http://<Host_address>/pty/data-discovery/v2/classify/json`
Query Parameters:
-score_threshold (optional), float between 0.0 and 1.0, default: 0.7
Headers:
-Content-Type: application/json
Body:
-{"address": "64.219.62.68"}Classify XML Data
This API endpoint classifies structured XML data.
POST https://<Host Address>/pty/data-discovery/v2/classify/xml
Query Parameters
score_threshold
- Type:
float - Description: Optional. Exclude results with a score lower than this threshold.
- Values: Minimum 0, Maximum 1.0
- Default:
0.7
Body
Content type must be
application/xmland encoded in UTF-8 format.Length of the body is limited to 10K Bytes.
Sample Request
curl --location '<Host_address>/pty/data-discovery/v2/classify/xml' \
--header 'Content-Type: application/xml' \
--data '<address>64.219.62.68</address>'import requests
url = "http://<Host_address>/pty/data-discovery/v2/classify/xml"
params = {"score_threshold": 0.85}
headers = {"Content-Type": "application/xml"}
data = "<address>64.219.62.68</address>"
response = requests.post(url, params=params, headers=headers, data=data, verify=False)
print("Status code:", response.status_code)
try:
print("Response JSON:", response.json())
except ValueError:
print("Error", response.text)
URL: POST `http://<Host_address>/pty/data-discovery/v2/classify/xml`
Query Parameters:
-score_threshold (optional), float between 0.0 and 1.0, default: 0.7
Headers:
-Content-Type: application/xml
Body:
-<address>64.219.62.68</address>Feedback
Was this page helpful?