C#
Documentation for the Document AI API C# SDK
SDK Installation
NuGet
To add the NuGet package to a .NET project:
Locally
To add a reference to a local instance of the SDK in a .NET project:
SDK Example Usage
Example
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
ApiKeyAuth | http | HTTP Bearer |
To authenticate with the API the ApiKeyAuth
parameter must be set when initializing the SDK client instance. For example:
Available Resources and Operations
The available API operations and SDK implementation examples can be found within our API Reference documentation
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is null
, then there are no more pages to be fetched.
Here’s an example of one such pagination call:
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a ABBYY.DocumentAI.Schemas.Errors.APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message | string | The error message |
Request | HttpRequestMessage | The HTTP request |
Response | HttpResponseMessage | The HTTP response |
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the ListAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
ABBYY.DocumentAI.Schemas.Errors.BadRequestError | 400 | application/json |
ABBYY.DocumentAI.Schemas.Errors.UnauthorizedError | 401 | application/json |
ABBYY.DocumentAI.Schemas.Errors.TooManyRequestsError | 429 | application/json |
ABBYY.DocumentAI.Schemas.Errors.InternalServerError | 500 | application/json |
ABBYY.DocumentAI.Schemas.Errors.APIException | 4XX, 5XX | */* |