Documentation Index
Fetch the complete documentation index at: https://newscatcherinc-docs.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Java SDK provides access to the News API from Java or Kotlin applications.
Installation
Gradle
dependencies {
implementation 'com.newscatcherapi:newscatcher-sdk:2.0.0'
}
Maven
<dependency>
<groupId>com.newscatcherapi</groupId>
<artifactId>newscatcher-sdk</artifactId>
<version>2.0.0</version>
</dependency>
Basic usage
import com.newscatcher.api.NewscatcherApiClient;
import com.newscatcher.api.resources.search.requests.PostSearchRequest;
NewscatcherApiClient client = NewscatcherApiClient.builder()
.apiKey("YOUR_API_KEY")
.build();
client.search().post(PostSearchRequest.builder()
.q("renewable energy")
.lang(Arrays.asList("en"))
.build());
Error handling
import com.newscatcher.api.core.NewscatcherApiApiException;
try {
client.search().post(...);
} catch (NewscatcherApiApiException e) {
System.out.println(e.getMessage());
System.out.println(e.statusCode());
System.out.println(e.body());
}
For complete documentation, including specific error types and configuration
options, see the
GitHub repository.
Resources