Jury A
Jury A

Reputation: 20092

How to use Bing search api in Java

I need to extract search results from Bing. Is there any available Java code to achieve this ?

Upvotes: 4

Views: 5389

Answers (1)

Nathan Black
Nathan Black

Reputation: 440

This MSDN forum thread has alot of answers and examples.

Also, when you buy or subscribe to a dataset on Azure, they have a java example. Here's an example

Go to the odata4j site and download the latest release.

Add odata4j-clientbundle-x.x.jar to your Java build path.

You can use the following code to call the service.

ODataConsumer c = ODataConsumers
    .newBuilder("https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/")
    .setClientBehaviors(OClientBehaviors.basicAuth("accountKey", "{your account key here}"))
    .build();

OQueryRequest<OEntity> oRequest = c.getEntities("Web")
    .custom("Query", "stackoverflow bing api");

Enumerable<OEntity> entities = oRequest.execute();

Upvotes: 7

Related Questions