Knee Deep in CVent API, Logging in

Image representing Cvent as depicted in CrunchBase
Image via CrunchBase

I have to admit, I’ve never worked with an API before, ok I’ve pulled an image from flickr or the twitter feed on the side bar with API but someone else showed me how to do that. For work I had to write vb.net code to work with CVent’s API. So over the next few post, I’ll be adding code that may help others (Since I could find any for the API newbie!), I will also admit that this isn’t the prettiest or even the most logical code but it works for how we’re doing things and will give you a beginning point to work with.
There are many spots in the code that the API uses arrays and as you’ll see I’ve created my loops to add only a single element into the array. I know, I know but when you’re on a tight schedule and you’re just figuring out the API, if something works, you go with it.. and if you use my code and actually change it to work correctly, please send me your examples so I can share with everyone. (richard(@)curbob.com).

Lets start at the beginning.. adding the API to VisualStudio
You have to have an API account with Cvent to even access the API, so untill all contracts are signed, don’t even try. I thought for a day I was doing something wrong.. nope, no access.
To connect VS2005/2008 to CVent API, right click the project in solution explorer and choose “Add Web Reference”. The URL is https://api.cvent.com/soap/V200611.asmx?WSDL. After adding this URL I was bombarded with 4 popup boxes asking about letting this secure page show, click yes on all of them and also unblock the activeX content. Then Click Add Reference.

Private _ws As New com.cvent.api.V200611()

Lets login into CVent API

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Login("account Number", "UserName", "Password") = True Then
            Label1.Text = "Login worked"
        Else
            Label1.Text = "Login failed"
        End If
    End Sub
Public Function Login(ByVal Acct As [String], ByVal userName As [String], ByVal pwd As [String]) As [Boolean]

        Dim loginResult As com.cvent.api.LoginResult = _ws.Login(Acct, userName, pwd)
        _ws.CventSessionHeaderValue = New com.cvent.api.CventSessionHeader()
        _ws.CventSessionHeaderValue.CventSessionValue = loginResult.CventSessionHeader

        Return (loginResult.LoginSuccess)
    End Function

Technorati Tags: , ,

Related Tek-Works Posts:

     

5 Comments to “Knee Deep in CVent API, Logging in”

  1. Juan 21 October 2011 at 11:10 pm #

    Hello,

    I’m investigating a potential integration with the CVent API. I’m having a hard time finding any official documentation. Is it publicly available?

    Cheers,
    Juan

  2. Richard Curry 13 December 2011 at 10:28 am #

    I’ve asked Cvent if there is a link for me to download a current version of the documentation. I’ll report back when I hear from them

  3. nickspiers 11 January 2012 at 8:45 pm #

    I know the article is old, but it looks like the comments are pretty current.
    I found this documentation.
    http://www.mediaworksinc.net/uploads/resources/1-api_version_v200611_phaseii_05042007.pdf

  4. Amit 13 February 2012 at 7:27 am #

    I have also started working on cvent and after looooot of searching i found the link for api = https://api.cvent.com/soap/V200611.ASMX

  5. Richard Curry 14 February 2012 at 2:13 pm #

    That will give you the basic info on the API but since 2007 alot has been added to the API


Leave a Reply