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 aBing 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 ;)

HOW IT WORKS :

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

API – Application 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 :  https://api.bing.com/qsml.aspx?query=Word 

    When 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 anHTTP request on URL mentioned in Step 1.
  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.

 

GET THE SCRIPT : Click here to go to my GitHub gist to get the code.

HOW TO USE IT :

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

Hoping you find it fun.
Happy Reading  :)

要查看或添加评论,请登录

Prateek Singh的更多文章

  • 2020 was probably one of the best years of my life.

    2020 was probably one of the best years of my life.

    2020 was without a doubt a very tough year and people went through a lot, it was difficult for everyone! But against…

    6 条评论
  • Fear vs Danger

    Fear vs Danger

    Fear is anticipation over something they may or may not happen, whereas danger is life-threatening, challenging your…

  • The Best Swing in the World

    The Best Swing in the World

    Following is a flash fiction from my book, which reminds us of the struggle of migrant and daily wage workers…

    2 条评论
  • A 3 years old Failure leads to a recent Success story!

    A 3 years old Failure leads to a recent Success story!

    3 years ago today I signed my first contract with a big publisher to create a course. I announced it on social media…

    22 条评论
  • Take 2 – Bhagavad Gita

    Take 2 – Bhagavad Gita

    Sometimes back, I met a very senior professor at a University. He is an old man who gives the impression that he knows…

  • My take on "Passion"

    My take on "Passion"

    We keep hearing the word "Passion" very often in motivational speeches, self-help books and throughout our careers..

  • Perfectly, Permanently, Inevitably Imperfect.

    Perfectly, Permanently, Inevitably Imperfect.

    I’m over critical from an early age to this point of my life, you can say I have this special ability to see too many…

    2 条评论
  • Only easy day was Yesterday

    Only easy day was Yesterday

    One of my close friend often tells me you are too hard on yourself sometimes you should relax and go easy or it will…

    2 条评论
  • Fail like a 2 year old

    Fail like a 2 year old

    Since the beginning we are taught not to fail at things but eventually we will at something or another, and when we get…

    1 条评论
  • PowerShell : Extract Text from Image and Convert \ Print in any Language

    PowerShell : Extract Text from Image and Convert \ Print in any Language

    On 10th March, Xerox announced a Latest Technology (Translation Service) that can Scan a document, Translate it in any…

    2 条评论

社区洞察

其他会员也浏览了