Click or drag to resize

Change Tracking Search

SDK provides the ability to search for data that has changed recently. Only a few database tables are supported. The supported database tables are Client, ContactName, ClientAgencyBranchJT, EntityEmployeeJT, Policy and Line.
Post /api/change_tracking_search

This method is used to retrieve data changes that occurred for the specified tables and after the specified change tracking date.

Can be accessed via the URI [Your_SDK_Service]/api/change_tracking_search.

Request Parameters

page

  • Type: System.Integer

    The desired page of data changes (Zero indexed).

limit

  • Type: System.Integer

    The desired page size (default and maximum value = 20000).

Request Body

Response

  • Status Code: 200

total_count

  • Type: System.Integer

    The total count of all change tracking data rows returned across all pages.

page_count

  • Type: System.Integer

    The total number of pages of change tracking data rows items retrieved.

page_latest_date

  • Type: System.Date?

    The latest occurring change on the specified page of results.

[Table Objects]

  • Type: List(of Dictionary(Of String, Object))

    Possible objects are Client, ContactName, ClientAgencyBranchJT, EntityEmployeeJT, Policy and Line. There is a returned table object for each table specified in input. The returned table object contains rows of changed data from the corresponding table. The rows are returned in order based on when the change occurred. These are a set of key value pairs that represent the 'sys_change_operation' and the data stored for the row that changed. The 'sys_change_operation' represents the field stored in SQL change tracking. It shows the operation causing the change (I->Insert, U->Update, D->Delete). For more information see SQL CHANGETABLE. The rest of the fields correspond the values in the database. Most of the fields correspond 1 to 1 with the database columns. The exception is the Flags column. This field will instead been replaced with several human readable boolean fields. There is nothing explaining which columns in the row were changed. The user will need to rely on their own system to discover specifically what changed.

Examples

Get Change Tracking.

VB
 1' Dim SDK_SERVICE_URI As New Uri("https://Fully_Qualified_Service_Computer_Name/SDK_Service")
 2' Constant DATABASE preset to current database name
 3' Constant AUTHENTICATION_KEY set to current authentication key
 4
 5'This sample will retrieve the first page (20000 rows) of table data for all table changes that occured in the last 10 minutes for all tables SDK change tracking supports.
 6Try
 7  Dim sChangeTrackingUrl As String = SDK_SERVICE_URI & "/api/change_tracking_search?page=0&limit=20000"
 8
 9  Dim dictGetRequest As New Dictionary(Of String, Object) From {
10          {"change_tracking_date", Date.UtcNow.AddMinutes(-10)},
11          {"tables", {"Policy", "Line", "Client", "ContactName", "ClientAgencyBranchJT", "EntityEmployeeJT"}.ToList}
12        }
13
14  Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer
15  Dim sChangeTrackingGetRequestBody As String = jss.Serialize(dictGetRequest)
16
17  Dim sResponse As String
18  Using oWebclient As New WebClient
19    oWebclient.Encoding = Encoding.UTF8
20    With oWebclient.Headers
21      .Add("AuthenticationKey", AUTHENTICATION_KEY)
22      .Add("DatabaseName", DATABASE)
23      .Add("Content-type", "application/json")
24    End With
25    Dim aResponse As Byte() = oWebclient.UploadData(sChangeTrackingUrl, "POST", Encoding.ASCII.GetBytes(sChangeTrackingGetRequestBody))
26    sResponse = oWebclient.Encoding.GetString(aResponse)
27  End Using
28  Dim dictChangeTrackingResult As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(sResponse)
29  Console.WriteLine("Total Count: " & dictChangeTrackingResult("total_count").ToString)
30  Console.WriteLine("Page Count: " & dictChangeTrackingResult("page_count").ToString)
31
32Catch ex As WebException
33  Dim sStatusCode As String = ex.Status.ToString
34  Dim sError As String = New IO.StreamReader(ex.Response.GetResponseStream).ReadToEnd
35  Console.WriteLine("Status Code: " & sStatusCode & ", Error: " & sError)
36Catch ex As Exception
37  Console.WriteLine(ex.Message)
38End Try
See Also