Skip to content

Instantly share code, notes, and snippets.

@timhall
Created February 13, 2015 01:12
Show Gist options
  • Save timhall/92ee507c1ca0c1dad1d1 to your computer and use it in GitHub Desktop.
Save timhall/92ee507c1ca0c1dad1d1 to your computer and use it in GitHub Desktop.
Crunchbase VBA-Web Example
Private Const UserKey As String = "YOUR-USER-KEY"
Private pClient As WebClient
Public Property Get Client() As WebClient
If pClient Is Nothing Then
Set pClient = New WebClient
pClient.BaseUrl = "https://api.crunchbase.com/v/2/"
End If
Set Client = pClient
End Property
Sub Test()
WebHelpers.EnableLogging = True
Dim Response As WebResponse
Set Response = Crunchbase.GetOrganizations(Query:="Trello")
Debug.Print Response.StatusCode & ": " & Response.Content
Set Response = Crunchbase.GetIpo("a3bc391490d52ba8529d1cfc20550a87")
Debug.Print Response.StatusCode & ": " & Response.Content
End Sub
Public Function GetOrganizations(Optional Name As String, Optional Query As String) As WebResponse
Dim Request As New WebRequest
Request.Resource = "organizations"
Request.AddQuerystringParam "user_key", UserKey
If Name <> "" Then
Request.AddQuerystringParam "name", OrganizationName
End If
If Query <> "" Then
Request.AddQuerystringParam "query", Query
End If
Set GetOrganizations = Client.Execute(Request)
End Function
Public Function GetIpo(Uuid As String) As WebResponse
Dim Request As New WebRequest
Request.Resource = "ipo/{uuid}"
Request.AddQuerystringParam "user_key", UserKey
Request.AddUrlSegment "uuid", Uuid
Set GetIpo = Client.Execute(Request)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment