Official Java SDK for JustSerpAPI.
Use this SDK to access JustSerpAPI from Java and fetch structured Google search results without building raw HTTP requests by hand.
Get your API key, product docs, and pricing at justserpapi.com.
- Java 11+
<dependency>
<groupId>com.justserpapi</groupId>
<artifactId>justserpapi-java</artifactId>
<version>0.1.0</version>
</dependency>import com.justserpapi.JustSerpApiClient;
import com.justserpapi.generated.invoker.ApiException;
import com.justserpapi.model.JustSerpApiResponse;
import java.time.Duration;
public class Example {
public static void main(String[] args) throws ApiException {
JustSerpApiClient client = JustSerpApiClient.builder()
.apiKey(System.getenv("JUSTSERPAPI_API_KEY"))
.timeout(Duration.ofSeconds(30))
.build();
JustSerpApiResponse response = client.google().search(
"coffee shops in shanghai",
0,
false,
"en",
null,
"google.com",
"us",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
"off",
"0",
"1"
);
System.out.println("code = " + response.getCode());
System.out.println("message = " + response.getMessage());
System.out.println("requestId = " + response.getRequestId());
System.out.println("organic results = " + response.getData().get("organic_results"));
}
}JustSerpApiClient client = JustSerpApiClient.builder()
.apiKey("YOUR_API_KEY")
.baseUrl("https://api.justserpapi.com")
.timeout(Duration.ofSeconds(30))
.build();apiKey(...) is required. baseUrl(...) and timeout(...) are optional.
Every request returns a JustSerpApiResponse envelope:
code: application-level status codemessage: response messagerequestId: server request idtimestamp: epoch millisecondsdata: endpoint-specific payload
- Website: https://justserpapi.com/
- API docs: https://justserpapi.com/
- GitHub releases: https://github.com/justserpapi/justserpapi-java/releases
For account setup, API access, and product information, start at justserpapi.com.
