API Getting Started creating Contacts


#1

Hi, I’m new to this type of development. I have been developing in VB6 and vbscript for many years.
Can someone point me in the right direction to get started.
I need to develop an integration between our bespoke ERP system that stores its data in a ms sql database.
I need to update companies and contacts in the CRM. I would also like to access CRM data and update my ERP.

Many thanks
Dave


#2

@david.pearce I would take a read through our API docs that can be found here.

HubSpot also offers Technical Consultants that you can book time with if you need help getting off the ground. If you run into any specific questions this forum will be a great place to start.

https://www.hubspot.com/services/consulting/technical


#3

Thanks for your reply, Does anyone have any examples of using a “WinHttp.WinHttpRequest” object within VB with this API ?


#4

Her is an example using VB6 to create a company.
The code utilises the JSON parser available from : http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html

Const hsURL = "https://api.hubapi.com"
Const hsHPIKEY = "hapikey=????????????????????????"
Global Const hsResultOK = 200

Function hubspotCompanyCreate(oCompany As Object) As integer        
    Dim myURL As String
    Dim postData As String
    Dim winHttpReq As Object
    
    On Error Resume Next
    
    Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    myURL = hsURL + "/companies/v2/companies?" + hsHPIKEY
    
    postData = JSON.toString(oCompany)

    winHttpReq.Open "POST", myURL, False
    winHttpReq.SetRequestHeader "Content-Type", "application/json"
    winHttpReq.Send (postData)

    If winHttpReq.Status <> hsResultOK Then
        MsgBox winHttpReq.responsetext, vbCritical, "hubspotCompanyCreate"
    End If
    
    hubspotCompanyCreate = winHttpReq.Status
    
End Function

#5

@david.pearce Is this a working example in VB6?


#6

Hi pmanca, Yes this works


#7

awesome thanks for coming back and posting the solution


#8

Your welcome. Thanks for your assistance on my other question.