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"})

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

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

Video demonstrating example API Call to Clearbit Discovery API

Example API call- FullContact API

Example API CallIn this example I create an example API Call to Fullcontact API.   Hopefully y’all caught our webinar on Webservice APIs which goes very deep into API calls.

Here is the code I review in the video

IniRead, API_Key   ,Auth.ini,API, Key
;~  https://portal.fullcontact.com/
;************Company Lookup************************************************
;~  EndPoint:="https://api.fullcontact.com/v2/company/lookup.xml"
;~  QueryString:=QueryString_Builder({"domain":"the-automator.com","keyPeople":"true"})
;~  MsgBox % QueryString

;***********Person Lookup*******************
;~  QueryString:=QueryString_Builder({"email":"[email protected]"})
;~  QueryString:=QueryString_Builder({"email":"[email protected]"})

;***********API Call*******************
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HTTP.Open("GET",EndPoint . QueryString)
HTTP.SetRequestHeader("X-FullContact-APIKey", API_Key)
Response:= HTTP.ResponseText
SciTE_Output(Response) ;Text,Clear=1,LineBreak=1,Exit=0

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

Video demonstrating Example API Call to FullContact

AutoHotkey Webinar- Intro to API calls with AutoHotkey

Intro to API calls with AutoHotkeyIn this AutoHotkey Webinar we cover an Intro to API calls with AutoHotkey.

Video Hour 1: High-level:

  • What is a Webservice API call
  • Web Scraping vs. WebServices / API
  • List of some “fun” WebService / APIs as well as links to resources to tens-of-thousands!
  • Differences between a Get vs. Post request
  • High-level look at oAuth1 vs. oAuth2
  • Resources
    • HTTP: Intro to HyperText Protocol, Types of Requests, oAuth, Parsing XML, XPath, JSON
    • AutoHotkey resource: Syntax writer, winHTTPrequest, Msxml2 vs. WinHTTPrequest, Parsing XML & JSON
  • Basic examples of API requests (compared using browser and winHTTP request)

Video Hour 2: Coding and Q&A

  • Played with several APIs
  • Discussed & demonstrated reverse-engineering API calls from a website
  • Passing key-value pairs (and using a function to keep it organized)
  • Reviewed additional APIs
  • Q&A

Script Highlight: Select text and “pretty” hyperlink text

The below script demonstrates how you can use AHK to automate highlighting text on a page and then, using the winClip library, constructing a “pretty” html link.  Here are links to the GetActiveBrowserURL and WinClipAPI / WinClip

Intro to API calls with AutoHotkey

What is a Webservice API? (Application Programming Interface?)

API calls with AutoHotkey

Examples of Webservice / API calls with AutoHotkey

  • Application / Software querying products for sale on Amazon.com
  • App on your phone getting latest Weather
  • Database pulling updated sales report
  • Using your Tablet to Select movies to watch on Netflix
  • DropBox application syncing files between your computer & cloud
  • Google places search

APIs are becoming increasingly available!

…Since 2005, we’ve seen APIs grow from a curiosity, to a trend, and now to the point where APIs are core to many businesses. APIs have provided tremendous value to countless organizations and developers, which is reflected in their continued growth.   Source: Programmable Web

API calls with AutoHotkey



Main Differences between WebService / API call & Web Browser

API calls with AutoHotkey

When to use API verse Web Scraping?

API calls with AutoHotkey

Some Webservices / APIs

Some of the Amazing APIs out there…

Programmable Web – list of thousands of APIs as well as a great, six-part, article reviewing APIs

Short-list of APIs open to public on Wikipedia,   Google APIs– Over 100 APIs @ Google; Yahoo APIs

Social Sites : Twitter, Pinterest, Google+, YouTube, Facebook, LinkedIn, reddit, StumbleUpon, WordPress, Instagram

Contact / Business Lookup: ClearBit, Pipl, FullContact, Dunn & Bradstreet , Foursquare, Google Places, Yelp, GeoNames

Weather: Weather Underground, Yahoo Weather, World Air

Finance: Google Finance, Yahoo Finance, PayPal, Stripe, XigniteRealTime, Ally Invest

Government: A bunch of Government APIs, Cloud.Gov, US Census, 18F.gsa.gov

Additional: Wikipedia, Amazon Product, email to text, SmartSheet,SurveyGizmo, Bitly, SnapOCR, PasteBin, DropBox, Zoho, Zillow, imugr, Mailgun, MailChimp,  Microsoft: Graph, MS Office: Excel  Word  SharePoint  OneNote Outlook Yammer PowerPoint

Break-down of a REST API request via COM object

  • Create COM object
  • Open Endpoint (w/ parameters & Authentication if GET request)
  • Set RequestHeader(s)
  • Send (w/”payload & Authentication” for POST requests)
  • Get response (body or text)

Main differences of oAuth1 verse oAuth2

Unfortunately there is no “standard” implementation of oAuth1 or oAuth2 however, at a high-level, here are some of the main conceptual differences:


  • Need a Key & Token from Webservice API (typically different than your username and password)
  • You use your Key & Token in your API call
  • oAuth1 is less secure and, generally, being phased out
  • While being phased out often the “developers” (us) can use oAuth1 for development of the “app”


  • Need a Key and Token (same as oAuth1) however you use the Key & Token and some other parameters to perform a “handshake” which returns a secure token which typically times-out in seconds / minutes/hours
  • Your token is restricted to the level of your account (or what has been authorized)
  • The secure token is what is shared with your actual endpoint. (this allows other Social sites (like LinkedIn, Facebook, etc.) to assist your login but not have your username/password to the endpoint

HTTP and AutoHotkey Resources

HTTP Protocol & General Tutorials

API calls with AutoHotkeyAutoHotkey specific

Let’s make some API calls with AutoHotkey!

Weather Underground

  1. Dallas forecast in XML
  2. Dallas forecast in JSON
  3. Using WinHttpRequest
  4. Example with browser

Yahoo business

  1. Pizza restaurants in zip code 75019 in XML
  2. Pizza restaurants in zip code 75019 in JSON
  3. Using WinHTTPRequest

Intro to API calls with AutoHotkey