Skip to content

Commit 4660582

Browse files
jvmvikclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 08df8f6 commit 4660582

2 files changed

Lines changed: 98 additions & 2 deletions

File tree

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml)
55
[![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java)
66

7-
Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com).
7+
Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com).
88

99
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.
1010

@@ -539,6 +539,54 @@ System.out.println(results.toString());
539539
see: [https://serpapi.com/images-results](https://serpapi.com/images-results)
540540

541541

542+
## Migration from google-search-results-java
543+
544+
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.
545+
546+
### Dependency
547+
548+
```gradle
549+
// before
550+
implementation 'com.github.serpapi:google-search-results-java:2.0.0'
551+
552+
// after
553+
implementation 'com.github.serpapi:serpapi-java:1.1.0'
554+
```
555+
556+
### Class and method renames
557+
558+
| Old (`google-search-results-java`) | New (`serpapi-java`) |
559+
|------------------------------------|----------------------|
560+
| `GoogleSearch` | `SerpApi` |
561+
| `SerpApiSearch` | `SerpApi` |
562+
| `client.getJson()` | `client.search(parameter)` |
563+
| `client.getHtml()` | `client.html(parameter)` |
564+
| `client.getSearchArchive(id)` | `client.searchArchive(id)` |
565+
| `client.getAccount()` | `client.account()` |
566+
| `client.getLocation(parameter)` | `client.location(parameter)` |
567+
| `SerpApiSearchException` | `SerpApiException` |
568+
569+
### Example
570+
571+
```java
572+
// before
573+
Map<String, String> parameter = new HashMap<>();
574+
parameter.put("q", "coffee");
575+
parameter.put("api_key", "your_api_key");
576+
GoogleSearch search = new GoogleSearch(parameter);
577+
JsonObject results = search.getJson();
578+
579+
// after
580+
Map<String, String> auth = new HashMap<>();
581+
auth.put("api_key", "your_api_key");
582+
SerpApi client = new SerpApi(auth);
583+
584+
Map<String, String> parameter = new HashMap<>();
585+
parameter.put("q", "coffee");
586+
parameter.put("engine", "google");
587+
JsonObject results = client.search(parameter);
588+
```
589+
542590
### Contributing
543591

544592
We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle.

README.md.erb

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ end
2222
[![serpapi-java](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml/badge.svg)](https://github.com/serpapi/serpapi-java/actions/workflows/gradle.yml)
2323
[![](https://jitpack.io/v/serpapi/serpapi-java.svg)](https://jitpack.io/#serpapi/serpapi-java)
2424

25-
Integrate search data into your Java application. This library is the official wrapper for SerpApi (https://serpapi.com).
25+
Integrate search data into your Java application. This library is the official wrapper for [SerpApi](https://serpapi.com).
2626

2727
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.
2828

@@ -276,6 +276,54 @@ see: [https://serpapi.com/google-play-api](https://serpapi.com/google-play-api)
276276
see: [https://serpapi.com/images-results](https://serpapi.com/images-results)
277277

278278

279+
## Migration from google-search-results-java
280+
281+
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.
282+
283+
### Dependency
284+
285+
```gradle
286+
// before
287+
implementation 'com.github.serpapi:google-search-results-java:2.0.0'
288+
289+
// after
290+
implementation 'com.github.serpapi:serpapi-java:1.1.0'
291+
```
292+
293+
### Class and method renames
294+
295+
| Old (`google-search-results-java`) | New (`serpapi-java`) |
296+
|------------------------------------|----------------------|
297+
| `GoogleSearch` | `SerpApi` |
298+
| `SerpApiSearch` | `SerpApi` |
299+
| `client.getJson()` | `client.search(parameter)` |
300+
| `client.getHtml()` | `client.html(parameter)` |
301+
| `client.getSearchArchive(id)` | `client.searchArchive(id)` |
302+
| `client.getAccount()` | `client.account()` |
303+
| `client.getLocation(parameter)` | `client.location(parameter)` |
304+
| `SerpApiSearchException` | `SerpApiException` |
305+
306+
### Example
307+
308+
```java
309+
// before
310+
Map<String, String> parameter = new HashMap<>();
311+
parameter.put("q", "coffee");
312+
parameter.put("api_key", "your_api_key");
313+
GoogleSearch search = new GoogleSearch(parameter);
314+
JsonObject results = search.getJson();
315+
316+
// after
317+
Map<String, String> auth = new HashMap<>();
318+
auth.put("api_key", "your_api_key");
319+
SerpApi client = new SerpApi(auth);
320+
321+
Map<String, String> parameter = new HashMap<>();
322+
parameter.put("q", "coffee");
323+
parameter.put("engine", "google");
324+
JsonObject results = client.search(parameter);
325+
```
326+
279327
### Contributing
280328

281329
We use JUnit, **GitHub Actions** (see [workflow](https://github.com/serpapi/serpapi-java/blob/master/.github/workflows/gradle.yml)), and Gradle.

0 commit comments

Comments
 (0)