Clone wiki

Vtiger webservice .net / Home

Using the api from vb.net

Create an instance of the webservice client and log in

Dim ws As New VtigerWebservice.Webservice("http://vtiger-site/webservice.php", "user", "access key")
ws.Login()

How to get the Access Key

Retrieve the names of the modules

Dim types As Dictionary(Of string,
VtigerWebservice.Webservice.ListTypeInfo) = ws.ListTypes()
For Each item As KeyValuePair(Of string, VtigerWebservice.Webservice.ListTypeInfo) In types
    Console.WriteLine(item.Key)
Next

Describe the structure of a module

Dim desc As VtigerWebservice.Webservice.DescribeInfo = ws.Describe("Potentials")
Console.WriteLine(desc.idPrefix)

Retrieve an existing record

Dim obj As Dictionary(Of String, Object) = ws.Retrieve("3x1117246")
For Each item As KeyValuePair(Of String, Object) In obj
    Console.WriteLine(item.Key)
Next
Console.WriteLine(obj.Item("id"))

Update an existing record

Dim obj As Dictionary(Of String, Object) = ws.Retrieve("3x1117246")
For Each item As KeyValuePair(Of String, Object) In obj
    Console.WriteLine(item.Key)
Next
obj.Add("accountname", "New Name")
ws.Update(obj)

Create a new record

Dim newObj As New Dictionary(Of String, Object)
newObj.Add("accountname", "New Account")
newObj.Add("assigned_user_id", ws.UserId)
ws.Create("Accounts", newObj)

Run a query on vtiger

Dim result As  List(Of Dictionary(Of string, object)) =
ws.Query("select * from Accounts;")
For Each item As Dictionary(Of string, object) In result
    Console.WriteLine(item.Item("id"))
Next

Updated