OCR API
OCR API documentation for .NET SDK
The default url is http://localhost:8080
| Method | HTTP request | Description |
|---|---|---|
| OcrDocument | POST /v1/ocr:document | Run OCR on a document or image |
OcrDocument
OcrDocumentResponse OcrDocument (OcrDocumentRequest ocrDocumentRequest)
Run OCR on a document or image
Runs layout-aware OCR on the provided document bytes and returns per-page results. When a page range is provided, only the inclusive subset is processed. Requires OCR_DOCUMENT permission.
Example
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Pairsystems.Goodmem.Client.Api;
using Pairsystems.Goodmem.Client.Client;
using Pairsystems.Goodmem.Client.Model;
namespace Example
{
public class OcrDocumentExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "[http://localhost";](http://localhost";)
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new OCRApi(httpClient, config, httpClientHandler);
var ocrDocumentRequest = new OcrDocumentRequest(); // OcrDocumentRequest | OCR request payload
try
{
// Run OCR on a document or image
OcrDocumentResponse result = apiInstance.OcrDocument(ocrDocumentRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OCRApi.OcrDocument: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}Using the OcrDocumentWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Run OCR on a document or image
`ApiResponse<OcrDocumentResponse>` response = apiInstance.OcrDocumentWithHttpInfo(ocrDocumentRequest);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling OCRApi.OcrDocumentWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| ocrDocumentRequest | OcrDocumentRequest | OCR request payload |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OCR results by page | - |
| 400 | Invalid request or unsupported input | - |
| 401 | Unauthorized | - |
| 403 | Forbidden | - |
| 429 | Rate limit exceeded | - |
| 500 | Internal server error | - |