Official Java SDK for ShopSavvy Data API - Access product data, pricing, and price history across thousands of retailers and millions of products.
Add this dependency to your pom.xml
:
<dependency>
<groupId>com.shopsavvy</groupId>
<artifactId>shopsavvy-sdk-java</artifactId>
<version>1.0.0</version>
</dependency>
Add this dependency to your build.gradle
:
implementation 'com.shopsavvy:shopsavvy-sdk-java:1.0.0'
First, get your API key from ShopSavvy Data API.
import com.shopsavvy.sdk.ShopSavvyClient;
import com.shopsavvy.sdk.models.*;
import com.shopsavvy.sdk.exceptions.*;
// Initialize the client
ShopSavvyClient client = new ShopSavvyClient("ss_live_your_api_key_here");
try {
// Get product details
ApiResponse<ProductDetails> productResponse = client.getProductDetails("012345678901");
ProductDetails product = productResponse.getData();
System.out.println("Product: " + product.getName());
// Get current offers
ApiResponse<List<Offer>> offersResponse = client.getCurrentOffers("012345678901");
List<Offer> offers = offersResponse.getData();
for (Offer offer : offers) {
System.out.println(offer.getRetailer() + ": $" + offer.getPrice());
}
// Get price history
ApiResponse<List<OfferWithHistory>> historyResponse =
client.getPriceHistory("012345678901", "2024-01-01", "2024-12-31");
// Schedule monitoring
ApiResponse<ScheduleResponse> scheduleResponse =
client.scheduleProductMonitoring("012345678901", "daily");
// Check API usage
ApiResponse<UsageInfo> usageResponse = client.getUsage();
UsageInfo usage = usageResponse.getData();
System.out.println("Credits remaining: " + usage.getCreditsRemaining());
} catch (ShopSavvyApiException e) {
System.err.println("API Error: " + e.getMessage());
} finally {
// Always close the client when done
client.close();
}
getProductDetails(identifier)
- Get details for a single productgetProductDetailsBatch(identifiers)
- Get details for multiple products
getCurrentOffers(identifier)
- Get current offers for a productgetCurrentOffersBatch(identifiers)
- Get current offers for multiple products
getPriceHistory(identifier, startDate, endDate)
- Get price history for a product
scheduleProductMonitoring(identifier, frequency)
- Schedule product monitoringgetScheduledProducts()
- Get all scheduled productsremoveProductFromSchedule(identifier)
- Remove product from monitoring
getUsage()
- Get API usage information
The SDK provides specific exception types for different error conditions:
ShopSavvyApiException
- Base exception for all API errorsShopSavvyAuthenticationException
- Invalid API keyShopSavvyNotFoundException
- Product not foundShopSavvyValidationException
- Invalid request parametersShopSavvyRateLimitException
- Rate limit exceededShopSavvyNetworkException
- Network connectivity issues
You can customize the client configuration:
// Custom base URL and timeout
ShopSavvyClient client = new ShopSavvyClient(
"ss_live_your_api_key_here",
"https://api.shopsavvy.com/v1",
60 // timeout in seconds
);
- Java 8 or higher
- Jackson for JSON processing
- OkHttp for HTTP requests
MIT License - see LICENSE file for details.
For support, please visit ShopSavvy Data API Documentation or contact [email protected].