Android / Twitter API v2 / List Tweets lookup
Back to Collection Items
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = http.QuickGetSb("https://api.twitter.com/2/lists/:id/tweets",sbResponseBody);
if (success == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, "Response status code = " + String.valueOf(http.get_LastStatus()));
Log.i(TAG, sbResponseBody.getAsString());
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/lists/:id/tweets
Postman Collection Item JSON
{
"name": "List Tweets lookup",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "",
"value": "",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "formdata",
"formdata": [
]
},
"url": {
"raw": "https://api.twitter.com/2/lists/:id/tweets",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"lists",
":id",
"tweets"
],
"query": [
{
"key": "tweet.fields",
"value": "",
"description": "Comma-separated list of fields for the Tweet object.\nAllowed values:\nattachments,author_id,context_annotations,conversation_id,created_at,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,organic_metrics,possibly_sensitive,promoted_metrics,public_metrics,referenced_tweets,reply_settings,source,text,withheld\nDefault values:\nid,text\nOAuth1.0a User Context authorization required if any of the following fields are included in the request:\nnon_public_metrics,organic_metrics,promoted_metrics\n",
"disabled": true
},
{
"key": "expansions",
"value": "",
"description": "Expansions enable requests to expand an ID into a full object in the includes response object.\nAllowed value:\nauthor_id\nDefault value: none",
"disabled": true
},
{
"key": "user.fields",
"value": "",
"description": "Comma-separated list of fields for the User object. Expansion required.\nAllowed values:\ncreated_at, description, entities, id, location, name, pinned_tweet_id, profile_image_url, protected, public_metrics, url, username, verified, withheld\nDefault values:\nid,name,username",
"disabled": true
},
{
"key": "max_results",
"value": "",
"description": "The maximum number of results to be returned by a request.\nAllowed values: 1 through 100.\nDefault value: 100",
"disabled": true
},
{
"key": "pagination_token",
"value": null,
"description": "This parameter is used to get the next 'page' of results. The value used with the parameter is pulled directly from the response provided by the API, and should not be modified.",
"disabled": true
}
],
"variable": [
{
"key": "id",
"value": "",
"description": "Required. The ID of the List you wish to recieve Tweet details on."
}
]
},
"description": "This endpoint returns all Tweets from a List specified by the requested ID\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/api-reference/get-lists-id-tweets) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}