A robust, type-safe Java SDK designed for seamless integration with the FastPix API platform.
The FastPix Java SDK simplifies integration with the FastPix platform. It provides a clean, type-safe interface for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, on‑demand content, playlists, video analytics, and signing keys for secure access and token management. It is intended for use with Java 11 and above.
| Requirement | Version | Description |
|---|---|---|
| Java | 11+ |
Core runtime environment (JDK) |
| Maven/Gradle | Latest |
Build tool and dependency management |
| Internet | Required |
API communication and authentication |
Pro Tip: We recommend using Java 17+ for optimal performance and the latest language features.
To get started with the FastPix Java SDK, ensure you have the following:
- The FastPix APIs are authenticated using a Username and a Password. You must generate these credentials to use the SDK.
- Follow the steps in the Authentication with Basic Auth guide to obtain your credentials.
Configure your FastPix credentials using environment variables for enhanced security and convenience:
# Set your FastPix credentials
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Security Note: Never commit your credentials to version control. Use environment variables or secure credential management systems.
Install the FastPix Java SDK using your preferred build tool:
Add the dependency to your build.gradle:
dependencies {
implementation 'io.fastpix:sdk:1.0.0'
}Add the dependency to your pom.xml:
<dependency>
<groupId>io.fastpix</groupId>
<artifactId>sdk</artifactId>
<version>1.0.0</version>
</dependency>After cloning the git repository to your file system, you can build the SDK artifact from source to the build directory by running:
On Unix/Linux/macOS:
./gradlew buildOn Windows:
gradlew.bat buildIf you wish to build from source and publish the SDK artifact to your local Maven repository, use:
On Unix/Linux/macOS:
./gradlew publishToMavenLocal -Pskip.signingOn Windows:
gradlew.bat publishToMavenLocal -Pskip.signingInitialize the FastPix SDK with your credentials:
// Import required classes from the FastPix SDK
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.Security;
FastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();Or using environment variables:
// Import required classes from the FastPix SDK
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.Security;
FastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username(System.getenv("FASTPIX_USERNAME")) // Your Access Token
.password(System.getenv("FASTPIX_PASSWORD")) // Your Secret Key
.build())
.build();Note: In the examples below,
package hello.world;is used for demonstration purposes. When creating your own Java files, ensure the package name matches your directory structure (e.g., if your file is atsrc/main/java/com/example/MyApp.java, usepackage com.example;).
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.lang.Exception;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.operations.CreateMediaResponse;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) throws Exception {
FastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CreateMediaResponse res = sdk.inputVideos().create()
.request(req)
.call();
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
}
}The SDK provides comprehensive asynchronous support using Java's CompletableFuture<T> and Reactive Streams Publisher<T> APIs. This design makes no assumptions about your choice of reactive toolkit, allowing seamless integration with any reactive library.
Why Use Async?
Asynchronous operations provide several key benefits:
- Non-blocking I/O: Your threads stay free for other work while operations are in flight
- Better resource utilization: Handle more concurrent operations with fewer threads
- Improved scalability: Build highly responsive applications that can handle thousands of concurrent requests
- Reactive integration: Works seamlessly with reactive streams and backpressure handling
Reactive Library Integration
The SDK returns Reactive Streams Publisher<T> instances for operations dealing with streams involving multiple I/O interactions. We use Reactive Streams instead of JDK Flow API to provide broader compatibility with the reactive ecosystem, as most reactive libraries natively support Reactive Streams.
Why Reactive Streams over JDK Flow?
- Broader ecosystem compatibility: Most reactive libraries (Project Reactor, RxJava, Akka Streams, etc.) natively support Reactive Streams
- Industry standard: Reactive Streams is the de facto standard for reactive programming in Java
- Better interoperability: Seamless integration without additional adapters for most use cases
Integration with Popular Libraries:
- Project Reactor: Use
Flux.from(publisher)to convert to Reactor types - RxJava: Use
Flowable.fromPublisher(publisher)for RxJava integration - Akka Streams: Use
Source.fromPublisher(publisher)for Akka Streams integration - Vert.x: Use
ReadStream.fromPublisher(vertx, publisher)for Vert.x reactive streams - Mutiny: Use
Multi.createFrom().publisher(publisher)for Quarkus Mutiny integration
For JDK Flow API Integration: If you need JDK Flow API compatibility (e.g., for Quarkus/Mutiny 2), you can use adapters:
// Convert Reactive Streams Publisher to Flow Publisher
Flow.Publisher<T> flowPublisher = FlowAdapters.toFlowPublisher(reactiveStreamsPublisher);
// Convert Flow Publisher to Reactive Streams Publisher
Publisher<T> reactiveStreamsPublisher = FlowAdapters.toPublisher(flowPublisher);For standard single-response operations, the SDK returns CompletableFuture<T> for straightforward async execution.
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.AsyncFastPixSDK;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.operations.async.CreateMediaResponse;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) {
AsyncFastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build()
.async();
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CompletableFuture<CreateMediaResponse> resFut = sdk.inputVideos().create()
.request(req)
.call();
resFut.thenAccept(res -> {
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
});
}
}Comprehensive Java SDK for FastPix platform integration with full API coverage.
Upload, manage, and transform video content with comprehensive media management capabilities.
For detailed documentation, see FastPix Video on Demand Overview.
- Create from URL - Upload video content from external URL
- Upload from Device - Upload video files directly from device
- List All Media - Retrieve complete list of all media files
- Get Media by ID - Get detailed information for specific media
- Update Media - Modify media metadata and settings
- Delete Media - Remove media files from library
- Cancel Upload - Stop ongoing media upload process
- Get Input Info - Retrieve detailed input information
- List Uploads - Get all available upload URLs
- Create Playback ID - Generate secure playback identifier
- Delete Playback ID - Remove playback access
- Get Playback ID - Retrieve playback configuration details
- List Playback IDs - Get all playback IDs for a media
- Update Domain Restrictions - Update domain restrictions for a playback ID
- Update User-Agent Restrictions - Update user-agent restrictions for a playback ID
- Create Playlist - Create new video playlist
- List Playlists - Get all available playlists
- Get Playlist - Retrieve specific playlist details
- Update Playlist - Modify playlist settings and metadata
- Delete Playlist - Remove playlist from library
- Add Media - Add media items to playlist
- Reorder Media - Change order of media in playlist
- Remove Media - Remove media from playlist
- Create Key - Generate new signing key pair
- List Keys - Get all available signing keys
- Delete Key - Remove signing key from system
- Get Key - Retrieve specific signing key details
- List DRM Configs - Get all DRM configuration options
- Get DRM Config - Retrieve specific DRM configuration
Stream, manage, and transform live video content with real-time broadcasting capabilities.
For detailed documentation, see FastPix Live Stream Overview.
- Create Stream - Initialize new live streaming session with DVR mode support
- List Streams - Retrieve all active live streams
- Get Viewer Count - Get real-time viewer statistics
- Get Stream - Retrieve detailed stream information
- Delete Stream - Terminate and remove live stream
- Update Stream - Modify stream settings and configuration
- Enable Stream - Activate live streaming
- Disable Stream - Pause live streaming
- Complete Stream - Finalize and archive stream
- Create Playback ID - Generate secure live playback access
- Delete Playback ID - Revoke live playback access
- Get Playback ID - Retrieve live playback configuration
- Create Simulcast - Set up multi-platform streaming
- Delete Simulcast - Remove simulcast configuration
- Get Simulcast - Retrieve simulcast settings
- Update Simulcast - Modify simulcast parameters
Monitor video performance and quality with comprehensive analytics and real-time metrics.
For detailed documentation, see FastPix Video Data Overview.
- List Breakdown Values - Get detailed breakdown of metrics by dimension
- List Overall Values - Get aggregated metric values across all content
- Get Timeseries Data - Retrieve time-based metric trends and patterns
- List Comparison Values - Compare metrics across different time periods
- List Video Views - Get comprehensive list of video viewing sessions
- Get View Details - Retrieve detailed information about specific video views
- List Top Content - Find your most popular and engaging content
- Get Concurrent Viewers - Monitor real-time viewer counts over time
- Get Viewer Breakdown - Analyze viewers by device, location, and other dimensions
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
- List Errors - Get playback errors and performance issues
Transform and enhance your video content with powerful AI and editing capabilities.
Enhance video content with AI-powered features including moderation, summarization, and intelligent categorization.
- Update Summary - Create AI-generated video summaries
- Generate Chapters - Automatically generate video chapter markers
- Extract Entities - Identify and extract named entities from content
- Enable Moderation - Activate content moderation and safety checks
- Get Media Clips - Retrieve all clips associated with a source media
- List Live Clips - Get all clips of a live stream
- Generate Subtitles - Create automatic subtitles for media
- Add Track - Add audio or subtitle tracks to media
- Update Track - Modify existing audio or subtitle tracks
- Delete Track - Remove audio or subtitle tracks
- Update Source Access - Control access permissions for media source
- Update MP4 Support - Configure MP4 download capabilities
- Get Summary - Retrieve AI-generated video summary
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, you can provide a RetryConfig object through the retryConfig builder method:
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.lang.Exception;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.operations.CreateMediaResponse;
import io.fastpix.sdk.utils.BackoffStrategy;
import io.fastpix.sdk.utils.RetryConfig;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) throws Exception {
FastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CreateMediaResponse res = sdk.inputVideos().create()
.request(req)
.retryConfig(RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(1L, TimeUnit.MILLISECONDS)
.maxInterval(50L, TimeUnit.MILLISECONDS)
.maxElapsedTime(100L, TimeUnit.MILLISECONDS)
.baseFactor(1.1)
.jitterFactor(0.15)
.retryConnectError(false)
.build())
.build())
.call();
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
}
}If you'd like to override the default retry strategy for all operations that support retries, you can provide a configuration at SDK initialization:
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.lang.Exception;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.operations.CreateMediaResponse;
import io.fastpix.sdk.utils.BackoffStrategy;
import io.fastpix.sdk.utils.RetryConfig;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) throws Exception {
FastPixSDK sdk = FastPixSDK.builder()
.retryConfig(RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(1L, TimeUnit.MILLISECONDS)
.maxInterval(50L, TimeUnit.MILLISECONDS)
.maxElapsedTime(100L, TimeUnit.MILLISECONDS)
.baseFactor(1.1)
.jitterFactor(0.15)
.retryConnectError(false)
.build())
.build())
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CreateMediaResponse res = sdk.inputVideos().create()
.request(req)
.call();
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
}
}FastpixException is the base class for all HTTP error responses. It has the following properties:
| Method | Type | Description |
|---|---|---|
message() |
String |
Error message |
code() |
int |
HTTP response status code eg 404 |
headers() |
Map<String, List<String>> |
HTTP response headers |
body() |
Optional<byte[]> |
HTTP body as a byte array. Can be empty if no body is returned. |
bodyAsString() |
String |
HTTP body as a UTF-8 string. Can be empty string if no body is returned. |
rawResponse() |
HttpResponse<?> |
Raw HTTP response (body already read and not available for re-read) |
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.io.UncheckedIOException;
import java.lang.Exception;
import java.util.*;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.errors.FastpixException;
import io.fastpix.sdk.models.operations.CreateMediaResponse;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) throws Exception {
FastPixSDK sdk = FastPixSDK.builder()
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();
try {
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CreateMediaResponse res = sdk.inputVideos().create()
.request(req)
.call();
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
} catch (FastpixException ex) { // all SDK exceptions inherit from FastpixException
// ex.toString() provides a detailed error message including
// HTTP status code, headers, and error payload (if any)
System.out.println(ex);
// Base exception fields
var rawResponse = ex.rawResponse();
var headers = ex.headers();
var contentType = headers.getOrDefault("Content-Type", List.of()).stream().findFirst();
int statusCode = ex.code();
Optional<byte[]> responseBody = ex.body();
String bodyAsString = ex.bodyAsString();
} catch (UncheckedIOException ex) {
// handle IO error (connection, timeout, etc)
}
}
}Primary error:
FastpixException: The base class for HTTP error responses.
Less common errors
Network errors:
java.io.IOException(always wrapped byjava.io.UncheckedIOException). Commonly encountered subclasses ofIOExceptionincludejava.net.ConnectException,java.net.SocketTimeoutException,EOFException(there are many more subclasses in the JDK platform).
Inherit from FastpixException:
- Additional error classes may be defined for specific error scenarios.
The default server can be overridden globally using the .serverURL(String serverUrl) builder method when initializing the SDK client instance. For example:
// Package declaration - adjust to match your project's directory structure
package hello.world;
// Import required classes from the FastPix SDK
import java.lang.Exception;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.models.components.*;
import io.fastpix.sdk.models.operations.CreateMediaResponse;
import io.fastpix.sdk.utils.JSON;
public class Application {
public static void main(String[] args) throws Exception {
FastPixSDK sdk = FastPixSDK.builder()
.serverURL("https://api.fastpix.io/v1/")
.security(Security.builder()
.username("your-access-token")
.password("your-secret-key")
.build())
.build();
CreateMediaRequest req = CreateMediaRequest.builder()
.inputs(List.of(
Input.of(PullVideoInput.builder()
.url("https://static.fastpix.io/fp-sample-video.mp4")
.build())))
.metadata(Map.ofEntries(
Map.entry("key1", "value1")))
.build();
CreateMediaResponse res = sdk.inputVideos().create()
.request(req)
.call();
if (res.createMediaSuccessResponse().isPresent()) {
var mapper = JSON.getMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
System.out.println(mapper.writeValueAsString(res.createMediaSuccessResponse().get()));
}
}
}The Java SDK makes API calls using an HTTPClient that wraps the native
HttpClient. This
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
errors and response.
The HTTPClient interface allows you to either use the default FastpixHTTPClient that comes with the SDK,
or provide your own custom implementation with customized configuration such as custom executors, SSL context,
connection pools, and other HTTP client settings.
The interface provides synchronous (send) methods and asynchronous (sendAsync) methods. The sendAsync method
is used to power the async SDK methods and returns a CompletableFuture<HttpResponse<Blob>> for non-blocking operations.
The following example shows how to add a custom header and handle errors:
// Import required classes from the FastPix SDK
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.utils.HTTPClient;
import io.fastpix.sdk.utils.FastpixHTTPClient;
import io.fastpix.sdk.utils.Utils;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.InputStream;
import java.time.Duration;
public class Application {
public static void main(String[] args) {
// Create a custom HTTP client with hooks
HTTPClient httpClient = new HTTPClient() {
private final HTTPClient defaultClient = new FastpixHTTPClient();
@Override
public HttpResponse<InputStream> send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException {
// Add custom header and timeout using Utils.copy()
HttpRequest modifiedRequest = Utils.copy(request)
.header("x-custom-header", "custom value")
.timeout(Duration.ofSeconds(30))
.build();
try {
HttpResponse<InputStream> response = defaultClient.send(modifiedRequest);
// Log successful response
System.out.println("Request successful: " + response.statusCode());
return response;
} catch (Exception error) {
// Log error
System.err.println("Request failed: " + error.getMessage());
throw error;
}
}
};
FastPixSDK sdk = FastPixSDK.builder()
.client(httpClient)
.build();
}
}Custom HTTP Client Configuration
You can also provide a completely custom HTTP client with your own configuration:
// Import required classes from the FastPix SDK
import io.fastpix.sdk.FastPixSDK;
import io.fastpix.sdk.utils.HTTPClient;
import io.fastpix.sdk.utils.Blob;
import io.fastpix.sdk.utils.ResponseWithBody;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.InputStream;
import java.time.Duration;
import java.util.concurrent.Executors;
import java.util.concurrent.CompletableFuture;
public class Application {
public static void main(String[] args) {
// Custom HTTP client with custom configuration
HTTPClient customHttpClient = new HTTPClient() {
private final HttpClient client = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(10))
.connectTimeout(Duration.ofSeconds(30))
// .sslContext(customSslContext) // Add custom SSL context if needed
.build();
@Override
public HttpResponse<InputStream> send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException {
return client.send(request, HttpResponse.BodyHandlers.ofInputStream());
}
@Override
public CompletableFuture<HttpResponse<Blob>> sendAsync(HttpRequest request) {
// Convert response to HttpResponse<Blob> for async operations
return client.sendAsync(request, HttpResponse.BodyHandlers.ofPublisher())
.thenApply(resp -> new ResponseWithBody<>(resp, Blob::from));
}
};
FastPixSDK sdk = FastPixSDK.builder()
.client(customHttpClient)
.build();
}
}This SDK uses SLF4j for structured logging across HTTP requests, retries, pagination, streaming, and hooks. SLF4j provides comprehensive visibility into SDK operations.
Log Levels:
- DEBUG: High-level operations (HTTP requests/responses, retry attempts, page fetches, hook execution, stream lifecycle)
- TRACE: Detailed information (request/response bodies, backoff calculations, individual items processed)
Configuration:
Add your preferred SLF4j implementation to your project. For example, using Logback:
dependencies {
implementation 'ch.qos.logback:logback-classic:1.4.14'
}Configure logging levels in your logback.xml:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- SDK-wide logging -->
<logger name="io.fastpix.sdk" level="DEBUG"/>
<!-- Component-specific logging -->
<logger name="io.fastpix.sdk.utils.FastpixHTTPClient" level="DEBUG"/>
<logger name="io.fastpix.sdk.utils.Retries" level="DEBUG"/>
<logger name="io.fastpix.sdk.utils.pagination" level="DEBUG"/>
<logger name="io.fastpix.sdk.utils.Hooks" level="TRACE"/>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>What Gets Logged:
- HTTP Client: Request/response details, headers (with sensitive headers redacted), bodies (at TRACE level)
- Retries: Retry attempts, backoff delays, exhaustion, non-retryable exceptions
- Pagination: Page fetches, pagination state, errors
- Streaming: Stream initialization, item processing, closure
- Hooks: Hook execution counts, operation IDs, exceptions
For backward compatibility, you can still use the legacy debug logging method:
FastPixSDK sdk = FastPixSDK.builder()
.enableHTTPDebugLogging(true)
.build();Warning
Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
Example output:
Sending request: http://localhost:35123/bearer#global GET
Request headers: {Accept=[application/json], Authorization=[******], Client-Level-Header=[added by client], Idempotency-Key=[some-key], x-fastpix-user-agent=[fastpix-sdk/java 0.0.1 internal 0.1.0 io.fastpix.sdk]}
Received response: (GET http://localhost:35123/bearer#global) 200
Response headers: {access-control-allow-credentials=[true], access-control-allow-origin=[*], connection=[keep-alive], content-length=[50], content-type=[application/json], date=[Wed, 09 Apr 2025 01:43:29 GMT], server=[gunicorn/19.9.0]}
Response body:
{
"authenticated": true,
"token": "global"
}
Note: Authorization headers are redacted by default. You can specify additional redacted header names via FastpixHTTPClient.setRedactedHeaders.
Note: This is a convenience method that calls HTTPClient.enableDebugLogging(). The FastpixHTTPClient honors this setting. If you are using a custom HTTP client, it is up to the custom client to honor this setting.
Another option is to set the System property -Djdk.httpclient.HttpClient.log=all. However, this option does not log request/response bodies.
This Java SDK is programmatically generated from our API specifications. Any manual modifications to internal files will be overwritten during subsequent generation cycles.
We value community contributions and feedback. Feel free to submit pull requests or open issues with your suggestions, and we'll do our best to include them in future releases.
For comprehensive understanding of each API's functionality, including detailed request and response specifications, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference offers complete documentation for all available endpoints and features, enabling developers to integrate and leverage FastPix APIs effectively.