REST API

About the REST fields

The fields for the REST API service are as seen in the following figure.

REST API Gateway Specific Fields

The following table describes the additional fields for the REST API Gateway service.

FieldSub-FieldDescriptionDefault (if any)Notes
Dynamic Learn Mode Header The header that will be used to send a request to enable the learn mode for a particular URI. 
Dynamic Streaming Configuration* HTTP header that will be used to send a request. 
Streaming Enabling streaming lets you process a payload in smaller chunks that are broken based on delimiters defined and processed as they are chunked. Using streaming, you no longer must wait for the entire payload to process, and then transmitted. The chunk size must be entered in bytes.List of file processing delimiters to process file using streaming.Chunk size - 65536The Text, CSV, and Binary payloads are supported. If you want to use XML/JSON payload with streaming, ensure you use the Text payload for extract rule.
Authentication Cache Timeout Define the amount of time for which the username and password in the REST request is stored in cache.900 seconds
Asynchronous Client Configuration If streaming is enabled and you plan to use an asynchronous HTTP client, then these settings must be configured. The DSG is optimized to handle asynchronous requests.This parameter is applicable only with REST streaming.
 HTTP Async Client EnabledSelect to enable when HTTP asynchronous client will send a request to DSG.FalseThe HTTP Async Client Header Name header must be sent as part of the HTTP request for DSG to understand that the incoming requests are sent from an asynchronous client. If the header is not sent as part of the request, then the DSG assumes that the request is sent from a synchronous client.
This parameter is applicable only with REST streaming.
 HTTP Async Client Header NameProvide the header name that must be set in an HTTP request in the client such that DSG understands that the request is sent from an asynchronous HTTP client. For example, if the header name is set to X-Protegrity-Async-Client in the service, then when a request is sent to the DSG, the header value must be set to either ‘yes’, ’true’, or ‘1’.This parameter is applicable only with REST streaming.
Error Metrics Logging Log the metrics for error, such as total number of errors, error offset, reason for the error, and so on..
 EnabledEnable or disable error metrics to be logged in the log file.
 Log level
  • Warning
  • Information
  • Verbose
Ensure that the log level you select is the same or part of a higher log subset that you defined in the gateway log level.
ErrorSet one HTTP status code for the errors that may occur in the file while processing it. Select from the following HTTP status codes:
  • 200 OK
  • 201 Created
  • 202 Accepted
  • 203 Non-Authoritative Information
  • 205 Reset Content
  • 206 Partial Content
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 422 Unprocessable Entity
  • 500 Internal Server Error
  • 503 Service Unavailable

* -The dynamic streaming configuration can be explained as follows:

If you want to send dynamic requests to enable streaming on a given URI, you can use this field. Consider an example, where you set this value as X-Protegrity-Rest-Header. When you send an HTTP request with the X-Protegrity-Rest-Header header value, DSG will begin the data protection for that URI based on the parameters provided in the request.

A typical format for the value in the header is as follows:

"{"streaming":{"uri":"/echo","delimiter":"(?ms)(^.*\\r?\\n)", "chunk_size": 5000}}"
ParameterDescriptionDefaultNotes
delimiterRegular Expression used to delimit stream. Rules will be invoked on delimited streams.(?ms)(^.*\\r?\\n)If the delimiter value is not matched, then the data will be processed in non-streaming mode.
UriRegular Expression to look for in the payload before applying streaming (e.g. \.csv$). Streaming is applied only to requests where URI matches the regex pattern. 
chunk_sizeSize of the smaller chunks that the data must be broken into. The chunk size must be entered in bytes.65536

Note: The delimiter parameter must be sent as part of the HTTP header information. The uri and chunk_size parameters are optional. If uri is not provided, the request URI is considered, while if the chunk_size is not provided, the chunk size defined in HTTP tunnel configuration is considered.