Example API call- Clearbit Discovery API

While our 2-hour webinar went into depth on API calls, I’m cranking example videos demonstrating how easy it is to connect to Webservice APIs.  You can get your own secure token and read-up on the webservice here.

Here is the code I review in the below video

;************************************************************
IniRead, API_Token ,Auth.ini,API, Token
;***********Clearbit API:  docmentation: https://dashboard.clearbit.com/docs*******************
EndPoint:="https://prospector.clearbit.com/v1/people/search" ;streaming so waits for response
;~  QueryString:=QueryString_Builder({"domain":"the-automator.com","limit":"15"})
;~  MsgBox % QueryString
;~  QueryString:=QueryString_Builder({"domain":"ge.com","limit":"15","title":"engineer"})
;~  QueryString:=QueryString_Builder({"domain":"ge.com","limit":"15","titles[]":"software","titles[]":"marketing"})
QueryString:=QueryString_Builder({"domain":"the-automator.com","limit":"1","email":"true"})

;***********API Call *******************
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HTTP.Open("GET",EndPoint . QueryString)
HTTP.SetRequestHeader("Authorization", "Bearer " . API_Token)
HTTP.Send()
Response:=HTTP.ResponseText
SciTE_Output(Response) ;Text,Clear=1,LineBreak=1,Exit=0

;************Query String builders*********
QueryString_Builder(kvp){
for key, value in kvp
  queryString.=((A_Index="1")?(url "?"):("&")) key "=" value
return queryString
}

Video demonstrating example API Call to Clearbit Discovery API

Comments are closed.