Android / Twitter API v2 / Lookup Spaces created by one or more users
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;
CkJsonObject queryParams = new CkJsonObject();
queryParams.UpdateString("user_ids","");
queryParams.UpdateString("space.fields","");
queryParams.UpdateString("expansions","");
queryParams.UpdateString("user.fields","");
queryParams.UpdateString("topic.fields","");
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkHttpResponse resp = http.QuickRequestParams("GET","https://api.twitter.com/2/spaces/by/creator_id",queryParams);
if (http.get_LastMethodSuccess() == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, String.valueOf(resp.get_StatusCode()));
Log.i(TAG, resp.bodyStr());
}
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 -G -d "user_ids="
-d "space.fields="
-d "expansions="
-d "user.fields="
-d "topic.fields="
-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/spaces/by/creator_id
Postman Collection Item JSON
{
"name": "Lookup Spaces created by one or more users",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.twitter.com/2/spaces/by/creator_id?user_ids=&space.fields=&expansions=&user.fields=&topic.fields",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"spaces",
"by",
"creator_id"
],
"query": [
{
"key": "user_ids",
"value": "",
"description": "Required. A comma-separated list of user IDs. You can specify up 100 IDs in a single request."
},
{
"key": "space.fields",
"value": "",
"description": "Comma-separated list of fields from the Space object you want to return from your request.\n\nAvailable fields:\nhost_ids,created_at,creator_id,id,lang,invited_user_ids, participant_count,speaker_ids,started_at,state,title,updated_at, scheduled_start,is_ticketed,ended_at,topic_ids\n\nDefault fields:\nid,state"
},
{
"key": "expansions",
"value": "",
"description": "Comma-separated list of fields to expand. Expansions enable requests to expand an ID into a full object in the includes response object.\n\nAvailable values:\ninvited_user_ids,speaker_ids,creator_id,host_ids"
},
{
"key": "user.fields",
"value": "",
"description": "Comma-separated list of fields to expand. Expansions enable requests to expand an ID into a full object in the includes response object.\n\nAvailable values:\ncreated_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld\n\nDefault values:\nid,name.username"
},
{
"key": "topic.fields",
"value": null,
"description": "Comma-separated list of fields from the Space Topics object you want to return from your request.\n\nAvailable values:\nid,name,description"
}
]
},
"description": "This endpoint returns information about a user. Specify user by username.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}