DocRaptor.Api.DocApi.CreateAsyncDoc C# (CSharp) Method

CreateAsyncDoc() public method

Creates a document asynchronously. You must use a callback url or the the returned status id and the status api to find out when it completes. Then use the download api to get the document.
Thrown when fails to make API call
public CreateAsyncDoc ( Doc doc ) : AsyncDoc
doc Doc The document to be created.
return AsyncDoc
        public AsyncDoc CreateAsyncDoc (Doc doc)
        {
             ApiResponse<AsyncDoc> localVarResponse = CreateAsyncDocWithHttpInfo(doc);
             return localVarResponse.Data;
        }

Usage Example

    static void Main(string[] args)
    {
        Configuration.Default.Username = "******";
        // Configuration.Default.Debug = true; // Not supported in Csharp
        DocApi docraptor = new DocApi();

        Doc doc = new Doc(
          Name: new String('s', 201), // limit is 200 characters
          Test: true,
          DocumentContent: "<html><body>Hello from C#</body></html>",
          DocumentType: Doc.DocumentTypeEnum.Pdf
        );

        AsyncDoc response = docraptor.CreateAsyncDoc(doc);

        AsyncDocStatus status_response;
        for(int i=0; i<30; i++) {
          status_response = docraptor.GetAsyncDocStatus(response.StatusId);
          if (status_response.Status == "failed") {
        Environment.Exit(0);
          }
          Thread.Sleep(1000);
        }
        Console.WriteLine("Did not receive failed validation within 30 seconds.");
        Environment.Exit(1);
    }
All Usage Examples Of DocRaptor.Api.DocApi::CreateAsyncDoc