All URIs are relative to https://api.twitter.com
Method | HTTP request | Description |
---|---|---|
findMyUser | GET /2/users/me | User lookup me |
findUserById | GET /2/users/{id} | User lookup by ID |
findUserByUsername | GET /2/users/by/username/{username} | User lookup by username |
findUsersById | GET /2/users | User lookup by IDs |
findUsersByUsername | GET /2/users/by | User lookup by usernames |
listGetFollowers | GET /2/lists/{id}/followers | Returns user objects that follow a List by the provided List ID |
listGetMembers | GET /2/lists/{id}/members | Returns user objects that are members of a List by the provided List ID |
tweetsIdLikingUsers | GET /2/tweets/{id}/liking_users | Returns user objects that have liked the provided Tweet ID |
tweetsIdRetweetingUsers | GET /2/tweets/{id}/retweeted_by | Returns user objects that have retweeted the provided Tweet ID |
usersIdBlock | POST /2/users/{id}/blocking | Block User by User ID |
usersIdBlocking | GET /2/users/{id}/blocking | Returns user objects that are blocked by provided user ID |
usersIdFollow | POST /2/users/{id}/following | Follow User |
usersIdFollowers | GET /2/users/{id}/followers | Returns user objects that follow the provided user ID |
usersIdFollowing | GET /2/users/{id}/following | Following by User ID |
usersIdMute | POST /2/users/{id}/muting | Mute User by User ID |
usersIdMuting | GET /2/users/{id}/muting | Returns user objects that are muted by the provided user ID |
usersIdUnblock | DELETE /2/users/{source_user_id}/blocking/{target_user_id} | Unblock User by User ID |
usersIdUnfollow | DELETE /2/users/{source_user_id}/following/{target_user_id} | Unfollow User |
usersIdUnmute | DELETE /2/users/{source_user_id}/muting/{target_user_id} | Unmute User by User ID |
SingleUserLookupResponse findMyUser(expansions, tweetFields, userFields)
User lookup me
This endpoint returns information about the requesting user.
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
SingleUserLookupResponse result = apiInstance.users().findMyUser(expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#findMyUser");
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 |
---|---|---|---|
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
SingleUserLookupResponse findUserById(id, expansions, tweetFields, userFields)
User lookup by ID
This endpoint returns information about a user. Specify user by ID.
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "2244994945"; // String | Required. A User ID.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
SingleUserLookupResponse result = apiInstance.users().findUserById(id, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#findUserById");
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 |
---|---|---|---|
id | String | Required. A User ID. | |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
SingleUserLookupResponse findUserByUsername(username, expansions, tweetFields, userFields)
User lookup by username
This endpoint returns information about a user. Specify user by username.
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String username = "TwitterDev"; // String | Required. A username.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
SingleUserLookupResponse result = apiInstance.users().findUserByUsername(username, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#findUserByUsername");
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 |
---|---|---|---|
username | String | Required. A username. | |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
MultiUserLookupResponse findUsersById(ids, expansions, tweetFields, userFields)
User lookup by IDs
This endpoint returns information about users. Specify users by their ID.
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
List<String> ids = Arrays.asList(); // List<String> | Required. A list of User IDs, comma-separated. You can specify up to 100 IDs.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
MultiUserLookupResponse result = apiInstance.users().findUsersById(ids, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#findUsersById");
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 |
---|---|---|---|
ids | List<String> | Required. A list of User IDs, comma-separated. You can specify up to 100 IDs. | |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
MultiUserLookupResponse findUsersByUsername(usernames, expansions, tweetFields, userFields)
User lookup by usernames
This endpoint returns information about users. Specify users by their username.
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
List<String> usernames = Arrays.asList(); // List<String> | Required . A list of usernames, comma-separated. You can specify up to 100 usernames.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
MultiUserLookupResponse result = apiInstance.users().findUsersByUsername(usernames, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#findUsersByUsername");
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 |
---|---|---|---|
usernames | List<String> | Required . A list of usernames, comma-separated. You can specify up to 100 usernames. | |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
ListLookupMultipleUsersLookupResponse listGetFollowers(id, maxResults, paginationToken, expansions, tweetFields, userFields)
Returns user objects that follow a List by the provided List ID
Returns a list of users that follow a List by the provided List ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the List for which to return followers
Integer maxResults = 100; // Integer | The maximum number of results
Long paginationToken = 56L; // Long | This parameter is used to get a specified 'page' of results.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
ListLookupMultipleUsersLookupResponse result = apiInstance.users().listGetFollowers(id, maxResults, paginationToken, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#listGetFollowers");
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 |
---|---|---|---|
id | String | The ID of the List for which to return followers | |
maxResults | Integer | The maximum number of results | [optional] [default to 100] |
paginationToken | Long | This parameter is used to get a specified 'page' of results. | [optional] |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
ListLookupMultipleUsersLookupResponse
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
ListLookupMultipleUsersLookupResponse listGetMembers(id, maxResults, paginationToken, expansions, tweetFields, userFields)
Returns user objects that are members of a List by the provided List ID
Returns a list of users that are members of a List by the provided List ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the List for which to return members
Integer maxResults = 100; // Integer | The maximum number of results
Long paginationToken = 56L; // Long | This parameter is used to get a specified 'page' of results.
Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand.
Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display.
Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display.
try {
ListLookupMultipleUsersLookupResponse result = apiInstance.users().listGetMembers(id, maxResults, paginationToken, expansions, tweetFields, userFields);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#listGetMembers");
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 |
---|---|---|---|
id | String | The ID of the List for which to return members | |
maxResults | Integer | The maximum number of results | [optional] [default to 100] |
paginationToken | Long | This parameter is used to get a specified 'page' of results. | [optional] |
expansions | Set<String> | A comma separated list of fields to expand. | [optional] [enum: pinned_tweet_id] |
tweetFields | Set<String> | A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
userFields | Set<String> | A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
ListLookupMultipleUsersLookupResponse
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
GenericMultipleUsersLookupResponse tweetsIdLikingUsers(id, maxResults, paginationToken)
Returns user objects that have liked the provided Tweet ID
Returns a list of users that have liked the provided Tweet ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the Tweet for which to return results
Integer maxResults = 100; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This parameter is used to get the next 'page' of results.
try {
GenericMultipleUsersLookupResponse result = apiInstance.users().tweetsIdLikingUsers(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#tweetsIdLikingUsers");
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 |
---|---|---|---|
id | String | The ID of the Tweet for which to return results | |
maxResults | Integer | The maximum number of results | [optional] [default to 100] |
paginationToken | String | This parameter is used to get the next 'page' of results. | [optional] |
GenericMultipleUsersLookupResponse
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
GenericMultipleUsersLookupResponse tweetsIdRetweetingUsers(id, maxResults, paginationToken)
Returns user objects that have retweeted the provided Tweet ID
Returns a list of users that have retweeted the provided Tweet ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the Tweet for which to return results
Integer maxResults = 100; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This parameter is used to get the next 'page' of results.
try {
GenericMultipleUsersLookupResponse result = apiInstance.users().tweetsIdRetweetingUsers(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#tweetsIdRetweetingUsers");
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 |
---|---|---|---|
id | String | The ID of the Tweet for which to return results | |
maxResults | Integer | The maximum number of results | [optional] [default to 100] |
paginationToken | String | This parameter is used to get the next 'page' of results. | [optional] |
GenericMultipleUsersLookupResponse
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersBlockingMutationResponse usersIdBlock(usersIdBlockRequest, id)
Block User by User ID
Causes the user (in the path) to block the target user. The user (in the path) must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
UsersIdBlockRequest usersIdBlockRequest = new UsersIdBlockRequest(); // UsersIdBlockRequest |
String id = "id_example"; // String | The ID of the user that is requesting to block the target user
try {
UsersBlockingMutationResponse result = apiInstance.users().usersIdBlock(usersIdBlockRequest, id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdBlock");
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 |
---|---|---|---|
usersIdBlockRequest | UsersIdBlockRequest | [optional] | |
id | String | The ID of the user that is requesting to block the target user |
- Content-Type: application/json
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
GenericMultipleUsersLookupResponse usersIdBlocking(id, maxResults, paginationToken)
Returns user objects that are blocked by provided user ID
Returns a list of users that are blocked by the provided user ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the user for whom to return results
Integer maxResults = 56; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results.
try {
GenericMultipleUsersLookupResponse result = apiInstance.users().usersIdBlocking(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdBlocking");
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 |
---|---|---|---|
id | String | The ID of the user for whom to return results | |
maxResults | Integer | The maximum number of results | [optional] |
paginationToken | String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results. | [optional] |
GenericMultipleUsersLookupResponse
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersFollowingCreateResponse usersIdFollow(usersIdFollowRequest, id)
Follow User
Causes the user(in the path) to follow, or “request to follow” for protected users, the target user. The user(in the path) must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
UsersIdFollowRequest usersIdFollowRequest = new UsersIdFollowRequest(); // UsersIdFollowRequest |
String id = "id_example"; // String | The ID of the user that is requesting to follow the target user
try {
UsersFollowingCreateResponse result = apiInstance.users().usersIdFollow(usersIdFollowRequest, id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdFollow");
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 |
---|---|---|---|
usersIdFollowRequest | UsersIdFollowRequest | [optional] | |
id | String | The ID of the user that is requesting to follow the target user |
- Content-Type: application/json
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
GenericMultipleUsersLookupResponse usersIdFollowers(id, maxResults, paginationToken)
Returns user objects that follow the provided user ID
Returns a list of users that follow the provided user ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the user for whom to return results
Integer maxResults = 56; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results.
try {
GenericMultipleUsersLookupResponse result = apiInstance.users().usersIdFollowers(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdFollowers");
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 |
---|---|---|---|
id | String | The ID of the user for whom to return results | |
maxResults | Integer | The maximum number of results | [optional] |
paginationToken | String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results. | [optional] |
GenericMultipleUsersLookupResponse
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersFollowingLookupResponse usersIdFollowing(id, maxResults, paginationToken)
Following by User ID
Returns a list of users that are being followed by the provided user ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the user for whom to return results
Integer maxResults = 56; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results.
try {
UsersFollowingLookupResponse result = apiInstance.users().usersIdFollowing(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdFollowing");
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 |
---|---|---|---|
id | String | The ID of the user for whom to return results | |
maxResults | Integer | The maximum number of results | [optional] |
paginationToken | String | This value is populated by passing the 'next_token' or 'previous_token' returned in a request to paginate through results. | [optional] |
BearerToken, OAuth2UserToken, UserToken
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersMutingMutationResponse usersIdMute(usersIdMuteRequest, id)
Mute User by User ID
Causes the user (in the path) to mute the target user. The user (in the path) must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
UsersIdMuteRequest usersIdMuteRequest = new UsersIdMuteRequest(); // UsersIdMuteRequest |
String id = "id_example"; // String | The ID of the user that is requesting to mute the target user
try {
UsersMutingMutationResponse result = apiInstance.users().usersIdMute(usersIdMuteRequest, id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdMute");
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 |
---|---|---|---|
usersIdMuteRequest | UsersIdMuteRequest | [optional] | |
id | String | The ID of the user that is requesting to mute the target user |
- Content-Type: application/json
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
GenericMultipleUsersLookupResponse usersIdMuting(id, maxResults, paginationToken)
Returns user objects that are muted by the provided user ID
Returns a list of users that are muted by the provided user ID
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String id = "id_example"; // String | The ID of the user for whom to return results
Integer maxResults = 100; // Integer | The maximum number of results
String paginationToken = "paginationToken_example"; // String | This parameter is used to get the next 'page' of results.
try {
GenericMultipleUsersLookupResponse result = apiInstance.users().usersIdMuting(id, maxResults, paginationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdMuting");
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 |
---|---|---|---|
id | String | The ID of the user for whom to return results | |
maxResults | Integer | The maximum number of results | [optional] [default to 100] |
paginationToken | String | This parameter is used to get the next 'page' of results. | [optional] |
GenericMultipleUsersLookupResponse
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersBlockingMutationResponse usersIdUnblock(sourceUserId, targetUserId)
Unblock User by User ID
Causes the source user to unblock the target user. The source user must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String sourceUserId = "sourceUserId_example"; // String | The ID of the user that is requesting to unblock the target user
String targetUserId = "targetUserId_example"; // String | The ID of the user that the source user is requesting to unblock
try {
UsersBlockingMutationResponse result = apiInstance.users().usersIdUnblock(sourceUserId, targetUserId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdUnblock");
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 |
---|---|---|---|
sourceUserId | String | The ID of the user that is requesting to unblock the target user | |
targetUserId | String | The ID of the user that the source user is requesting to unblock |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersFollowingDeleteResponse usersIdUnfollow(sourceUserId, targetUserId)
Unfollow User
Causes the source user to unfollow the target user. The source user must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String sourceUserId = "sourceUserId_example"; // String | The ID of the user that is requesting to unfollow the target user
String targetUserId = "targetUserId_example"; // String | The ID of the user that the source user is requesting to unfollow
try {
UsersFollowingDeleteResponse result = apiInstance.users().usersIdUnfollow(sourceUserId, targetUserId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdUnfollow");
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 |
---|---|---|---|
sourceUserId | String | The ID of the user that is requesting to unfollow the target user | |
targetUserId | String | The ID of the user that the source user is requesting to unfollow |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |
UsersMutingMutationResponse usersIdUnmute(sourceUserId, targetUserId)
Unmute User by User ID
Causes the source user to unmute the target user. The source user must match the user context authorizing the request
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;
import com.twitter.clientlib.api.UsersApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;
public class Example {
public static void main(String[] args) {
TwitterApi apiInstance = new TwitterApi();
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
// Uncomment and set the credentials configuration
// Configure OAuth2 access token for authorization:
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
// apiInstance.setTwitterCredentials(credentials);
// Set the params values
String sourceUserId = "sourceUserId_example"; // String | The ID of the user that is requesting to unmute the target user
String targetUserId = "targetUserId_example"; // String | The ID of the user that the source user is requesting to unmute
try {
UsersMutingMutationResponse result = apiInstance.users().usersIdUnmute(sourceUserId, targetUserId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#usersIdUnmute");
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 |
---|---|---|---|
sourceUserId | String | The ID of the user that is requesting to unmute the target user | |
targetUserId | String | The ID of the user that the source user is requesting to unmute |
- Content-Type: Not defined
- Accept: application/json, application/problem+json
Status code | Description | Response headers |
---|---|---|
200 | The request was successful | - |
0 | The request has failed. | - |