PowerShell : Bing Powered Auto-Complete

Hello Readers,

In Today’s Blog post we’ll  talk about the Bing API and how Bing Search Auto complete data can be fetched using PowerShell.


I was playing around with Web Debugger Tool (Fiddler) and while doing a Bing search I noticed my Browser making HTTP request to Bing API URL.
Well API’s are always fun, so why not try and explore it with PowerShell 😉



Before we proceed further time for some definitions 🙂 so that all have same understanding –

APIApplication Programming Interface is a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.

REST – REST stands for Representational State Transfer. (It is sometimes spelled “ReST“.) It relies on a stateless, client-server, cacheable communications protocol and in virtually all cases, the HTTP protocol is used. REST is an architecture style for designing networked applications.

API’s which return Richly Structured data are called RESTFull API’s.

So, making it work is 3 step process :

  1. Make your Custom Query URL –

    Like Fiddler Logs in the above screenshot, we’ll create a URL with a Custom Query string, something like below –URL :  http://api.bing.com/qsml.aspx?query=WordWhen you type this URL in a browser address bar and hit enter, you’ll see a structured data returned (XML Data).


  2. Send HTTP request to Bing API –

    Using the PoweShell Invoke-RestMethod Cmdlet sending an HTTP request on URL mentioned in Step 1.

    Function Auto-Complete()
    Return (Invoke-RestMethod -Uri "http://api.bing.com/qsml.aspx?query=$($TextBox1.text)").searchsuggestion.section.item.text
  3. Data Mine the Structured Data returned –

    Capture the useful information from the Structured data returned from the API and feed it to your GUI.




Run the Script and type in your query in the TextBox. Form is intelligent enough to give you suggestions the moment you stop typing, like in the below animation

ezgif.com-video-to-gif (3)
Hoping you find it fun.
Happy Reading  🙂

Prateek Singh




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s