From 313a443395d9dfd1f9c5348b8f53d413b09eb637 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Mon, 8 Jun 2026 23:09:00 -0500 Subject: [PATCH] docs: fix SerpApi link format and add migration guide from google-search-results-java - Fix SerpApi homepage URL to use proper markdown link syntax - Add migration guide section covering dependency change, class/method renames, and before/after code example for users upgrading from the legacy google-search-results-java library Co-Authored-By: Claude Sonnet 4.6 --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- README.md.erb | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6af2a2e..daf088a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml) [![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java) -Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com). +Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com). SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more. @@ -539,6 +539,54 @@ System.out.println(results.toString()); see: [https://serpapi.com/images-results](https://serpapi.com/images-results) +## Migration from google-search-results-java + +If you are upgrading from the legacy [`google-search-results-java`](https://github.com/serpapi/google-search-results-java) library, here is a summary of what changed. + +### Dependency + +```gradle +// before +implementation 'com.github.serpapi:google-search-results-java:2.0.0' + +// after +implementation 'com.github.serpapi:serpapi-java:1.1.0' +``` + +### Class and method renames + +| Old (`google-search-results-java`) | New (`serpapi-java`) | +|------------------------------------|----------------------| +| `GoogleSearch` | `SerpApi` | +| `SerpApiSearch` | `SerpApi` | +| `client.getJson()` | `client.search(parameter)` | +| `client.getHtml()` | `client.html(parameter)` | +| `client.getSearchArchive(id)` | `client.searchArchive(id)` | +| `client.getAccount()` | `client.account()` | +| `client.getLocation(parameter)` | `client.location(parameter)` | +| `SerpApiSearchException` | `SerpApiException` | + +### Example + +```java +// before +Map parameter = new HashMap<>(); +parameter.put("q", "coffee"); +parameter.put("api_key", "your_api_key"); +GoogleSearch search = new GoogleSearch(parameter); +JsonObject results = search.getJson(); + +// after +Map auth = new HashMap<>(); +auth.put("api_key", "your_api_key"); +SerpApi client = new SerpApi(auth); + +Map parameter = new HashMap<>(); +parameter.put("q", "coffee"); +parameter.put("engine", "google"); +JsonObject results = client.search(parameter); +``` + ### Contributing We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle. diff --git a/README.md.erb b/README.md.erb index 2378a73..85e9d8f 100644 --- a/README.md.erb +++ b/README.md.erb @@ -22,7 +22,7 @@ end [![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml) [![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java) -Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com). +Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com). SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more. @@ -276,6 +276,54 @@ see: [https://serpapi.com/google-play-api](https://serpapi.com/google-play-api) see: [https://serpapi.com/images-results](https://serpapi.com/images-results) +## Migration from google-search-results-java + +If you are upgrading from the legacy [`google-search-results-java`](https://github.com/serpapi/google-search-results-java) library, here is a summary of what changed. + +### Dependency + +```gradle +// before +implementation 'com.github.serpapi:google-search-results-java:2.0.0' + +// after +implementation 'com.github.serpapi:serpapi-java:1.1.0' +``` + +### Class and method renames + +| Old (`google-search-results-java`) | New (`serpapi-java`) | +|------------------------------------|----------------------| +| `GoogleSearch` | `SerpApi` | +| `SerpApiSearch` | `SerpApi` | +| `client.getJson()` | `client.search(parameter)` | +| `client.getHtml()` | `client.html(parameter)` | +| `client.getSearchArchive(id)` | `client.searchArchive(id)` | +| `client.getAccount()` | `client.account()` | +| `client.getLocation(parameter)` | `client.location(parameter)` | +| `SerpApiSearchException` | `SerpApiException` | + +### Example + +```java +// before +Map parameter = new HashMap<>(); +parameter.put("q", "coffee"); +parameter.put("api_key", "your_api_key"); +GoogleSearch search = new GoogleSearch(parameter); +JsonObject results = search.getJson(); + +// after +Map auth = new HashMap<>(); +auth.put("api_key", "your_api_key"); +SerpApi client = new SerpApi(auth); + +Map parameter = new HashMap<>(); +parameter.put("q", "coffee"); +parameter.put("engine", "google"); +JsonObject results = client.search(parameter); +``` + ### Contributing We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle.