All URIs are relative to https://api.unifapi.com
| Method | HTTP request | Description |
|---|---|---|
| newsSearchPost | POST /news/search | Search News |
NewsSearchPost200Response newsSearchPost(newsSearchRequest)
Search News
Run one live News search and receive the ranked news articles and top-stories blocks for a query, including title, publisher domain, snippet, image, and publish time.
// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.NewsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.unifapi.com");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
NewsApi apiInstance = new NewsApi(defaultClient);
NewsSearchRequest newsSearchRequest = new NewsSearchRequest(); // NewsSearchRequest |
try {
NewsSearchPost200Response result = apiInstance.newsSearchPost(newsSearchRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling NewsApi#newsSearchPost");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| newsSearchRequest | NewsSearchRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Validation or invalid-id error | - |
| 401 | Missing, invalid, disabled, revoked, or expired UnifAPI API key | - |
| 402 | Insufficient workspace credits | - |
| 404 | Resource not found | - |
| 429 | Rate limited | - |
| 500 | Internal error | - |
| 502 | Source error | - |
| 503 | Source unavailable | - |