(844) docmgt1 sales@docmgt.com

docMgt supports a fairly extensive REST interface that allows for interaction with docMgt servers using standard REST calls. This is great but if you are using .NET for your development we have a slightly easier method for you – the docMgt REST Helper [icon name=”external-link-square” class=”” unprefixed_class=”” title=”External Link”].

The docMgt REST Helper is a .NET assembly that performs all the REST magic for you. This allows you to focus on the development of the integration instead of the nuts and bolts of REST interfaces.

resthelper1To get the REST Helper, use the NuGet package manager in Visual Studio. Click Manage NuGet Packages for your project and search for docMgt. You will see the docMgt REST Helper in the list. Click this package and click the Install button to add it to your project.

 

Once you have it installed you can use intellisense to detect the functions available. The main ones are:

  • Login() – Authenticate with the server
  • SaveRecord() – Save a Record to docMgt
  • SearchRecords() – Find Records in docMgt (allows for paging results)
  • SaveDocument() – Save a Document to docMgt
  • RecordRoute() – Perform a workflow route on an existing Record
  • GetDocuments() – Get Documents in Record (allows for paging results)
  • GetDocument() – Gets a specific Document based on its ID
  • DownloadDocument() – Downloads the binary data for a give Document based on its ID

Examples

 

 

Test Login Credentials

Using dmRest As New dmREST.dmRestHelper('http://mytestserver/docmgt', 'admin', 'admin') 
    Try 
        dmRest.Login() 
        Console.WriteLine('Login Worked') 
    Catch ex As Exception 
        Console.WriteLine(ex.Message) 
    End Try 
End Using

 

 

Search for Records with the word “invoice” in any field

Using dmRest As New dmREST.dmRestHelper('http://mytestserver/docmgt', 'admin', 'admin') 
    Dim recs As List(Of dmREST.Record) = dmRest.SearchRecords('invoice') 
    Console.WriteLine('# Records = {0}', dmRest.NumResults.ToString()) 
End Using

* Notice that you do not need to actually log into the server first. The credentials sent in on the USING line will handle that.

 

Save an invoice Document into the Record with ID of 1

Using dmRest As New dmREST.dmRestHelper('http://mytestserver/docmgt', 'admin', 'admin') 
    Dim Document As New dmREST.Document With {.RecordID = 1, .Name = 'Invoice', .FileName = 'Invoice.tif', .DocumentValue = System.IO.File.ReadAllBytes('C:\Testing\Invoice3.tif')}
    Dim D As dmREST.Document = dmRest.SaveDocument(Document) 
    Console.WriteLine('Document ID = {0}', D.ID.ToString()) 
End Using

* Notice that you need to specify a FileName property on documents so the server knows the file type (TIF, PDF, etc.)

 

Get the OCR words for Document with ID 2928, page 1

Using dmRest As New dmREST.dmRestHelper('http://mytestserver/docmgt', 'admin', 'admin') 
    Dim Words As List(Of dmREST.Word) = dmRest.GetWords(2928, 1) 
    For Each Word As dmREST.Word In Words 
        Console.WriteLine('Word = {0}', Word.Word) 
    Next 
End Using

* Note that you do not have to put all your calls into a single USING structure. You can have multiple USINGs and it will not slow performance at all. Each call to the server is authenticated independently regardless.

 

Hopefully this gives you a taste of what you can do with the docMgt REST Helper. If you have any questions feel free to post in the forums!