# Java SDK

> Add com.shopsavvy:shopsavvy-sdk from Maven Central to fetch product details, retailer offers and price history from Java and Spring Boot applications.

*Source: https://shopsavvy.com/data/documentation/sdk-java* · Part of the [ShopSavvy Data API documentation](https://shopsavvy.com/data/documentation.md)

---

Our official Java SDK provides enterprise-grade reliability and performance for Java applications.

- [View on GitHub](https://github.com/shopsavvy/sdk-java)
- [Maven Central](https://central.sonatype.com/artifact/com.shopsavvy/shopsavvy-sdk)

## Installation

**Maven:**

```xml
<dependency>
  <groupId>com.shopsavvy</groupId>
  <artifactId>shopsavvy-sdk</artifactId>
  <version>1.1.0</version>
</dependency>
```

**Gradle:**

```groovy
implementation 'com.shopsavvy:shopsavvy-sdk:1.1.0'
```

## Quick Start

```java
import com.shopsavvy.ShopSavvyClient;
import com.shopsavvy.model.Product;
import com.shopsavvy.model.ApiResponse;

public class Example {
    public static void main(String[] args) {
        // Create a new client
        ShopSavvyClient client = new ShopSavvyClient("ss_live_your_api_key_here");

        try {
            // Get product details
            ApiResponse<Product> response = client.getProductDetails("012345678901");
            Product product = response.getData();

            System.out.println("Product: " + product.getName());
            System.out.println("Brand: " + product.getBrand());

            // Get current offers
            var offers = client.getCurrentOffers("012345678901");
            offers.getData().forEach(offer -> {
                System.out.printf("%s: $%.2f%n",
                    offer.getRetailer(), offer.getPrice());
            });

        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}
```

## Features

- Full Java type safety with generics
- Builder pattern for configuration
- Async support with CompletableFuture
- Spring Boot auto-configuration
- Jackson JSON serialization
- Comprehensive error handling
