scraperapi-java-sdklisted
Install: claude install-skill scraperapi/scraperapi-skills
# ScraperAPI — Java SDK Best Practices
**Requires:** Java 8+, Maven or Gradle, `SCRAPERAPI_API_KEY` environment variable.
## Setup
### Maven
```xml
<dependency>
<groupId>com.scraperapi</groupId>
<artifactId>sdk</artifactId>
<version>1.2</version>
</dependency>
```
### Gradle
```groovy
implementation 'com.scraperapi:sdk:1.2'
```
### Client instantiation
```java
import com.scraperapi.ScraperApiClient;
ScraperApiClient client = new ScraperApiClient(System.getenv("SCRAPERAPI_API_KEY"));
```
Never hardcode the API key. Read it from the environment every time.
## Basic Usage
The Java SDK uses a **fluent builder** pattern. Chain parameter methods onto the result of `.get()`, then call `.result()` to block and retrieve the HTML.
```java
// Simple GET — returns HTML as a String
String html = client.get("https://example.com/").result();
// With parameters — chain before .result()
String html = client.get("https://example.com/")
.render(true)
.result();
// Multiple parameters
String html = client.get("https://example.com/")
.render(true)
.countryCode("us")
.result();
```
## Decision Guide
| Situation | Approach |
|-----------|---------|
| Single URL, synchronous | `.get(url).<params>.result()` |
| Page loads content via JavaScript | Chain `.render(true)` |
| Site blocks datacenter proxies | Chain `.premium(true)` |
| Toughest anti-bot protection | Chain `.ultraPremium(true)` |
| Multi-step / paginated flow on same domain | Chain `.sessionNumber