Adam Bristow
Adam Bristow

Reputation: 330

google custom search api c#

I have a c# webservice that uses WebClient.Downloadstring(MYURL) to get a Google page.

MYURL is equal to:

http://www.google.co.uk/search?q=mystringtosearch&as_qdr=all&num=100&start=0

It was working fine until i got 503 errors from Google for being a bot. I then got sent here:

https://developers.google.com/custom-search/v1/overview

and got a key. Now it says all I need to do is add the &key parameter. However, when I have this as MYURL i still get a 503

http://www.google.co.uk/search?q=mystringtosearch&key=1234567890&as_qdr=all&num=100&start=0

The Google API console says that I haven't done any searches, so I know I haven't gone over my quota.

What's going on?

Upvotes: 1

Views: 1126

Answers (2)

Simon Whitehead
Simon Whitehead

Reputation: 65079

You need to include your custom search engine id in the URL.. as the documentation states, thats what the cx parameter is for.

Upvotes: 1

Nesim Razon
Nesim Razon

Reputation: 9794

Are you sure you are using correct url? Your my url is not customsearch api's url?

If you look at documantation of custom search which is this: https://developers.google.com/custom-search/v1/using_rest?hl=tr

yuo can retrieve results for a particular search by sending an HTTP GET request to its URI. The URI for a search has the following format:

https://www.googleapis.com/customsearch/v1?parameters

documantation has more info

Upvotes: 0

Related Questions