Using Google custom search API

Using Google custom search API

Do you wanna implement google custom search api, in an application (ios/android)? Alright! Here, this link will solve everything for you.

Go check that!

Checked? 'And' back! That means you are one of my kind, unlike the geniuses who understand the encrypted documentation of these tech giants.

It took me 6-7 hours and tens of url keys (support URL and forum links) to decrypt the documentation they provided. I wanna save that time for you folk. Here is step by step process to for implementing google search api.

Initial X step will be common for all, and last few steps are dedicated for the application developers. In this document you'll learn:

  • Steps to implement the search API
  • Pictorial detail of steps
  • Make a final run of your application

Brief Step of the process:

  1. Create a Google account (ignore if you have one)
  2. You may found some peace of information related to pricing at the bottom of this page helpful(you can ignore this too)
  3. Create project and generate API key 
    • Go to google consol and create a project
    • After project created, click on it to go to it's detail.
    • On the left bar under Auth&API segment, click on APIs.
    • Now you'll find CustomSearchAPI link in Brows APIs section (as it is not activated by default), turn it on by clicking on the button at right.
    • Now click on Credentials, just below APIs option
    • On this page under "Public API Access" click on Create New Key Button, for now choose browser key(as at first we wanna a test it on browser), create it and leave it, as it is for now.
  4. Create Custom Search Engine
    • Now on the new tab, open Custom Search Engine page. On this page click on Create a custom search engine, button
    • That will lead you to create new search engine page, here give your domain name in "Sites to search" field. (If you don't have one no worries, give any thing, that have www. in the start and .com in the end)
    • Fill name, if it haven't pick one already, then click on create.
    • So you got a jumping robo to congratulate you? ;) Yeah that's it. In this page step up to "Modify your search engine", by clicking on, "Control Panel" button
    • There you are, now tern on the Image Search, (if you want to)
    • Also in "Sites to search" section, select, "Search the entire web but emphasize on included item", instead of, the default one, which is "Search only included site"
    • That is it at the bottom of this page click on update. And then come back to middle of the page and under the "Detail" title, click on Search engine ID, copy the Id, paste it somewhere.
  5. Make a search, using get request:
    • To make a get request use this request URL
    • In it replace, {API_KEY} which you have created under "Create project and generate API key" section
    • And replace {SEARCH_ENGINE_KEY} with the Search engine Id you just copy pasted
    • Call it with some different value, at query string, than 'a', https://www.googleapis.com/customsearch/v1?q=a&key={API_KEY}&cx={SEARCH_ENGINE_KEY} change a with any thing you wanna search you must have got the beautiful JSON of search result
  6. Other Stuff
    • If you wanna see the request status, go back to your project page, that hoe may request placed, how many of those failed, ect. Click on the overview and you will get the graph for that, love you google
    • If you have trouble with JSON, here are some links at your service,
      • What is JSON 12?
      •  Use JSON in ios.
      •  Use JSON in android

References:

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

Arpit Awasthi的更多文章

  • Create your own cocoa-pod

    Create your own cocoa-pod

    Why? Mainly because you want to do it, but then it has been proved to be the highly efficient approach when you know…

  • Change your date of birth on Linked In.

    Change your date of birth on Linked In.

    Linked in have some really basic features hidden in plain sight. Changing your date of birth is one of them.

    2 条评论
  • Tribe Reunite

    Tribe Reunite

    Walking down on a busy street with your brother who suffers from expression deficiency. You loose attention for a…

  • Code: Keep It Simple

    Code: Keep It Simple

    “Code”, sounds complicated. Now what on earth have possessed me to title article about code, “Keep it Simple”.

  • iOS (10) , makes an iOS coder's life easy, know Why

    iOS (10) , makes an iOS coder's life easy, know Why

    It took me around a week to get through all the WWDC videos. Thanks to Ohochuck for his great swiftscript which helped…

    2 条评论

社区洞察

其他会员也浏览了