Third Party Application

You can use the RESTful API provided by your Iron Speed Designer generated Provider in any other application created without help of Designer. In order to do so we have created a class called “JSONDataSouce” which can be used to send a request to the Provider generated using Iron Speed Designer.

Configure web.config for your application

RestfulEnabled – True

RestfulHost – Provider URL

 RestfulEnforcePublicPrivateKey – True/ False (Based on Restful Provider settings)

RestfulEnforceEncryption – True/False (Based on Restful Provider settings)

RestfulPublicKey and RestfulPrivateKey – Generate keys using Provider’s KeyGenerater.aspx

Add BaseClasses.dll reference to your application

Please note that only the .NET 4.5 framework is supported. So navigate to Iron Speed Designer installation folder and copy BaseClasses.dll file from the \BaseClasses\Bin\vs2013 or vs2012 based on which visual studio you are using.

Use classes and properties as described below

Reading Records

            Dim jt As JSONTable = New JSONTable()

            jt.PageSize = 8

            jt.PageIndex = 1

            jt.TotalRows = 16

            jt.TableName = "Categories"

            jt.JSelectColumns = New List(Of JTableSelectColumn)()

            Dim jts As JTableSelectColumn = New JTableSelectColumn()

            jts.ColumnName = "CategoryID"


            Dim jts1 As JTableSelectColumn = New JTableSelectColumn()

            jts1.ColumnName = "CategoryName"


            jt.JOrderByList = New List(Of JOrderBy)()

            Dim jo As JOrderBy = New JOrderBy()

            jo.ColumnName = "CategoryName"

            jo.OrderDirection = "Desc"


            Dim data As String = jt.PostRequest("PostGetRecordListForTable", "CommonRestful")

Once you have the record, you have to parse through it. Here we have a Product class which is used for creating a list of records

            Dim productsList As New List(Of Products)

            Dim results As JArray = JArray.Parse(CStr(JsonConvert.DeserializeObject(data)))

            If results.Count <> 0 Then

                For i As Integer = 0 To results.Count - 1

                    Dim recVals As List(Of JToken) = results(i).Children().ToList()

                    Dim prod As Products = New Products()

                    prod.ProductName = recVals(0)

                    prod.ProductID = recVals(1)



            End If

Get Record Count

            Dim jtForCount As JSONTable = New JSONTable()

            jtForCount.TableName = "Products"

            jtForCount.JWhereClause = "CategoryID=" & DropDownList1.SelectedValue

            jtForCount.JOrderByList = New List(Of JOrderBy)()

            Dim joForCount As JOrderBy = New JOrderBy()

            joForCount.ColumnName = "ProductName"

            joForCount.OrderDirection = "Desc"


            jtForCount.JGroupByList = New List(Of JTableGroupBy)()

            Dim jgForCount As JTableGroupBy = New JTableGroupBy()

            jgForCount.ColumnName = "ProductName"


            Dim dataForCount As String = jtForCount.PostRequest("PostGetCountForTable", "CommonRestful")

Delete Record

            Dim jr As JSONRecord = New JSONRecord()

            jr.TableName = "Products"

            jr.JRecordValues = New List(Of JRecordValue)()

            Dim jRV As New JRecordValue()

            jRV.ColumnName = "ProductID"

            jRV.ColumnValue = "1"


            Dim id As String = jr.PostRequest("PostDeleteForRecord", "CommonRestful")

Edit Record

            Dim jr As JSONRecord = New JSONRecord()

            jr.TableName = "Products"

            Dim row As GridViewRow = GridProduct.Rows(e.RowIndex)

            Dim uiPN As TextBox = row.FindControl("txtProductName")

            jr.JRecordValues = New List(Of JRecordValue)()

            Dim jRV As New JRecordValue()

            jRV.ColumnName = "ProductID"

            jRV.ColumnValue = <UIControlName>.Value


            jRV = New JRecordValue()

            jRV.ColumnName = "ProductName"

            jRV.ColumnValue = <UIControlName>.Text


            jr.IsExistsInDatabase = True

            Dim id As String = jr.PostRequest("PostEditForRecord", "CommonRestful")

See Also

Creating RESTful Applications



Third Party Application

Implementation Details