Skip to content

Latest commit

 

History

History
168 lines (130 loc) · 6.62 KB

File metadata and controls

168 lines (130 loc) · 6.62 KB

RedactionApi

All URIs are relative to http://localhost

Method HTTP request Description
getRedactedText POST /redact Get Redacted Text
getRedactedTextWithEncryption POST /redact_with_encryption Get Redacted Text With Encryption

getRedactedText

Object getRedactedText(body, conceptsToKeep, warnOnNoRedaction, mask, hash)

Get Redacted Text

Extract and redact NER entities from a single piece of plain text

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.RedactionApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    RedactionApi apiInstance = new RedactionApi(defaultClient);
    String body = "body_example"; // String | 
    List<String> conceptsToKeep = Arrays.asList(); // List<String> | List of concepts (Label IDs) that should not be removedd during the redaction process. List should be in the format ['label1','label2'...]
    Boolean warnOnNoRedaction = true; // Boolean | Return warning when no entities were detected for redaction to prevent potential info leaking
    String mask = "mask_example"; // String | The custom symbols used for masking detected spans
    Boolean hash = true; // Boolean | Whether or not to hash detected spans
    try {
      Object result = apiInstance.getRedactedText(body, conceptsToKeep, warnOnNoRedaction, mask, hash);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RedactionApi#getRedactedText");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
body String
conceptsToKeep List<String> List of concepts (Label IDs) that should not be removedd during the redaction process. List should be in the format ['label1','label2'...] [optional]
warnOnNoRedaction Boolean Return warning when no entities were detected for redaction to prevent potential info leaking [optional]
mask String The custom symbols used for masking detected spans [optional]
hash Boolean Whether or not to hash detected spans [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: text/plain
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

getRedactedTextWithEncryption

Object getRedactedTextWithEncryption(textWithPublicKey, warnOnNoRedaction)

Get Redacted Text With Encryption

Redact and encrypt NER entities from a single piece of plain text

Example

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.RedactionApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    RedactionApi apiInstance = new RedactionApi(defaultClient);
    TextWithPublicKey textWithPublicKey = new TextWithPublicKey(); // TextWithPublicKey | 
    Boolean warnOnNoRedaction = true; // Boolean | Return warning when no entities were detected for redaction to prevent potential info leaking
    try {
      Object result = apiInstance.getRedactedTextWithEncryption(textWithPublicKey, warnOnNoRedaction);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling RedactionApi#getRedactedTextWithEncryption");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
textWithPublicKey TextWithPublicKey
warnOnNoRedaction Boolean Return warning when no entities were detected for redaction to prevent potential info leaking [optional]

Return type

Object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -