0

Why can't I make a get request from the back end to google's Query Suggestion Service using Java?

I want to make a get request to this service Google: Query Suggestion Service /suggest Protocol.

so that I can get a response which would list suggested queries. It seems like this library is only for front end javascript applications though because there is a paramater 'client' which needs to be provided. If I set it to chrome and make the request via chrome it works fine. But if I try and make the request using the default in java I don't get anything back.

If this is not possible is there any other tool that does a similar task?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user1809913
  • 1,785
  • 1
  • 14
  • 25

1 Answers1

0

I just had to set my User-Agent to the same as my browser using the setRequestProperty and it worked.

user1809913
  • 1,785
  • 1
  • 14
  • 25