We help IT Professionals succeed at work.

Bing API Version 2.0 - How to implement for site search. ASP.net, c# or vb, JSON or SOAP.

Medium Priority
1,196 Views
Last Modified: 2013-11-18
I want to learn how to do this. I have read a couple books on c# programming and worked through some examples, but I have no idea how to implement an API.

Bing recently did away with their site search because the API includes the same capabilities. They show an example of the API and how to get a developer code here: http://www.bing.com/developers

But I haven't found one place that shows how to set it up for a webpage. I also need to know how to work with either SOAP or JSON (One site I looked at suggested SOAP for c#). I don't even know if I need to install those things or just add it as a reference, etc.

I would really like to learn how to do this. It's a step that I need to take in order to learn more about programming. I know this may be a big question, but I don't know where else to learn how to do this. I even went to several sites looking for ANY API to see how to work with them but I'm not having any luck. I know it's a lot to ask, but what the heck - you guys are experts!

Any help would be greatly appreciated. If I need to break it down into several questions I would be glad to do so if someone would suggest how to do that.

TIA,
MHenry
Comment
Watch Question

leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
>But I haven't found one place that shows how to set it up for a webpage.
http://www.pckult.net/blog/recherche-avec-lapi-bing-grace-a-asp-net-et-jquery/

Author

Commented:
leakim971,

I actually found an English version of that code here:
http://weblogs.asp.net/hajan/archive/2011/03/07/bing-search-using-asp-net-and-jquery-ajax.aspx

And I finally got that bit working over the weekend. But this example shows how to do a web search, not a site search.

I would also like to make it appear more like it used to, a popup window with the results in there.

Any help on that?

Best,
MHenry
leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
If you add the keyworkd site: follwing the site you got result for a specific site
for example site:microsoft.com

you can easily put result in a css popup window or jquery dialog : http://jqueryui.com/demos/dialog/ 

Author

Commented:
Sorry, where would I put that? I got it working once, but don't remember how.

And when I did, it didn't limit the search to just my site. I was getting stuff like (for example) mysite.com, xmysite.com, xyzmysite.com.

It was pretty strange...
leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
>Sorry, where would I put that?

in the url, when you build the search string, just like it's a term you're lookign for

var url = "http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&Appid="+ bingAPIKey + "&query=" + encodedKeyWords + "&sources=web&site%3Ayoudomain%2Ecom";

>And when I did, it didn't limit the search to just my site.
Yes, that is

Author

Commented:
remembered how I got the results. I used this:
+ "&query=www.mysite.com"

But like I said, it also serves up stuff from other sites that have mysite.com in the url.

weird.

Author

Commented:
I've tried:
              + "&sources=web" + "&site=mysite.com";

             + "&sources=web&site=mysite.com";
           
             + "&sources=web&site%3Amysite%2Ecom";

As well as about 100 other variations and nothing seems to be working. I either get results from the internet or nothing at all.
Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Perfect. That worked. Thanks!

leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
You're welcome! Thanks for the points!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.