Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 3.18 KB

File metadata and controls

66 lines (46 loc) · 3.18 KB

Tweets.Replies

Overview

Available Operations

  • page - Get Replies by Page

page

Recommended for fetching tweet replies. Uses cursor-based pagination and avoids timeouts on large threads. The first request (omit next_cursor) returns root_tweet plus the first batch of replies. Pass next_cursor from the previous response to fetch the next page until has_next_page is false. Pricing: $0.10 per 1,000 replies.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetRepliesPageQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsRepliesPageRequest;
import io.twexapi.sdk.models.operations.TweetsRepliesPageResponse;
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();

        TweetsRepliesPageRequest req = TweetsRepliesPageRequest.builder()
                .tweetId("1803006263529541838")
                .body(GetRepliesPageQuery.builder()
                    .build())
                .build();

        TweetsRepliesPageResponse res = sdk.tweets().replies().page()
                .request(req)
                .call();

        if (res.getRepliesPageResponse().isPresent()) {
            System.out.println(res.getRepliesPageResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request TweetsRepliesPageRequest ✔️ The request object to use for the request.

Response

TweetsRepliesPageResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 4XX, 5XX */*