Get the supported country and global options that can be used to filter trending tweets.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.operations.TrendingCountriesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TrendingCountriesResponse res = sdk.trending().countries()
.call();
if (res.standardResponse().isPresent()) {
System.out.println(res.standardResponse().get());
}
}
}
TrendingCountriesResponse
| Error Type |
Status Code |
Content Type |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get the topic categories available for filtering global trending tweets.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.operations.TrendingTopicsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TrendingTopicsResponse res = sdk.trending().topics()
.call();
if (res.standardResponse().isPresent()) {
System.out.println(res.standardResponse().get());
}
}
}
TrendingTopicsResponse
| Error Type |
Status Code |
Content Type |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get content tags for a selected country and topic so tweets can be filtered more precisely.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TrendingContentsRequest;
import io.twexapi.sdk.models.operations.TrendingContentsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TrendingContentsRequest req = TrendingContentsRequest.builder()
.country("Monaco")
.topic("<value>")
.build();
TrendingContentsResponse res = sdk.trending().contents()
.request(req)
.call();
if (res.standardResponse().isPresent()) {
System.out.println(res.standardResponse().get());
}
}
}
TrendingContentsResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
tweets
Get trending tweets for a country, with optional topic and content tag filters.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TrendingTweetsRequest;
import io.twexapi.sdk.models.operations.TrendingTweetsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TrendingTweetsRequest req = TrendingTweetsRequest.builder()
.country("Lithuania")
.build();
TrendingTweetsResponse res = sdk.trending().tweets()
.request(req)
.call();
if (res.searchResponse().isPresent()) {
System.out.println(res.searchResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TrendingTweetsRequest |
✔️ |
The request object to use for the request. |
TrendingTweetsResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get X Explore trending topics for a given country. Use 'worldwide' for account-default trends or a country slug such as 'united-states'.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.Country;
import io.twexapi.sdk.models.operations.TrendingByCountryRequest;
import io.twexapi.sdk.models.operations.TrendingByCountryResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
TrendingByCountryRequest req = TrendingByCountryRequest.builder()
.country(Country.WORLDWIDE)
.build();
TrendingByCountryResponse res = sdk.trending().byCountry()
.request(req)
.call();
if (res.standardResponse().isPresent()) {
System.out.println(res.standardResponse().get());
}
}
}
TrendingByCountryResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |