ServiceAPI Bulk Loader

The ServiceAPI exposes a bulk loading capabilities for which a C# sample is provided in the help.  This blog post shows the actual JSON that is sent over the wire.

The first step is to create an Origin object in the client, once this is done a batch of Records can be posted to the bulk loader.  The sample below:

  • uses the Origin with Uri 9000000006,
  • does not use background processing (processing is completed within the HTTP post request),
  • creates one Location and one Record,
  • uses the Location created for the Record assignee,
  • assumes that the file "test doc.docx" has already been uploaded (using the UploadFile service), and
  • should be posted to http://MyServer/ServiceAPI/BulkLoader.
{
    "Origin": {
        "Uri":9000000006
    },
    "AutoCommitLocations": true,
    "SQLCheckConstraints": false,
    "SQLServerTableLock": true,
    "UseBulkLoaderRecordNumbering": true,
    "ProcessInBackground":true,
    "LocationsToImport":[{
        "LocationSurname":"Jones", 
        "LocationGivenNames":"Arthur",
        "LocationTypeOfLocation":"Person"
    }],
    "RecordsToImport": [
        {
            "RecordTitle": "My title from BL 5.1 AAAAA",
            "RecordAssignee":{
                "LocationSurname":"Jones", 
                "LocationGivenNames":"Arthur"
            },
            "RecordFilePath":"test doc.docx"
        }
    ]
}

Background processing

If 'ProcessInBackground' is set to true then the ServiceAPI will hand the bulk loading request off to the TRIMServiceAPIBulkLoader service (installed as a windows service).  In this case the bulk loading request will immediately return an OriginHistory object.  The Uri from this object can be used to poll the OriginHistory object to find out when the bulk loading operation has completed.  The Url to fetch the OriginHistory will look like this:

http://localhost/ServiceAPI/OriginHistory?q=uri:9000000019&properties=BulkLoaderIsRunning,OriginHistoryRecordsCreated

Demo

In the video below I demonstrate bulk loading one Record using background processing.